tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.8k stars 318 forks source link

Support for xcrun --show-sdk-platform-version #419

Open emabee opened 3 months ago

emabee commented 3 months ago

xcrun has a new option --show-sdk-platform-version which is currently not supported by the respective wrapper in osxcross.

Ring, which is a foundational cryptographic library in rust, uses this option in its build script. Due to that, cross-builds for projects that use ring, e.g. via the support for TLS, fail.

Is it possible to add support for this option? The effort should be moderate, but the impact would be really significant.

Thanks a lot in advance!

  cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_8_
  OPT_LEVEL = Some("3")
  TARGET = Some("x86_64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-apple-darwin
  CC_x86_64-apple-darwin = None
  cargo:rerun-if-env-changed=CC_x86_64_apple_darwin
  CC_x86_64_apple_darwin = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = Some("clang")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  cargo:warning=running: "xcrun" "--show-sdk-platform-version" "--sdk" "macosx"
  cargo:warning=osxcross: error: xcrun: unknown argument: '--show-sdk-platform-version'
  cargo:warning=exit status: 2
Timwun commented 3 months ago

I have the exact same issue @tpoechtrager

tpoechtrager commented 3 months ago
diff --git a/wrapper/programs/xcrun.cpp b/wrapper/programs/xcrun.cpp
index df20157..ad462e1 100644
--- a/wrapper/programs/xcrun.cpp
+++ b/wrapper/programs/xcrun.cpp
@@ -247,6 +247,7 @@ int xcrun(int argc, char **argv, Target &target) {
     {"run", run, 1},
     {"show-sdk-path", showSDKPath},
     {"show-sdk-version", showSDKVersion},
+    {"show-sdk-platform-version", showSDKVersion},
     {"show-sdk-platform-path", showPlatformPath}
   }};

Does that fix the issue?

Timwun commented 3 months ago

Yes, this should fix the issue IMO. :)

emabee commented 3 months ago

For now definitely, as both commands do return the same value currently. It's unclear when (in future?) different values would be expected. For now the fix seems the best we can get. Thanks!