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

hundreds of warnings when linking core main branch #2104

Closed
r10s opened this issue Mar 5, 2024 · 11 comments · Fixed by #2143
Closed

hundreds of warnings when linking core main branch #2104

r10s opened this issue Mar 5, 2024 · 11 comments · Fixed by #2143
Labels
bug build build and release related issues

Comments

@r10s
Copy link
Member

r10s commented Mar 5, 2024

comping/linking core 1.136.1 results in lots of warnings as

ld: warning: object file (/Users/bpetersen/projects/deltachat-ios/deltachat-ios/libraries/libdeltachat.a[arm64][21](ba1daabeec5f0744-armv8-mont-ios64.o)) was built for newer 'iOS' version (17.2) than being linked (12.0)

full log: https://gist.github.com/r10s/5beceb77824ce72566883a0fadc198ce
rust-toolchain: 1.73.0 (unchanged)
build-environment: macOS Sonoma 14.3.1

just ftr for now, i did not try to make sense of it.

apart from the updated submodule nothing has changed. i also double checked to build core 1.135 in the same environment - no error or warning

maybe some xcode option need to be tweaked, but interesting that it does not happen for 1.135

maybe somehow releated: deltachat/deltachat-android#2972

@r10s r10s added the bug label Mar 5, 2024
@r10s r10s changed the title hundreds of warnings when compiling core 1.136.1 hundreds of warnings when linking core 1.136.1 Mar 5, 2024
@r10s r10s added the build build and release related issues label Mar 6, 2024
@r10s
Copy link
Member Author

r10s commented Mar 6, 2024

this issue is fixed somehow by 1.136.2, together with deltachat/deltachat-android#2972 :)

@r10s r10s closed this as completed Mar 6, 2024
@r10s r10s changed the title hundreds of warnings when linking core 1.136.1 hundreds of warnings when linking core main branch Apr 3, 2024
@r10s r10s reopened this Apr 3, 2024
@r10s
Copy link
Member Author

r10s commented Apr 3, 2024

the warnings are back again on ~current core master - while using deltachat/deltachat-core-rust#5387 was fine - sth. has changed in between, i cannot make sense of that @link2xt these are warnings only - but do you have any clue what could cause that? so it is easier to get rid of them :)

EDIT: i just updated macos to "Sonoma 14.4.1" and Xcode to 15.3 - still the same warnings.

will try if rust 1.77 changes anything. EDIT: no change

in my understanding,, by some core changes, things are suddenly build for 17.2 instead of 12.0 - and that could also be reverted - the issue was there for 1.136.1 and disappeared with 1.136.2

and https://stackoverflow.com/questions/50703177/cannot-compile-rust-code-on-macos-10-12-object-file-was-built-for-newer-osx-ver (via search "rust lipo Object file was built for newer version than being linked") points to some possible environment vars - EDIT: tried adding "export IPHONEOS_DEPLOYMENT_TARGET=8.0" atop of "Build Phases / Run Script" - no change

💫 maybe i wait just for another core update that let the warnings magically disappear as from 1.136.1 to 1.136.2 🪄🎩

@link2xt
Copy link
Contributor

link2xt commented Apr 4, 2024

Between 1.136.1 and 1.136.2 we downgraded cc crate to 1.0.83.
Now because of backtrace crate update we had to upgrade cc again, have to downgrade cc and backtrace then to get back to cc = 1.0.83.

@link2xt
Copy link
Contributor

link2xt commented Apr 4, 2024

Breaking change is probably this one: rust-lang/cc-rs#848
But it should still support IPHONEOS_DEPLOYMENT_TARGET.
This should really be fixed by setting IPHONEOS_DEPLOYMENT_TARGET. Don't know why it does not work with export, maybe environment variables are not passed through and should be configured in project.pbxproj as suggested in cargo-lipo readme.

@r10s
Copy link
Member Author

r10s commented Apr 4, 2024

thanks a lot for the info, this js very helpful!

i will have a closer look at the environment vars then

@link2xt
Copy link
Contributor

link2xt commented Apr 4, 2024

Just grepping over deltachat-ios repo shows many instances of IPHONEOS_DEPLOYMENT_TARGET = 12.0 in project.pbxproj file. Does it help if they are replaced?

@link2xt
Copy link
Contributor

link2xt commented Apr 4, 2024

I did a PR #2139 with a quick sed

@r10s
Copy link
Member Author

r10s commented Apr 4, 2024

tried adding "export IPHONEOS_DEPLOYMENT_TARGET=8.0" atop of "Build Phases / Run Script" - no change

sorry, the "8.0" was a copy+paste error, i meant "export IPHONEOS_DEPLOYMENT_TARGET=12.0"

still, good to see in #2139 that things are 12.0 everywhere - @zeitschlag set that to 12.0 at #2034 to fix other issues. it seems Xcode is really picky to have deployment target the same everywhere, i will keep investigating (and still try your PR, who knows :)

@link2xt
Copy link
Contributor

link2xt commented Apr 4, 2024

I am trying to run the build core commit d39c8a3a19c29c31af5db208524ab1a749b309b6 on macOS with just cargo lipo.
Running:

unset MACOSX_DEPLOYMENT_TARGET
export IPHONEOS_DEPLOYMENT_TARGET=12.0
export CC_ENABLE_DEBUG_OUTPUT=1

It fails with this output:

  cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
  cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_8_
  OPT_LEVEL = Some("z")
  TARGET = Some("aarch64-apple-ios")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_aarch64-apple-ios
  CC_aarch64-apple-ios = None
  cargo:rerun-if-env-changed=CC_aarch64_apple_ios
  CC_aarch64_apple_ios = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("clang")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  running: "xcrun" "--show-sdk-platform-version" "--sdk" "iphoneos"
  exit status: 0
  Detecting iOS SDK path for iphoneos
  running: "xcrun" "--show-sdk-path" "--sdk" "iphoneos"
  exit status: 0
  cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-ios
  CFLAGS_aarch64-apple-ios = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_ios
  CFLAGS_aarch64_apple_ios = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "clang" "-Oz" "-fPIC" "--target=aarch64-apple-ios" "-arch" "arm64" "-miphoneos-version-min=17.4" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.4.sdk" "-I" "include" "-I" "/Users/bb/src/deltachat-ios/deltachat-ios/libraries/deltachat-core-rust/target/aarch64-apple-ios/debug/build/ring-8642e92c096d9736/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-DNDEBUG" "-o" "/Users/bb/src/deltachat-ios/deltachat-ios/libraries/deltachat-core-rust/target/aarch64-apple-ios/debug/build/ring-8642e92c096d9736/out/fad98b632b8ce3cc-curve25519.o" "-c" "crypto/curve25519/curve25519.c"
  cargo:warning=clang-16: error: invalid argument '-mmacos-version-min=11.0' not allowed with '-miphoneos-version-min=17.4'
  cargo:warning=clang-16: warning: overriding '-mmacos-version-min=11.0' option with '--target=aarch64-apple-ios' [-Woverriding-t-option]
  exit status: 1

This is probably due to running in a Nix shell, will try to run without it as it wraps CC probably.

@link2xt
Copy link
Contributor

link2xt commented Apr 4, 2024

@r10s export CC_ENABLE_DEBUG_OUTPUT=1 might help with debugging. It is described in https://docs.rs/cc/latest/cc/

@link2xt
Copy link
Contributor

link2xt commented Apr 4, 2024

This looks like a problem is cargo-lipo, it explicitly removes IPHONEOS_DEPLOYMENT_TARGET from the environment:
https://github.com/TimNN/cargo-lipo/blob/d91325e62b78247c3d9b66b02c243eed63e58bdf/src/xcode.rs#L69-L75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug build build and release related issues
Projects
None yet
2 participants