Piston-Tutorials
Piston-Tutorials copied to clipboard
Can't Compile
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...
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.
I think I have freetype 6 installed. I'll check again.
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.
I give up. I'll try to redo this some other time.
@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
Ok! I'll check it out now!
(I didn't check this issue anymore after closing, so I'm 7 days late!)
Still not working.
I'm going to reinstall everything again.
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.
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.
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.
And you install your C compiler and linkers from pacman.
pacman -S mingw-w64-i686-toolchain
(if you are using 32bit version rustc etc.)
I did the instructions above (after I removed my original rustc installation), and am able to compile & run the project successfully.
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.
I'll try a reinstall.
Might be because of the linker.
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.
Well I tested my rustc installed in my office and it fails too.
来自 魅族 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: https://github.com/PistonDevelopers/Piston-Tutorials/issues/109#issuecomment-163458381
Still stuck here...
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.
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
Actually, I use a x86_64 architecture. (My error shows that.)
I'll try that.
Sorry it's getting-started/bin/x86_64-pc-windows-gnu
and getting-started/bin/i386-pc-windows-gnu
, I made a typo.
It worked on Arch Linux. Still not working on Windows, though.
I have absolutely the same issue on windows 10. So is it possible to compile examples in windows?
Probably. I still haven't figured out how though. Try it on another OS first, and just experiment.
It was pure PITA but I did it.
- Install MSYS2.
- Install Rust in MSYS or add existing installation to PATH.
- Remove lib\rustlib\x86_64-pc-windows-gnu\bin directory from your Rust installation (or install it without linker)
- Install all you need in MSYS: pacman -S mingw-w64-x86_64-gcc, pacman -S mingw-w64-x86_64-freetype
- 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
Cool. I'll see if it works.
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
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.
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)