Testing i686-pc-windows-gnu using travis-ci new windows jobs

Has anyone managed to test the i686-pc-windows-gnu target using travis-ci's new windows jobs ?

I get weird errors like this, probably because the wrong C toolchain is being picked up. My .travis.yml (ctest windows branch) file is pretty much just (you can check out the branch for all the details):

  - name: "x86_64-pc-windows-gnu"
      env: TARGET=x86_64-pc-windows-gnu
      os: windows
    - name: "i686-pc-windows-gnu"
      # Tryto get the right gcc / ld versions used (is this correct?):
      env: TARGET=i686-pc-windows-gnu PATH=$PATH:/c/Program\ Files\ (x86)/Rust/bin:/c/msys64/mingw32/bin
      os: windows
    - name: "x86_64-pc-windows-msvc"
      env: TARGET=x86_64-pc-windows-msvc
      install: true
      os: windows
    - name: "i686-pc-windows-msvc"
      env: TARGET=i686-pc-windows-msvc
      os: windows

install: rustup target add ${TARGET} 
script: cargo test --all --target=${TARGET}

and only i686-pc-windows-gnu fails with this error:

error: linking with `gcc` failed: exit code: 1
  |
  = note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-Wl,--large-address-aware" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\crt2.o" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\ctest-77fdecdd840c9128.10ygozpgsu0ud2lu.rcgu.o" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\ctest-77fdecdd840c9128.1y16o1qfye96o7m0.rcgu.o" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\ctest-77fdecdd840c9128.2226fh7p4842q6ww.rcgu.o" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\ctest-77fdecdd840c9128.3rngp6bm2u2q5z0y.rcgu.o" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\ctest-77fdecdd840c9128.4oc10dk278mpk1vy.rcgu.o" "-o" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\ctest-77fdecdd840c9128.exe" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\ctest-77fdecdd840c9128.crate.allocator.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps" "-L" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\debug\\deps" "-L" "C:\\Users\\travis\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\winapi-i686-pc-windows-gnu-0.4.0\\lib" "-L" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "-Wl,-Bstatic" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libtest-4a2f24e66abfa214.rlib" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libterm-f03408d8257ed9ff.rlib" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libgetopts-772aed0843c97b22.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libsyntex_syntax-21fdf66118d64686.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libunicode_xid-be4c8686bf4bd918.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libserde_json-5028a290b2406db2.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libryu-b83cd47d5935ca08.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libitoa-38cdbb7126b88808.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libextprim-843f620c5f2062b6.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libnum_traits-3dab603956b4d409.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\librand-5c5ceafdcc6d0264.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libwinapi-b8b236ba826e6431.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libsyntex_errors-5214c06806aaedf3.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libsyntex_pos-5cfa9234b640ff48.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libserde-f6ed8a71825307c1.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\liblibc-b01d181682497a43.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libterm-91a4506a80002801.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libkernel32-065ee2d6f088e2bd.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libwinapi-23a727283701989f.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libbitflags-380d656fbed897ef.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\liblog-d5da500d757bd26d.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\liblog-a5f0a6547adb0e61.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libcfg_if-12224e575c559a10.rlib" "C:\\Users\\travis\\build\\gnzlbg\\ctest\\target\\i686-pc-windows-gnu\\debug\\deps\\libcc-b6f2f2765b3bc0ea.rlib" "-Wl,--start-group" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libstd-ebc1fd97c06265bb.rlib" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libpanic_unwind-c2dea241d10ef1d1.rlib" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libunwind-f8b5a53793aaecd8.rlib" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liblibc-6f37db0e550df2b3.rlib" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liballoc_system-1f1be265c96b7dd4.rlib" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liballoc-85075aa5d1316ca8.rlib" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcore-f61e8e83f7620964.rlib" "-Wl,--end-group" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcompiler_builtins-7602506b990ae91e.rlib" "-Wl,-Bdynamic" "-lkernel32" "-lwinapi_advapi32" "-lwinapi_credui" "-lwinapi_kernel32" "-lwinapi_secur32" "-lkernel32" "-ladvapi32" "-lole32" "-loleaut32" "-ladvapi32" "-lws2_32" "-luserenv" "-lshell32" "-Wl,-Bstatic" "-lgcc_eh" "-lpthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Users\\travis\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsend.o"
  = note: C:/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: unrecognized option '--large-address-aware'
          C:/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: use the --help option for usage information
          collect2.exe: error: ld returned 1 exit status

I've only ever used AppVeyor to test Windows, and looking at the config, it looks like we only test MSVC.

In case it helps, here is the AppVeyor config for MSVC: https://github.com/johnthagen/rust-belt/blob/master/appveyor.yml

Yeah, I am able to test the msvc targets with travis, and also the x86_64-pc-windows-gnu target, but its the i686-pc-windows-gnu target that I'm not able to configure properly (FWIW it is properly configured in appveyor, but on travis it fails to link).

Perhaps you're using the wrong linker? I encountered this problem the other day, and ended up having to put this in ~/.cargo/config:

[target.i686-pc-windows-gnu]
linker = "/usr/bin/i686-w64-mingw32-gcc"

But then again, I was attempting to cross-compile from WSL to windows, so I'm not sure if the same problem persists in windows (Or even on travis)

Perhaps you’re using the wrong linker?

Yes, that's probably the reason (the wrong gcc toolchain being picked).

I encountered this problem the other day, and ended up having to put this in ~/.cargo/config

So I don't think that should be necessary, and if someone uses your crate as a dependency, this justs shifts the problem to them (since now they have to add that to their ~/.cargo/config).

In appveyor one just has to make sure that the right toolchain is the only one in the path, but I don't seem to be able to achieve the same thing in travis windows VMs.

Actually, I was trying to cross-compile someone else's code :confused:

I feel you. The gnu toolchain is tier-1, so it shouldn't be that hard to use it. Maybe @steveklabnik @retep998 know a window user that uses this or can explain how to use it in travis windows bots?

1 Like

This is definitely just a case of having a 64-bit MinGW in PATH while using the i686-pc-windows-gnu target which don't work together for what should be hopefully obvious reasons. I guess Travis for some reason defaults to putting MinGW in the PATH while Appveyor doesn't.

2 Likes

That makes sense. Any idea what to change the path to ? Is the 32-bit MinGW toolchain installed?