Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Compile #109

Open
alienonolympus opened this issue Oct 26, 2015 · 42 comments
Open

Can't Compile #109

alienonolympus opened this issue Oct 26, 2015 · 42 comments

Comments

@alienonolympus
Copy link

I'm trying to use Piston, but am encountering some compiling problems. I'm on Windows 10 using MSYS2, and everything had worked well with cargo right until now. I followed the instructions in 'Getting Started' but still can't do anything. Apologies for my ignorance on the error messages:

Compiling getting-started-spinning-square v0.1.0 (file:///C:/Users/The/Desktop/getting-started)
error: linking with `gcc` failed: exit code: 1
note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-static-libgcc" "-m64" "-L" "C:\\Program Files\\Rust stable 1.3\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\spinning_square.0.o" "-o" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\spinning_square.exe" "-Wl,--gc-sections" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libpiston-f05740a5fa6b4d41.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libglutin_window-364f74d85b28ba61.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libglutin-cccc7c39d916833b.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libuser32-dc94dabda4876d9a.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libdwmapi-9ad49f05afcefc91.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libevent_loop-2d81b21f0a23bcdb.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libwindow-55f1794a3dea5573.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libinput-ce8af36c334a0d0b.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libkernel32-62844336d3806e02.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libshell32-7fc5728fe7652dea.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libclock_ticks-995f487ba7426efb.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libshared_library-5803f342d4deed60.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\liblazy_static-f3aa6dfcc7c157cc.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libgdi32-5ec2c9d6697f647a.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libopengl_graphics-0d8fbc27711d2020.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libshader_version-f684e92d2d314f91.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libgraphics-02b6a2694e724a6a.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libread_color-309218e52cd2ef95.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libviewport-2fa528cee63f2915.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libinterpolation-ee7e041bd12b608b.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libshaders_graphics2d-bb347d3b5d5c0137.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libfreetype-e2d1ce256e87fc8a.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libgl-fe0b548fd52d3e1e.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libvecmath-9b5adf5764bff9e1.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libimage-93dd1490cda84244.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libbyteorder-3e27c88aa235985f.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libdraw_state-8219476462483b29.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libfreetype_sys-a42cc5659b21e38e.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libgl_common-191611e16c4da32b.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libfloat-5e49744bf68c9774.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libenum_primitive-0dc42c1f3182f8bc.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libnum-397f282c1d72fe58.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\librand-bdfcc55d3466feb3.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\librustc_serialize-7ff5bfc027146194.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libtexture-2cc8819f6fb938df.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libbitflags-c495827ddcd6a202.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libadvapi32-cfef7a1f30f1e5f6.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libwinapi-21b078e9a1931364.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\liblibc-144c435538abd757.rlib" "C:\\Program Files\\Rust stable 1.3\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-198068b3.rlib" "C:\\Program Files\\Rust stable 1.3\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcollections-198068b3.rlib" "C:\\Program Files\\Rust stable 1.3\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_unicode-198068b3.rlib" "C:\\Program Files\\Rust stable 1.3\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\librand-198068b3.rlib" "C:\\Program Files\\Rust stable 1.3\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-198068b3.rlib" "C:\\Program Files\\Rust stable 1.3\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-198068b3.rlib" "C:\\Program Files\\Rust stable 1.3\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-198068b3.rlib" "-L" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug" "-L" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps" "-L" "C:\\msys64\\home\\The\\.cargo\\registry\\src\\github.com-0a35038f75765ae4\\dwmapi-sys-0.1.0/x86_64" "-L" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\build\\miniz-sys-fa48ce1a538dca79\\out" "-L" "C:\\Program Files\\Rust stable 1.3\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib" "-L" "C:\\Users\\The\\Desktop\\getting-started\\.rust\\bin\\x86_64-pc-windows-gnu" "-L" "C:\\Users\\The\\Desktop\\getting-started\\bin\\x86_64-pc-windows-gnu" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-l" "opengl32" "-l" "user32" "-l" "dwmapi" "-l" "kernel32" "-l" "shell32" "-l" "gdi32" "-l" "freetype-6" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "advapi32" "-l" "compiler-rt"
note: ld: cannot find -lfreetype-6

error: aborting due to previous error
Could not compile `getting-started-spinning-square`.

To learn more, run the command again with --verbose.

I'm guessing it's an environment variable problem? Although I've tried it...

@phrohdoh
Copy link

Do you have freetype6 installed?
It seems pacman, which MSYS2 uses, does not provide a way to search for packages by keyword (please correct me if I am mistaken).

Windows 10 comes with choco iirc, so you should be able to install freetype somehow with one or both of those.

choco doesn't seem to have a native package, unfortunately.

@alienonolympus
Copy link
Author

I think I have freetype 6 installed. I'll check again.

@alienonolympus
Copy link
Author

Apparently, I installed the 32 bit version. I used pacman -Ss and searched for packages. I will see if it works after the download/installation.

EDIT: Now, it's installed but nothing changed.

@alienonolympus
Copy link
Author

I give up. I'll try to redo this some other time.

@bvssvni
Copy link
Member

bvssvni commented Nov 7, 2015

@Carbon-Labs Some people have been working on this lately. freetype-sys has updated the README that tells how to install Freetype on Windows. See https://github.com/pistondevelopers/freetype-sys

@alienonolympus
Copy link
Author

Ok! I'll check it out now!

(I didn't check this issue anymore after closing, so I'm 7 days late!)

@alienonolympus
Copy link
Author

Still not working.

I'm going to reinstall everything again.

@alienonolympus
Copy link
Author

New error:

Build failed, waiting for other jobs to finish...
failed to run custom build command for 'miniz-sys v0.1.6'
Process didn't exit successfully: 'C:\Users\The\Desktop\getting-started\target\debug\build\miniz-sys-fa48ce1a538dca79\build-script-build' (exit code: 101)
--- stdout
TARGET = Some("x86_64-pc-windows-gnu")
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
TARGET = Some("x86_64-pc-windows-gnu")
debug=true opt-level=0
HOST = Some("x86_64-pc-windows-gnu")
TARGET = Some("x86_64-pc-windows-gnu")
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
running: "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-o" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\build\\miniz-sys-fa48ce1a538dca79\\out\\miniz.o" "-c" "miniz.c"


failed to execute command: The system cannot find the file specified. (os error 2)
Is `gcc.exe` not installed? (see https://github.com/alexcrichton/gcc-rs#compile-time-requirements for help)



--- stderr
thread '<main>' panicked at 'explicit panic', C:\msys64\home\The\.cargo\registry\src\github.com-0a35038f75765ae4\gcc-0.3.19\src\lib.rs:771

I am ABSOLUTELY sure C:\msys64\mingw64\bin is in path.

@alienonolympus
Copy link
Author

The previous one was from the MSYS2 terminal. This one is from the MinGW terminal

   Compiling getting-started-spinning-square v0.1.0 (file:///C:/Users/The/Desktop/getting-started)
error: linking with `gcc` failed: exit code: 1
note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\spinning_square.0.o" "-o" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\spinning_square.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug" "-L" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps" "-L" "C:\\msys64\\home\\The\\.cargo\\registry\\src\\github.com-0a35038f75765ae4\\dwmapi-sys-0.1.0/x86_64" "-L" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\build\\miniz-sys-fa48ce1a538dca79\\out" "-L" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-L" "C:\\Users\\The\\Desktop\\getting-started\\.rust\\lib\\x86_64-pc-windows-gnu" "-L" "C:\\Users\\The\\Desktop\\getting-started\\lib\\x86_64-pc-windows-gnu" "-Wl,-Bstatic" "-Wl,-Bdynamic" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libopengl_graphics-0d8fbc27711d2020.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libfreetype-e2d1ce256e87fc8a.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libglutin_window-364f74d85b28ba61.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libpiston-f05740a5fa6b4d41.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libfreetype_sys-a42cc5659b21e38e.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libshaders_graphics2d-bb347d3b5d5c0137.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libglutin-cccc7c39d916833b.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libshared_library-5803f342d4deed60.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libuser32-dc94dabda4876d9a.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libgdi32-5ec2c9d6697f647a.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libimage-93dd1490cda84244.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libkernel32-62844336d3806e02.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libdwmapi-9ad49f05afcefc91.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libenum_primitive-0dc42c1f3182f8bc.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libnum-397f282c1d72fe58.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\librand-bdfcc55d3466feb3.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libadvapi32-cfef7a1f30f1e5f6.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libevent_loop-2d81b21f0a23bcdb.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libwindow-55f1794a3dea5573.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libinput-ce8af36c334a0d0b.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\librustc_serialize-7ff5bfc027146194.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libshader_version-f684e92d2d314f91.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\liblazy_static-f3aa6dfcc7c157cc.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libbyteorder-3e27c88aa235985f.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libclock_ticks-995f487ba7426efb.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libshell32-7fc5728fe7652dea.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libwinapi-21b078e9a1931364.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libgraphics-02b6a2694e724a6a.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libdraw_state-8219476462483b29.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libread_color-309218e52cd2ef95.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libtexture-2cc8819f6fb938df.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libvecmath-9b5adf5764bff9e1.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libbitflags-c495827ddcd6a202.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libinterpolation-ee7e041bd12b608b.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libviewport-2fa528cee63f2915.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libfloat-5e49744bf68c9774.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libgl-fe0b548fd52d3e1e.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\libgl_common-191611e16c4da32b.rlib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps\\liblibc-144c435538abd757.rlib" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-8cf6ce90.rlib" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcollections-8cf6ce90.rlib" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_unicode-8cf6ce90.rlib" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librand-8cf6ce90.rlib" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-8cf6ce90.rlib" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc_jemalloc-8cf6ce90.rlib" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-8cf6ce90.rlib" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-8cf6ce90.rlib" "-l" "freetype-6" "-l" "opengl32" "-l" "user32" "-l" "gdi32" "-l" "kernel32" "-l" "dwmapi" "-l" "advapi32" "-l" "shell32" "-l" "gcc_eh" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-l" "advapi32" "-l" "compiler-rt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Program Files\\Rust nightly 1.6\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
note: ld: cannot find -lfreetype-6

error: aborting due to previous error
Could not compile `getting-started-spinning-square`.

Absolute same config.

@bombless
Copy link
Contributor

My guess is that you cannot use linkers from rust installer to link that freetype library.
That said, you don't install linkers when you install rustc.
install

And you install your C compiler and linkers from pacman.

pacman -S mingw-w64-i686-toolchain

(if you are using 32bit version rustc etc.)

@bombless
Copy link
Contributor

I did the instructions above (after I removed my original rustc installation), and am able to compile & run the project successfully.

@bombless
Copy link
Contributor

The way I see it, the freetype-sys guiding page doesn't really show the fact that you cannot install C compilers when you install Rust.

I'll make a PR to freetype-sys later to improve this.

EDIT:
https://botbot.me/mozilla/rust/2015-12-10/?msg=55809332&page=25
I guess we don't have to install gcc here so I changed my mind :)
I'll see what's the simplest solution.

@alienonolympus
Copy link
Author

I'll try a reinstall.

@alienonolympus
Copy link
Author

Might be because of the linker.

@alienonolympus
Copy link
Author

    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading gl_generator v0.3.0
 Downloading dylib v0.0.1
 Downloading piston-texture v0.2.3
 Downloading bitflags v0.3.2
 Downloading pistoncore-window v0.14.0
 Downloading shell32-sys v0.1.1
 Downloading pistoncore-event_loop v0.16.0
 Downloading enum_primitive v0.1.0
 Downloading mmap v0.1.1
 Downloading piston-shaders_graphics2d v0.1.0
 Downloading winapi-build v0.1.1
 Downloading miniz-sys v0.1.7
 Downloading core-foundation-sys v0.2.0
 Downloading draw_state v0.2.0
 Downloading dlib v0.1.1
 Downloading malloc_buf v0.0.5
 Downloading piston2d-graphics v0.11.0
 Downloading xml-rs v0.1.26
 Downloading pistoncore-input v0.8.0
 Downloading byteorder v0.4.2
 Downloading cocoa v0.2.2
 Downloading vecmath v0.2.0
 Downloading byteorder v0.3.13
 Downloading flate2 v0.2.11
 Downloading gl_generator v0.1.0
 Downloading lzw v0.9.0
 Downloading gdi32-sys v0.1.1
 Downloading lazy_static v0.1.15
 Downloading kernel32-sys v0.1.4
 Downloading khronos_api v0.0.8
 Downloading piston2d-opengl_graphics v0.20.0
 Downloading png v0.4.0
 Downloading gif v0.6.0
 Downloading rand v0.3.11
 Downloading gcc v0.3.19
 Downloading cgl v0.1.0
 Downloading bitflags v0.1.1
 Downloading shared_library v0.1.0
 Downloading tempdir v0.3.4
 Downloading wayland-client v0.2.1
 Downloading interpolation v0.1.0
 Downloading log v0.3.2
 Downloading wayland-kbd v0.2.0
 Downloading color_quant v1.0.0
 Downloading khronos_api v1.0.0
 Downloading gleam v0.1.13
 Downloading advapi32-sys v0.1.2
 Downloading num v0.1.27
 Downloading piston-viewport v0.2.0
 Downloading glob v0.2.10
 Downloading wayland-window v0.1.0
 Downloading core-foundation v0.2.0
 Downloading tempfile v1.1.1
 Downloading gl v0.4.0
 Downloading x11-dl v2.2.1
 Downloading pistoncore-glutin_window v0.19.0
 Downloading core-graphics v0.2.0
 Downloading user32-sys v0.1.2
 Downloading gl_common v0.1.0
 Downloading libc v0.1.10
 Downloading shader_version v0.2.1
 Downloading glutin v0.4.3
 Downloading dwmapi-sys v0.1.0
 Downloading libz-sys v1.0.0
 Downloading rustc-serialize v0.3.16
 Downloading android_glue v0.1.1
 Downloading kernel32-sys v0.2.1
 Downloading time v0.1.34
 Downloading objc v0.1.8
 Downloading inflate v0.1.0
 Downloading xml-rs v0.2.2
 Downloading osmesa-sys v0.0.5
 Downloading core-graphics v0.1.1
 Downloading gl_generator v0.4.2
 Downloading read_color v0.1.0
 Downloading image v0.5.4
 Downloading libc v0.2.2
 Downloading freetype-rs v0.4.1
 Downloading freetype-sys v0.2.1
 Downloading pkg-config v0.3.6
 Downloading piston-float v0.2.0
 Downloading piston v0.16.0
 Downloading winapi v0.2.4
 Downloading core-foundation v0.1.0
   Compiling libc v0.2.2
   Compiling bitflags v0.3.2
   Compiling khronos_api v0.0.8
   Compiling color_quant v1.0.0
   Compiling winapi v0.2.4
   Compiling draw_state v0.2.0
   Compiling lazy_static v0.1.15
   Compiling inflate v0.1.0
   Compiling rustc-serialize v0.3.16
   Compiling libc v0.1.10
   Compiling glob v0.2.10
   Compiling piston-shaders_graphics2d v0.1.0
   Compiling gl_common v0.1.0
   Compiling piston-float v0.2.0
   Compiling vecmath v0.2.0
   Compiling log v0.3.2
   Compiling gdi32-sys v0.1.1
error: linking with `gcc` failed: exit code: 1
note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\build\\gdi32-sys-e0c888f5d5420d5f\\build_script_build.0.o" "-o" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\build\\gdi32-sys-e0c888f5d5420d5f\\build_script_build.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps" "-L" "C:\\Users\\The\\Desktop\\getting-started\\target\\debug\\deps" "-L" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-17a8ccbd.rlib" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcollections-17a8ccbd.rlib" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_unicode-17a8ccbd.rlib" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librand-17a8ccbd.rlib" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-17a8ccbd.rlib" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc_jemalloc-17a8ccbd.rlib" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-17a8ccbd.rlib" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-17a8ccbd.rlib" "-l" "gcc_eh" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-l" "advapi32" "-l" "compiler-rt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Program Files\\Rust nightly 1.7\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
note: C:\Program Files\Rust nightly 1.7\lib\rustlib\x86_64-pc-windows-gnu\lib\crt2.o: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status

error: aborting due to previous error
Build failed, waiting for other jobs to finish...
Could not compile `gdi32-sys`.

To learn more, run the command again with --verbose.

Well... Didn't work.

@bombless
Copy link
Contributor

Well I tested my rustc installed in my office and it fails too.

@GuoShaozheng
Copy link

来自 魅族 MX4 Pro

-------- 原始邮件 --------
发件人:York Xiang [email protected]
时间:周四 12月10日 09:35
收件人:PistonDevelopers/Piston-Tutorials [email protected]
主题:Re: [Piston-Tutorials] Can't Compile (#109)

The way I see it, the freetype-sys guiding page doesn't really show the fact that you cannot install C compilers when you install Rust.

I'll make a PR to freetype-sys later to improve this.


Reply to this email directly or view it on GitHub:
#109 (comment)

@alienonolympus
Copy link
Author

Still stuck here...

@bombless
Copy link
Contributor

I guess you can find /mingw64/lib -name '*freetype*' and then copy those files to some directory that Rust will search for.

As I said above, my environment in my office also doesn't compile piston after reinstall, and when I go back to my office 10 hours later, I'll try this method.

@bombless
Copy link
Contributor

Oh I tried this idea on my laptop first, you can see if this works for you.

This time I use a Rust installation totally without MSYS2, so remember to install linkers when you install Rust. But I'll get freetype from MSYS2.
My MSYS2 is in D:\msys2, so I SET PATH=D:\msys2\mingw64\bin;%PATH% so the program can access several related dll files from there.
I copy libfreetype.a and libfreetype.dll.a from D:\msys2\mingw64\lib, rename them as libfreetype-6.a and libfreetype-6.dll.a, to a folder I created locating at getting-started/bin/x86_64-pc-windows-gnu, yours should be getting-started/bin/i386-pc-windows-gnu.

Now cargo run, that should do the work.

EDIT: fixed typo

@alienonolympus
Copy link
Author

Actually, I use a x86_64 architecture. (My error shows that.)

I'll try that.

@bombless
Copy link
Contributor

Sorry it's getting-started/bin/x86_64-pc-windows-gnu and getting-started/bin/i386-pc-windows-gnu, I made a typo.

@alienonolympus
Copy link
Author

It worked on Arch Linux. Still not working on Windows, though.

@Slowyn
Copy link

Slowyn commented Mar 31, 2016

I have absolutely the same issue on windows 10. So is it possible to compile examples in windows?

@alienonolympus
Copy link
Author

Probably. I still haven't figured out how though. Try it on another OS first, and just experiment.

@DGolubets
Copy link

It was pure PITA but I did it.

  1. Install MSYS2.
  2. Install Rust in MSYS or add existing installation to PATH.
  3. Remove lib\rustlib\x86_64-pc-windows-gnu\bin directory from your Rust installation (or install it without linker)
  4. Install all you need in MSYS: pacman -S mingw-w64-x86_64-gcc, pacman -S mingw-w64-x86_64-freetype
  5. cargo run - it should work now

But, to run it normally, from Explorer, you have to download precompiled freetype.dll and put it along with .exe.

ps
I also tried to use MSVC version of Rust with .cargo/config with linker settings and it work, but.. the program crashed at start with some bullshit compile_shader error in piston2d-opengl_graphics-0.23.0\src\back_end.rs

@alienonolympus
Copy link
Author

Cool. I'll see if it works.

@kyhavlov
Copy link

If anyone gets this working let me know. The whole process of trying to get this to compile on windows is a complete mess; even if I get it to compile it fails to run, with the same compile_shader error that @DGolubets mentioned above

@joelwkall
Copy link

I'm also experiencing the compile_shader error mentioned by @DGolubets and @MrEnzyme. Windows 10, Rust 1.8.0 (MSVC), cargo 0.9.0-nightly

Full error message:

Running `target\debug\spinning-square.exe`
thread '<main>' panicked at 'compile_shader: ERROR: 0:1: '' :  illegal non-ASCII character (0xd0)
ERROR: 0:1: '' :  illegal non-ASCII character (0xa7)
ERROR: 0:1: 'S' : syntax error syntax error

', C:\Users\Joel\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.26.0\src\back_end.rs:141
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Process didn't exit successfully: `target\debug\spinning-square.exe` (exit code: 101)

Using code from the getting-started tutorial, just copy-pasted it.

@joelwkall
Copy link

There's a line in the example code that says

//Change this to OpenGL::V2_1 if not working.

I did so, but got this error message instead:

Running `target\debug\spinning-square.exe`
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: "Attribute \'pos\' does not exists in shader"', ../src/libcore\result.rs:746
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Process didn't exit successfully: `target\debug\spinning-square.exe` (exit code: 101)

@DGolubets
Copy link

That's annoying.. it DID work before I upgraded to Rust 1.8.
Now I'm getting these "illegal character" errors once again..

@DGolubets
Copy link

The source of error is this line: GlGraphics::new(opengl).
If you take example from piston_window (http://docs.piston.rs/piston_window/piston_window/) - it works.

We really need new, updated and tested tutorial from Piston team.

@joelwkall
Copy link

What dependencies do I need for that example? My cargo can't find the crate:

error: can't find crate for piston_window [E0463]
src\main.rs:1 extern crate piston_window;

@DGolubets
Copy link

piston_window = "0.42.0"

@joelwkall
Copy link

Oooh! Finally got something on screen :) Thank you very much!

@joelwkall
Copy link

joelwkall commented Apr 17, 2016

Now I've rebuilt the spinning-square example to use PistonWindow instead, guided by the example you linked. See code below. Now, as I am a complete Rust and Piston noob, the code is probably stupid in many ways. In particular:

  1. I had to remove the .opengl() call on the window object, or I would get a black window only. Does that mean it's using software renderer now, or is it OK because PistonWindow is a GlutinWindow?
  2. I'm passing the PistonWindow event (which itself is a PistonWindow? I Don't really understand this) to render() instead of setting it as an instance variable in App. Is this bad form? I tried to set it in App but Rust started complaining about "use of moved value" and everything became scary :)
  3. The docs for piston_window says "This library is not meant to be depended on by other libraries.". But we are cool if we use it to build an app, right?
  4. Any other blatant noob mistakes I made?
extern crate piston_window;

use piston_window::*;

pub struct App {
    rotation: f64   // Rotation for the square.
}

impl App {
    fn render(&mut self, e: &PistonWindow, args: &RenderArgs) {

        const GREEN: [f32; 4] = [0.0, 1.0, 0.0, 1.0];
        const RED:   [f32; 4] = [1.0, 0.0, 0.0, 1.0];

        let square = rectangle::square(0.0, 0.0, 50.0);
        let rotation = self.rotation;
        let (x, y) = ((args.width / 2) as f64,
                      (args.height / 2) as f64);

        e.draw_2d(|c, gl| {

            // Clear the screen.
            clear(GREEN, gl);

            let transform = c.transform.trans(x, y)
                                       .rot_rad(rotation)
                                       .trans(-25.0, -25.0);

            // Draw a box rotating around the middle of the screen.
            rectangle(RED, square, transform, gl);
        });
    }

    fn update(&mut self, args: &UpdateArgs) {
        // Rotate 2 radians per second.
        self.rotation += 2.0 * args.dt;
    }
}

fn main() {

    // Create an Glutin window.
    let window: PistonWindow = WindowSettings::new(
            "spinning-square",
            [200, 200]
        )
        .exit_on_esc(true)
        .build()
        .unwrap();

    // Create a new game and run it.
    let mut app = App {
        rotation: 0.0
    };

    for e in window {

        if let Some(r) = e.render_args() {
            app.render(&e,&r);
        }

        if let Some(u) = e.update_args() {
            app.update(&u);
        }
    }
}

If it's not too stupid I would be happy to issue a PR.

@DGolubets
Copy link

@joelwkall Beware, that I'm also Piston and Rust noob yet :) Nevertheless here is what I think:

  1. It seems that piston_window does use OpenGL or at least tries to do so: https://github.com/PistonDevelopers/piston_window/blob/master/src/lib.rs#L140. Though I don't know how to verify it.
  2. I can't see anything particularly bad in it. It would be cleaner to have it inside RenderArgs, but assuming you don't want to tough piston code yet.. it's ok :D
  3. Yep, we're fine.
  4. Seems fine.

I think you might be interested in tracking or bumping this issue: PistonDevelopers/piston#1048. As you have already noticed: many things are not obvious in Piston yet, like different windows\events (and I'm afraid it's just a tip of an iceberg :D)

@bvssvni
Copy link
Member

bvssvni commented Apr 18, 2016

@joelwkall .draw_2d only calls the closure when there is a render event. See https://github.com/PistonDevelopers/piston_window/blob/master/src/lib.rs#L259

piston_window uses the OpenGL backend of Gfx. The version used to create the window must be the same as the version used to pick shaders, or else it will try to compile shaders for an OpenGL version that does not support the syntax/features. If you have an old driver or running in a virtual machine, you might need to change to OpenGL 2.1.

PistonWindow events are PistonWindow objects. It uses Rc<RefCell<T>> for sharing mutable state. This might be redesigned later. See PistonDevelopers/piston_window#123

Please open up new issues if the problem is not the same as in the top comment. This makes it easier for people to understand what the issue is about and less things to keep track of.

@joelwkall
Copy link

Many thanks to @DGolubets and @bvssvni for the info. I think I have what I need to start coding :) Apologies if I hijacked this issue!

@WooterTheTroubleshooter

Thanks @DGolubets, I was having issues with the freetype linking deal.

Remove lib\rustlib\x86_64-pc-windows-gnu\bin directory from your Rust installation (or install it without linker)

Did the trick for me.

@johnthagen
Copy link
Contributor

Those looking for an interactive example that does not require freetype: https://github.com/PistonDevelopers/piston_window/blob/master/examples/hello_piston.rs

@joelwkall's example does not work on piston_window >=0.43.0

The current Piston-Tutorial example is unfortunately very difficult to get working on Windows. #130

@sherry-ummen
Copy link

sherry-ummen commented Dec 27, 2016

I was also facing the same issue "failed to run custom build command for 'miniz-sys v0.1.6'
"; but after updating to rust 1.14 it just works. Nothing extra I had to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests