Open drbawb opened 9 years ago
I seem to be able to compile stb_image.c just fine (e.g: cargo build works), but when I try to link it to another program, or run cargo test, I get an error from the linker.
cargo build
cargo test
OS: Windows 8.1 ENV: MSYS2-20150512/MinGW-x86_64
gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-msys/4.9.2/lto-wrapper.exe Target: x86_64-pc-msys Configured with: /build2/gcc/src/gcc-4.9.2/configure --build=x86_64-pc-msys --prefix=/usr --libexecdir=/usr/lib --enable-bootstrap --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --with-arch=x86-64 --disable-multilib --with-tune=generic --enable-__cxa_atexit --with-dwarf2 --enable-languages=c,c++,fortran,lto --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --disable-win32-registry --disable-symvers --with-gnu-ld --with-gnu-as --disable-isl-version-check --enable-checking=release --without-libiconv-prefix --without-libintl-prefix --with-system-zlib Thread model: posix gcc version 4.9.2 (GCC)
rustc -V rustc 1.2.0-nightly (b77d60adb 2015-05-29) (built 2015-05-30)
The error I'm seeing is undefined references to __assert_func:
__assert_func
$ cargo test Compiling stb_image v0.1.0 (file:///C:/Users/drbawb/senketsu-sandbox/rust-stb-image) 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 nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib" "C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\stb_image-5a494723a7fe8dad.o" "-o" "C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\stb_image-5a494723a7fe8dad.exe" "-Wl,--gc-sections" "C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\deps\liblibc-2eda841eb12a3090.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\libtest-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\libgetopts-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\libserialize-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\libterm-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\liblog-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\libstd-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\libcollections-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\librustc_unicode-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\librand-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\liballoc-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\liblibc-11582ce5.rlib" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib\libcore-11582ce5.rlib" "-L" "C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug" "-L" "C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\deps" "-L" "C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\build\stb_image-d0b38b90eb5da802\out" "-L" "C:\Program Files\Rust nightly 1.2\bin\rustlib\x86_64-pc-windows-gnu\lib" "-L" "C:\Users\drbawb\senketsu-sandbox\rust-stb-image\.rust\bin\x86_64-pc-windows-gnu" "-L" "C:\Users\drbawb\senketsu-sandbox\rust-stb-image\bin\x86_64-pc-windows-gnu" "-Wl,-Bstatic" "-Wl,--whole-archive" "-l" "stb-image" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-l" "kernel32" "-l" "ws2_32" "-l" "userenv" "-l" "advapi32" "-l" "compiler-rt" note: C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\build\stb_image-d0b38b90eb5da802\out\libstb-image.a(stb_image.o):stb_image.c:(.text+0xef9): undefined reference to `__assert_func' C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\build\stb_image-d0b38b90eb5da802\out\libstb-image.a(stb_image.o):stb_image.c:(.text+0x13cb): undefined reference to `__assert_func' C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\build\stb_image-d0b38b90eb5da802\out\libstb-image.a(stb_image.o):stb_image.c:(.text+0x1d08): undefined reference to `__assert_func' C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\build\stb_image-d0b38b90eb5da802\out\libstb-image.a(stb_image.o):stb_image.c:(.text+0x54fa): undefined reference to `__assert_func' C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\build\stb_image-d0b38b90eb5da802\out\libstb-image.a(stb_image.o):stb_image.c:(.text+0x55f8): undefined reference to `__assert_func' C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\build\stb_image-d0b38b90eb5da802\out\libstb-image.a(stb_image.o):stb_image.c:(.text+0x5891): more undefined references to `__assert_func' follow ld: C:\Users\drbawb\senketsu-sandbox\rust-stb-image\target\debug\build\stb_image-d0b38b90eb5da802\out\libstb-image.a(stb_image.o): bad reloc address 0x0 in section `.data'
Just wondering if there's anything glaringly wrong with my setup; or if anyone has seen similar errors when building on Windows?
I seem to be able to compile stb_image.c just fine (e.g:
cargo build
works), but when I try to link it to another program, or runcargo test
, I get an error from the linker.Setup
OS: Windows 8.1 ENV: MSYS2-20150512/MinGW-x86_64
The error I'm seeing is undefined references to
__assert_func
:Just wondering if there's anything glaringly wrong with my setup; or if anyone has seen similar errors when building on Windows?