not-fl3 / test-sys

1 stars 0 forks source link

Compilation fail on Windows #1

Open not-fl3 opened 7 years ago

not-fl3 commented 7 years ago
$ cargo test
   Compiling test-sys v0.1.0 (file:///C:/Users/ASUS%20ROG/wtf/test-sys)
error: linking with `gcc` failed: exit code: 1
  |
  = note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.0.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.1.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.10.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.11.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.12.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.13.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.14.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.15.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.16.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.17.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.18.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.19.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.2.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.20.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.21.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.22.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.23.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.24.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.25.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.26.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.27.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.28.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.29.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.3.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.30.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.31.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.4.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.5.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.6.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.7.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.8.o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.9.o" "-o" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.exe" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps\\test_sys-e96a3d974f0570e4.crate.allocator.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\deps" "-L" "C:\\Users\\ASUS ROG\\wtf\\test-sys\\target\\debug\\build\\test-sys-88be48a1aa2401cc\\out" "-L" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-l" "b.o" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-l" "stdc++" "-Wl,-Bstatic" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libtest-e7eecfd88edb9b74.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libterm-6bc783fc9916c268.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libgetopts-053e30bcaabd1267.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-33f4cb2dc72462a6.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-8bb849c67bd90d1d.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-23d58668f70928d1.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-96912c77cf28bc8b.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc_system-9fe2af5a1bd4a7b0.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-07540e0e082cd3c6.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd_unicode-bf7b0e05a8c6607a.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librand-6aa073dbb840493a.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-f91838c44e4c5c2c.rlib" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-c0653d29c2164570.rlib" "-Wl,-Bdynamic" "-l" "kernel32" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-Wl,-Bstatic" "-l" "gcc_eh" "-l" "pthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Users\\ASUS ROG\\.rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
  = note: C:\Users\ASUS ROG\wtf\test-sys\target\debug\build\test-sys-88be48a1aa2401cc\out\libb.o.a(b.o): In function `__static_initialization_and_destruction_0':
          /usr/lib/gcc/x86_64-pc-msys/5.3.0/include/c++/iostream:74: undefined reference to `__cxa_atexit'
          C:\Users\ASUS ROG\wtf\test-sys\target\debug\build\test-sys-88be48a1aa2401cc\out\libb.o.a(b.o):b.cpp:(.rdata$.refptr.__dso_handle[.refptr.__dso_handle]+0x0): undefined reference to `__dso_handle'

With gcc from mSYS or CYGWIN and nightly-i686-pc-windows-gnu

not-fl3 commented 7 years ago

FInal linking command on linux - no -nostdlib!

  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/fl3/fun/test-sys/target/debug/deps/test_sys-5c0cfd9555b72201.test_sys.o" "/home/fl3/fun/test-sys/target/debug/deps/test_sys-5c0cfd9555b72201.test_sys-__test.o" "-o" "/home/fl3/fun/test-sys/target/debug/deps/test_sys-5c0cfd9555b72201" "/home/fl3/fun/test-sys/target/debug/deps/test_sys-5c0cfd9555b72201.crate.allocator.o" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/home/fl3/fun/test-sys/target/debug/deps" "-L" "/home/fl3/fun/test-sys/target/debug/build/test-sys-904a5fba761c82c8/out" "-L" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-l" "b.o" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-l" "stdc++" "-Wl,-Bstatic" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-075eb86eae505c9d.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-147c5e1cab62934e.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-29c069e1921cf346.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-f5614285b35f1c78.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-d1ae04846f7d0f88.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-78da0d9f215f6e02.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-77c0710854c66c42.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-ed8c3a13fe7ed701.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-d0ddf327d30e75e1.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-5d21c6e81cb80c9d.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-94c90ed6ebe1ce65.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-4ed6731963037d6b.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-211f91cf5e9ad394.rlib" "/home/fl3/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-bc08577478188180.rlib" "-Wl,-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util"