Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check if rust toolchain 1.65 works #1771

Closed
cyBerta opened this issue Dec 13, 2022 · 12 comments
Closed

check if rust toolchain 1.65 works #1771

cyBerta opened this issue Dec 13, 2022 · 12 comments
Labels
build build and release related issues

Comments

@cyBerta
Copy link
Contributor

cyBerta commented Dec 13, 2022

Appearantly we have a linker issue after updating to core 1.103+

RUSTFLAGS="-C lto=on -C embed-bitcode=yes" cargo +`cat ../deltachat-ios/libraries/deltachat-core-rust/rust-toolchain` lipo --verbose --release --manifest-path ../deltachat-ios/libraries/deltachat-core-rust/deltachat-ffi/Cargo.toml
[DEBUG cargo_lipo::meta] Considering package(s) ["deltachat_ffi", "deltachat", "deltachat_derive", "deltachat-jsonrpc", "deltachat-rpc-server"], `staticlib` target not required
[DEBUG cargo_lipo::meta] Ignoring "deltachat" because it does not have a `staticlib` target
[DEBUG cargo_lipo::meta] Ignoring "deltachat_derive" because it does not have a `staticlib` target
[DEBUG cargo_lipo::meta] Ignoring "deltachat-jsonrpc" because it does not have a `staticlib` target
[DEBUG cargo_lipo::meta] Ignoring "deltachat-rpc-server" because it does not have a `staticlib` target
[INFO  cargo_lipo::meta] Will build universal library for ["deltachat_ffi"]
[INFO  cargo_lipo::lipo] Building "deltachat_ffi" for "aarch64-apple-ios"
[DEBUG cargo_lipo::exec] Running: "/Users/cyberta/.rustup/toolchains/1.65.0-x86_64-apple-darwin/bin/cargo" "--color" "auto" "build" "--manifest-path" "../deltachat-ios/libraries/deltachat-core-rust/deltachat-ffi/Cargo.toml" "-p" "deltachat_ffi" "--target" "aarch64-apple-ios" "--release" "--lib"
    Finished release [optimized] target(s) in 4.14s
[INFO  cargo_lipo::lipo] Building "deltachat_ffi" for "x86_64-apple-ios"
[DEBUG cargo_lipo::exec] Running: "/Users/cyberta/.rustup/toolchains/1.65.0-x86_64-apple-darwin/bin/cargo" "--color" "auto" "build" "--manifest-path" "../deltachat-ios/libraries/deltachat-core-rust/deltachat-ffi/Cargo.toml" "-p" "deltachat_ffi" "--target" "x86_64-apple-ios" "--release" "--lib"
   Compiling deltachat_ffi v1.103.0 (/Users/cyberta/workspace/deltachat-ios/deltachat-ios/libraries/deltachat-core-rust/deltachat-ffi)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-Wl,-exported_symbols_list,/var/folders/11/llkc5bss1bsfb05hp598vv_m0000gn/T/rustcVIrCQD/list" "-arch" "x86_64" "/var/folders/11/llkc5bss1bsfb05hp598vv_m0000gn/T/rustcVIrCQD/symbols.o" "/Users/cyberta/workspace/deltachat-ios/deltachat-ios/libraries/deltachat-core-rust/target/x86_64-apple-ios/release/deps/deltachat.deltachat.0d09975e-cgu.5.rcgu.o" "-L" "/Users/cyberta/workspace/deltachat-ios/deltachat-ios/libraries/deltachat-core-rust/target/x86_64-apple-ios/release/deps" "-L" "/Users/cyberta/workspace/deltachat-ios/deltachat-ios/libraries/deltachat-core-rust/target/release/deps" "-L" "/Users/cyberta/workspace/deltachat-ios/deltachat-ios/libraries/deltachat-core-rust/target/x86_64-apple-ios/release/build/libsqlite3-sys-cb22938768625778/out" "-L" "/Users/cyberta/workspace/deltachat-ios/deltachat-ios/libraries/deltachat-core-rust/target/x86_64-apple-ios/release/build/openssl-sys-454783dd028ce432/out/openssl-build/install/lib" "-L" "/Users/cyberta/.rustup/toolchains/1.65.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-ios/lib" "/var/folders/11/llkc5bss1bsfb05hp598vv_m0000gn/T/rustcVIrCQD/liblibsqlite3_sys-4a175e16660864ac.rlib" "/var/folders/11/llkc5bss1bsfb05hp598vv_m0000gn/T/rustcVIrCQD/libopenssl_sys-a3b1f9a7f0820b88.rlib" "/Users/cyberta/.rustup/toolchains/1.65.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-ios/lib/libcompiler_builtins-52879c688433d04a.rlib" "-framework" "Security" "-framework" "CoreFoundation" "-framework" "Security" "-liconv" "-lSystem" "-lobjc" "-framework" "Security" "-framework" "Foundation" "-lresolv" "-lc" "-lm" "-liconv" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk" "-Wl,-syslibroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk" "-L" "/Users/cyberta/.rustup/toolchains/1.65.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-ios/lib" "-o" "/Users/cyberta/workspace/deltachat-ios/deltachat-ios/libraries/deltachat-core-rust/target/x86_64-apple-ios/release/deps/libdeltachat.dylib" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs"
  = note: ld: building for iOS Simulator, but linking in .tbd built for macOS/Mac Catalyst, file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libiconv.tbd' for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: could not compile `deltachat_ffi` due to previous error
[ERROR cargo_lipo] Failed to build "deltachat_ffi" for "x86_64-apple-ios": Executing "/Users/cyberta/.rustup/toolchains/1.65.0-x86_64-apple-darwin/bin/cargo" "--color" "auto" "build" "--manifest-path" "../deltachat-ios/libraries/deltachat-core-rust/deltachat-ffi/Cargo.toml" "-p" "deltachat_ffi" "--target" "x86_64-apple-ios" "--release" "--lib" finished with error status: exit status: 101

@r10s
Copy link
Member

r10s commented Dec 15, 2022

some more information about what was recently tried:

  • fix m1 simulator #1766 is unrelated, reverting that commit does not help
  • on m1, it is possible to build from the command-line, using cd DcCore and then RUSTFLAGS="-C lto=on -C embed-bitcode=yes" cargo +cat ../deltachat-ios/libraries/deltachat-core-rust/rust-toolchain lipo --release --manifest-path ../deltachat-ios/libraries/deltachat-core-rust/deltachat-ffi/Cargo.toml (last line of the script that builds core) - once this succeeds, you can also hit "Run" in Xcode
  • for non-m1, this trick does not help
  • core 1.101 builds also with fix m1 simulator #1766 and current ios-master

@cyBerta
Copy link
Contributor Author

cyBerta commented Dec 16, 2022

ld: building for iOS Simulator, but linking in .tbd built for macOS/Mac Catalyst is the relevant error line, so far I haven't found a fix.

@r10s
Copy link
Member

r10s commented Dec 16, 2022

.tbd is some cache file? did you tried to clean all caches? so at least ./scripts/clean-core.sh and then in Xcode "Product / Clean Build Folder".

this is what i am doing always reflexively, and somehow i could build+run on my machine, see above, m1, however.

i am not too optimistic that this helps as on the pc of @rosano we run into the same issue - and that had no older builds. but we should make sure there are no cached filels, still :)

@Hocuri
Copy link

Hocuri commented Dec 18, 2022

Is this fixed by reverting deltachat/deltachat-core-rust#3809?

@r10s
Copy link
Member

r10s commented Dec 18, 2022

@cyBerta can you try that out? on my machine it works partly ...

@r10s
Copy link
Member

r10s commented Dec 20, 2022

closed by ce615d8

@dignifiedquire
Copy link
Member

Any hints on what the actual issue here is? Is this the only thing stopping core from upgrading to 1.65?

@r10s
Copy link
Member

r10s commented Mar 6, 2023

Any hints on what the actual issue here is? Is this the only thing stopping core from upgrading to 1.65?

i don't know, we did not investigate further.

core up to 110, however, compile (did not test core111+ yet) - as well as the recent iroh pr deltachat/deltachat-core-rust#4007

are rust65 features needed? iirc, we meanwhile can have different toolchains on the platforms (works, of course, as long as there are no breaking changes in the code)

@tarcieri
Copy link

tarcieri commented Mar 6, 2023

@r10s the latest release of the der crate, a transitive (and currently hard) dependency of the rsa crate, now uses GATs and has an MSRV of 1.65

@r10s r10s added the build build and release related issues label Mar 7, 2023
@r10s r10s changed the title Build fails on master check if rust toolchain 1.65 works Mar 7, 2023
@r10s r10s reopened this Mar 7, 2023
@link2xt
Copy link
Contributor

link2xt commented Mar 18, 2023

We will need an update to 1.65 due to rpgp/rpgp#218

@Simon-Laux
Copy link
Member

Simon-Laux commented May 2, 2023

For me it's linker errors:
Bildschirmfoto 2023-05-02 um 12 45 40

the trick of building from a normal command line worked, so I assume its about some environment variables that Xcode sets.

Update: after some investigation it looks like the problem is that Xcode sets the path variable:

export PATH\=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/appleinternal/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/appleinternal/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

so different versions of cc and ld are used, this would also explain why it works on arm/m1 and not on intel cpus.

# Before (outside of Xcode):
# which cc
/usr/bin/cc
# which ld
/usr/bin/ld

# After (inside of Xcode):
# which cc
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
# which ld
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld

@r10s
Copy link
Member

r10s commented May 7, 2023

closed by #1867

@r10s r10s closed this as completed May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build and release related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants