2017-05-24 1 views
0

J'ai un projet multi-module qui contient un rlib (dépend de rust-openssl) et un bin (dépend de rlib) .rust-openssl ne peut pas construire bin quand --target = i386-apple-ios (simulateur iOS)

Il est ok quand je construis RLIB seul, mais quand je construis échoué bin, je suis erreur:

... 
ld: warning: URGENT: building for OSX, but linking in object file (/Users/travis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/i386-apple-ios/lib/liballoc_jemalloc-ea49ffd3fee5264c.rlib(pages.pic.o)) built for iOS. Note: This will be an error in the future. 
      ld: warning: URGENT: building for OSX, but linking in object file (/Users/travis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/i386-apple-ios/lib/liballoc_jemalloc-ea49ffd3fee5264c.rlib(quarantine.pic.o)) built for iOS. Note: This will be an error in the future. 
      ld: warning: URGENT: building for OSX, but linking in object file (/Users/travis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/i386-apple-ios/lib/liballoc_jemalloc-ea49ffd3fee5264c.rlib(rtree.pic.o)) built for iOS. Note: This will be an error in the future. 
      Undefined symbols for architecture i386: 
      "_fputs$UNIX2003", referenced from: 
       _write_string in libopenssl_sys-f183dd940b82d26e.rlib(ui_openssl.o) 
       _read_string in libopenssl_sys-f183dd940b82d26e.rlib(ui_openssl.o) 
      "_fopen$UNIX2003", referenced from: 
       _open_console in libopenssl_sys-f183dd940b82d26e.rlib(ui_openssl.o) 
       _openssl_fopen in libopenssl_sys-f183dd940b82d26e.rlib(o_fopen.o) 
      "_strerror$UNIX2003", referenced from: 
       _openssl_strerror_r in libopenssl_sys-f183dd940b82d26e.rlib(o_str.o) 
      "_fwrite$UNIX2003", referenced from: 
       _file_write in libopenssl_sys-f183dd940b82d26e.rlib(bss_file.o) 
       _file_puts in libopenssl_sys-f183dd940b82d26e.rlib(bss_file.o) 
       _read_string in libopenssl_sys-f183dd940b82d26e.rlib(ui_openssl.o) 
       _read_string_inner in libopenssl_sys-f183dd940b82d26e.rlib(ui_openssl.o) 
       _test_rc4_init_key in libopenssl_sys-f183dd940b82d26e.rlib(eng_openssl.o) 
      ld: symbol(s) not found for architecture i386 
      clang: error: linker command failed with exit code 1 (use -v to see invocation) 
... 

log on travis-ci

cible i386-pomme-ios a échoué. Cible aarch64-apple-ios armv7-apple-ios armv7s-apple-ios ok.

J'ai essayé d'ajouter

[target.i386-apple-ios] 
rustflags = [ 
"-C", "link-arg=-mios-simulator-version-min=7.0.0" 
] 

dans ~/.cargo/config et se termine par une autre erreur comme celui-ci:

ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/user/project/target/i386-apple-ios/debug/deps/libopenssl_sys-9f3b06cb5b388503.rlib(wp-mmx.o)) built for OSX. Note: This will be an error in the future. 
      ld: warning: object file (/Users/user/project/target/i386-apple-ios/debug/deps/libopenssl_sys-9f3b06cb5b388503.rlib(wp-mmx.o)) was built for newer OSX version (10.12) than being linked (7.0) 
      Undefined symbols for architecture i386: 
      "_fputs$UNIX2003", referenced from: 
       _write_string in libopenssl_sys-9f3b06cb5b388503.rlib(ui_openssl.o) 

    process didn't exit successfully: `rustc --crate-name ssurl src/bin/ssurl.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=e779ded66ad6a046 -C extra-filename=-e779ded66ad6a046 --out-dir /Users/user/project/target/i386-apple-ios/debug/deps --target i386-apple-ios -L dependency=/Users/user/project/target/i386-apple-ios/debug/deps -L dependency=/Users/user/project/target/debug/deps --extern serde_json=/Users/user/project/target/i386-apple-ios/debug/deps/libserde_json-a20ebb8bb7b96947.rlib --extern birdcrypto=/Users/user/project/target/i386-apple-ios/debug/deps/libbirdcrypto-7b7f8b4d9b356742.rlib --extern tokio_io=/Users/user/project/target/i386-apple-ios/debug/deps/libtokio_io-ffe06c22ad81dd5f.rlib --extern bytes=/Users/user/project/target/i386-apple-ios/debug/deps/libbytes-3515e9da1291588d.rlib --extern qrcode=/Users/user/project/target/i386-apple-ios/debug/deps/libqrcode-0b5b9eed05c8d5fb.rlib --extern net2=/Users/user/project/target/i386-apple-ios/debug/deps/libnet2-ecef00d50a8ddca3.rlib --extern lru_cache=/Users/user/project/target/i386-apple-ios/debug/deps/liblru_cache-3a583fd605a1b3b3.rlib --extern tokio_core=/Users/user/project/target/i386-apple-ios/debug/deps/libtokio_core-57e0150d22448791.rlib --extern byteorder=/Users/user/project/target/i386-apple-ios/debug/deps/libbyteorder-240cc8a1e1423fad.rlib --extern domain=/Users/user/project/target/i386-apple-ios/debug/deps/libdomain-fc3ea0606d179f92.rlib --extern futures=/Users/user/project/target/i386-apple-ios/debug/deps/libfutures-8985671f9fa6f7b8.rlib --extern time=/Users/user/project/target/i386-apple-ios/debug/deps/libtime-65bf99b4b8c3df95.rlib --extern log=/Users/user/project/target/i386-apple-ios/debug/deps/liblog-d4c0e5c2504fbbea.rlib --extern base64=/Users/user/project/target/i386-apple-ios/debug/deps/libbase64-3733960102cc46b7.rlib --extern env_logger=/Users/user/project/target/i386-apple-ios/debug/deps/libenv_logger-8778ad732965ba61.rlib --extern num_cpus=/Users/user/project/target/i386-apple-ios/debug/deps/libnum_cpus-9b2a7df0e5b9fd16.rlib --extern clap=/Users/user/project/target/i386-apple-ios/debug/deps/libclap-95e5c3504e3f13b5.rlib --extern birdnet=/Users/user/project/target/i386-apple-ios/debug/deps/libbirdnet-baa74095bd0c6dca.rlib -C link-arg=-mios-simulator-version-min=7.0.0 -L native=/Users/user/project/tmp/openssl-1.1.0e-i386-apple-ios/lib -L native=/Users/user/project/target/i386-apple-ios/debug/build/rust-crypto-38b42e435c8bcaf2/out` (exit code: 101)    _read_string in libopenssl_sys-9f3b06cb5b388503.rlib(ui_openssl.o) 
      "_fopen$UNIX2003", referenced from: 
       _open_console in libopenssl_sys-9f3b06cb5b388503.rlib(ui_openssl.o) 
       _openssl_fopen in libopenssl_sys-9f3b06cb5b388503.rlib(o_fopen.o) 
      "_strerror$UNIX2003", referenced from: 
       _openssl_strerror_r in libopenssl_sys-9f3b06cb5b388503.rlib(o_str.o) 
      "_fwrite$UNIX2003", referenced from: 
       _file_write in libopenssl_sys-9f3b06cb5b388503.rlib(bss_file.o) 
       _file_puts in libopenssl_sys-9f3b06cb5b388503.rlib(bss_file.o) 
       _read_string in libopenssl_sys-9f3b06cb5b388503.rlib(ui_openssl.o) 
       _read_string_inner in libopenssl_sys-9f3b06cb5b388503.rlib(ui_openssl.o) 
       _test_rc4_init_key in libopenssl_sys-9f3b06cb5b388503.rlib(eng_openssl.o) 
      ld: symbol(s) not found for architecture i386 
      clang: error: linker command failed with exit code 1 (use -v to see invocation) 

demo project to reproduce the error

Répondre

1

Il y a 2 problèmes. pas trouvé pour l'architecture i386 Après le remplacement OpenSSL lib statique https://github.com/chshawkn/openssl-build-https://github.com/x2on/OpenSSL-for-iPhone, cible i386-pomme-ios construit avec succès

  1. symbole

    (s).

  2. le (/Users/user/project/target/i386-apple-ios/debug/deps/libopenssl_sys-9f3b06cb5b388503.rlib(wp-mmx.o)) construit pour OSX. Mettez un script sur ~/.cargo/bin/cc pour résoudre ce problème.

#!/usr/bin/env bash 
if [ -n "$(echo [email protected] | grep i386-apple-ios)" ] || [ -n "$(echo [email protected] | grep 
x86_64-apple-ios)" ]; then 
    xcrun --sdk iphonesimulator --show-sdk-path 
    exec xcrun --sdk iphonesimulator cc -mios-simulator-version-min=7.0.0 $* 
elif [ -n "$(echo [email protected] | grep apple-ios)" ]; then 
    xcrun --sdk iphoneos --show-sdk-path 
    exec xcrun --sdk iphoneos cc -mios-version-min=7.0.0 $* 
else 
    exec /usr/bin/cc $* 
fi