Skip to content

Linker error on cross compile to x86_64-pc-windows-gnu #33465

Closed
@Kimundi

Description

@Kimundi

Attempting to cross compile from 64Bit Arch after doing

rustup target add x86_64-pc-windows-gnu
cargo build --release --target=x86_64-pc-windows-gnu --verbose

Errors with an linker error:

marvin@tp-marvin-arch ~/d/r/g/fun1> cargo build --release --target=x86_64-pc-windows-gnu --verbose
       Fresh winapi v0.2.6
       [...]
       Fresh cgmath v0.9.1
   Compiling fun1 v0.1.0 (file:///home/marvin/dev/rust/graphics_fun_2016-05-05/fun1)
     Running `rustc src/main.rs --crate-name fun1 --crate-type bin -C opt-level=3 --out-dir /home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release --emit=dep-info,link --target x86_64-pc-windows-gnu -L dependency=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release -L dependency=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps --extern chrono=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libchrono-086951ef1dea2712.rlib --extern specs=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libspecs-5ca5e24705e76ffe.rlib --extern gfx_device_gl=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx_device_gl-6f378e292a444005.rlib --extern glutin=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libglutin-fe8847f8e5c48a8d.rlib --extern cgmath=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libcgmath-76ab5db7eccfb351.rlib --extern gfx_window_glutin=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx_window_glutin-d2f847aed3bc91f3.rlib --extern gfx=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx-dc2b98d25789486e.rlib -L native=/home/marvin/.cargo/registry/src/github.com-88ac128001ac3a9a/dwmapi-sys-0.1.0/x86_64`
error: linking with `gcc` failed: exit code: 1
note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/crt2.o" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/rsbegin.o" "-L" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/fun1.0.o" "-o" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/fun1.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release" "-L" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps" "-L" "/home/marvin/.cargo/registry/src/github.com-88ac128001ac3a9a/dwmapi-sys-0.1.0/x86_64" "-L" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx-dc2b98d25789486e.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libcgmath-76ab5db7eccfb351.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx_window_glutin-d2f847aed3bc91f3.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libglutin-fe8847f8e5c48a8d.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libdwmapi-57add9827d7809cf.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libuser32-f952491ba4e166ee.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libshared_library-8a12fcda5e4d258b.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/liblazy_static-5e6d9f365bf63baa.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libshell32-f26d4446bb440430.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgdi32-cc8216356f37b045.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx_device_gl-6f378e292a444005.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx_core-aa43f82553171f18.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libdraw_state-419af1c9a7dd52da.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libbitflags-1b9f7576da940a38.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/liblog-342ffb7444a9471d.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libchrono-086951ef1dea2712.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libnum-98981edb917831dc.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libnum_iter-5766581f7597a504.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libnum_complex-c5081e842367373a.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libnum_rational-ee2647e9984d6d27.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libnum_bigint-d5ef62bdcef8e570.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libnum_integer-8f7844108d7e0eab.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/librand-c724acb3942597d1.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libnum_traits-14a2d70fdb554c2a.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx_gl-565a5966718c12a7.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/librustc_serialize-3bc953984ed46e7f.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/liblibc-38919d24e617a235.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libspecs-5ca5e24705e76ffe.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libpulse-15b434d908f5854b.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libtime-71756e48b8b5b73b.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libtuple_utils-c0b4d4d00df3deee.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libatom-3108378d22af7662.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libthreadpool-0bb5a6ba1d0b4f62.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libkernel32-757937e2863677bb.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libwinapi-42bc588a308ea664.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libfnv-bbd2700436e7e891.rlib" "/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libmopa-2d8ed479fbf9b863.rlib" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libstd-cb705824.rlib" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libcollections-cb705824.rlib" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/liballoc-cb705824.rlib" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/liballoc_system-cb705824.rlib" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/liblibc-cb705824.rlib" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/librand-cb705824.rlib" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/librustc_unicode-cb705824.rlib" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libcore-cb705824.rlib" "-l" "opengl32" "-l" "dwmapi" "-l" "user32" "-l" "shell32" "-l" "gdi32" "-l" "advapi32" "-l" "kernel32" "-l" "gcc_eh" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-l" "advapi32" "-l" "compiler-rt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "/home/marvin/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/rsend.o"
note: /usr/bin/ld: unrecognized option '--enable-long-section-names'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status

error: aborting due to previous error
error: Could not compile `fun1`.

Caused by:
  Process didn't exit successfully: `rustc src/main.rs --crate-name fun1 --crate-type bin -C opt-level=3 --out-dir /home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release --emit=dep-info,link --target x86_64-pc-windows-gnu -L dependency=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release -L dependency=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps --extern chrono=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libchrono-086951ef1dea2712.rlib --extern specs=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libspecs-5ca5e24705e76ffe.rlib --extern gfx_device_gl=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx_device_gl-6f378e292a444005.rlib --extern glutin=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libglutin-fe8847f8e5c48a8d.rlib --extern cgmath=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libcgmath-76ab5db7eccfb351.rlib --extern gfx_window_glutin=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx_window_glutin-d2f847aed3bc91f3.rlib --extern gfx=/home/marvin/dev/rust/graphics_fun_2016-05-05/fun1/target/x86_64-pc-windows-gnu/release/deps/libgfx-dc2b98d25789486e.rlib -L native=/home/marvin/.cargo/registry/src/github.com-88ac128001ac3a9a/dwmapi-sys-0.1.0/x86_64` (exit code: 101)

Compiler version:

rustc 1.10.0-nightly (8da2bcac5 2016-04-28)
binary: rustc
commit-hash: 8da2bcac5db1e091b90cceb19d0496f0f7501c88
commit-date: 2016-04-28
host: x86_64-unknown-linux-gnu
release: 1.10.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions