packed_simd icon indicating copy to clipboard operation
packed_simd copied to clipboard

ios builds now fail to link when compiling the test

Open gnzlbg opened this issue 7 years ago • 11 comments

They used to work (https://travis-ci.org/gnzlbg/packed_simd/builds/405449457) but now they fail; need to investigate more.

gnzlbg avatar Jul 19 '18 13:07 gnzlbg

cc @kali any ideas?

gnzlbg avatar Jul 24 '18 12:07 gnzlbg

Not sure where to look at, link to build does not answer... give me more context, I'll be happy to see if I can help

kali avatar Jul 24 '18 16:07 kali

So this basically uses the same ci for testing ios targets as the other std components:

  • four travis ci build bots:
    • arm-apple-ios and aarch64-apple-ios just test that cross-compiling works (we are adding more tests in this regard)
    • i386-apple-ios and x86_64-apple-ios run the full test suite in one of the simulators (these are the build bots that have started to fail)

So for these last two build bots, we have this tiny script from libc that creates a simulator instance and runs the tests and checks whether some test failed: https://github.com/rust-lang-nursery/packed_simd/blob/master/ci/deploy_and_run_on_ios_simulator.rs

and we use it as a cargo test runner: https://github.com/rust-lang-nursery/packed_simd/blob/master/ci/run.sh#L47

If I compile this library for ios with cargo build --target=x86_64-apple-ios then the compilation succeeds, but when I do ..setup test runner.. cargo test --target=x86_64-apple-ios then I get linker errors for some reason since a couple of nightly builds (this used to work before).

I have no idea why this has started happening. Maybe I am using the wrong xcode image in travis? Maybe I am missing something in RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0 ? No idea. The error messages are also weird, -lSystem not being found... I can reproduce this locally as well, so it is not only an issue with travis (I used to be able to run the tests in the simulator locally as well).

gnzlbg avatar Jul 25 '18 08:07 gnzlbg

Is this what we are talking about ?

  = note: ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
          ld: warning: text-based stub file /System/Library/Frameworks//Foundation.framework/Foundation.tbd and library file /System/Library/Frameworks//Foundation.framework/Foundation are out of sync. Falling back to library file for linking.
          ld: warning: ignoring file /var/folders/_6/_9b7mq2959gfgtn5kw5r0m8r0000gn/T/response-f90f64.txt, file was built for unsupported file format ( 0x2F 0x41 0x70 0x70 0x6C 0x69 0x63 0x61 0x74 0x69 0x6F 0x6E 0x73 0x2F 0x58 0x63 ) which is not the architecture being linked (arm64): /var/folders/_6/_9b7mq2959gfgtn5kw5r0m8r0000gn/T/response-f90f64.txt
          ld: warning: ignoring file /usr/lib/libSystem.dylib, missing required architecture arm64 in file /usr/lib/libSystem.dylib (2 slices)
          ld: warning: ignoring file /System/Library/Frameworks//Security.framework/Security, missing required architecture arm64 in file /System/Library/Frameworks//Security.framework/Security (2 slices)
          ld: warning: ignoring file /System/Library/Frameworks//Foundation.framework/Foundation, missing required architecture arm64 in file /System/Library/Frameworks//Foundation.framework/Foundation (2 slices)
          ld: warning: ignoring file /usr/lib/libc.dylib, missing required architecture arm64 in file /usr/lib/libc.dylib (2 slices)
          ld: warning: ignoring file /usr/lib/libm.dylib, missing required architecture arm64 in file /usr/lib/libm.dylib (2 slices)
          ld: warning: ignoring file /usr/lib/libresolv.dylib, missing required architecture arm64 in file /usr/lib/libresolv.dylib (2 slices)
          ld: warning: ignoring file /usr/lib/libobjc.dylib, missing required architecture arm64 in file /usr/lib/libobjc.dylib (3 slices)
          Undefined symbols for architecture arm64:
            "_main", referenced from:
               implicit entry/start for main executable
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

kali avatar Jul 25 '18 12:07 kali

I don't think its the same issue. I am targeting x86_64-apple-ios while that is targeting arm64/aarch64. Also the error there is that _main is not found, which is weird: the packed_simd library has no _main, but when building the tests with cargo test the test crate definitely includes a _main :/

gnzlbg avatar Jul 25 '18 12:07 gnzlbg

any way you can show me the actual failed build output ? :) the link in travis above is a 404

kali avatar Jul 25 '18 12:07 kali

Check out the allow_failure jobs for i386/x86_64-apple-ios on travis: https://travis-ci.org/rust-lang-nursery/packed_simd/

For example, for x86_64: https://travis-ci.org/rust-lang-nursery/packed_simd/jobs/407633458

gnzlbg avatar Jul 25 '18 12:07 gnzlbg

Oh crap, it seems that the error line is too long or something, and the error is not fully shown, not even in the logs... let me reproduce it and upload it to a gist.

gnzlbg avatar Jul 25 '18 12:07 gnzlbg

For what it's worth, i'm trying to build on my side, and struggling with the incredibly long line that is send to the linker (~2500 args or so)

kali avatar Jul 25 '18 13:07 kali

So to reproduce it:

# Get Rust target:
rustup target add x86_64-apple-ios
# Build cargo runner:
export RUSTFLAGS='-C link-args=-mios-simulator-version-min=7.0'
rustc ./ci/deploy_and_run_on_ios_simulator.rs -o ios_cargo_runner --verbose
export CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$(pwd)/ios_cargo_runner
# Build library:
cargo build --target=x86_64-apple-ios
# Build and run tests:
cargo test --target=x86_64-apple-ios

Here the output, yes, the linker line is really long: https://gist.github.com/gnzlbg/4ff458a32ebd56e4d8930aaf766178b4

gnzlbg avatar Jul 25 '18 13:07 gnzlbg

It appears that the tests are now compiling properly, but they don't produce any output anymore with xcode9.4 - libc and mach are experiencing the same issues. https://github.com/rust-lang/libc/issues/1054

gnzlbg avatar Aug 12 '18 15:08 gnzlbg