jedisct1 / libsodium-sys-stable

Sodiumoxide's libsodium-sys crate, but that installs stable versions of libsodium.
MIT License
35 stars 6 forks source link

"Unknown iOS build target: aarch64-apple-ios-sim" while targeting an iOS simulator #12

Closed guillemcordoba closed 1 year ago

guillemcordoba commented 1 year ago

While trying to target an iOS simulator, this error occurs:

error: failed to run custom build command for `libsodium-sys-stable v1.19.32`

Caused by:
  process didn't exit successfully: `/Users/guillemcordoba/rostanga-test/target/debug/build/libsodium-sys-stable-b2ea56e77b9d6ec0/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=SODIUM_LIB_DIR
  cargo:rerun-if-env-changed=SODIUM_SHARED
  cargo:rerun-if-env-changed=SODIUM_USE_PKG_CONFIG
  cargo:rerun-if-env-changed=SODIUM_DISABLE_PIE
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-ios-sim")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_aarch64-apple-ios-sim
  CC_aarch64-apple-ios-sim = None
  cargo:rerun-if-env-changed=CC_aarch64_apple_ios_sim
  CC_aarch64_apple_ios_sim = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  Detecting iOS SDK path for iphonesimulator
  cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-ios-sim
  CFLAGS_aarch64-apple-ios-sim = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_ios_sim
  CFLAGS_aarch64_apple_ios_sim = Some("-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk")

  --- stderr
  thread 'main' panicked at 'Unknown iOS build target: aarch64-apple-ios-sim', /Users/guillemcordoba/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libsodium-sys-stable-1.19.32/build.rs:260:18
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
     1: core::panicking::panic_fmt
               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
     2: build_script_build::make_libsodium
               at ./build.rs:260:18
     3: build_script_build::build_libsodium
               at ./build.rs:520:19
     4: build_script_build::main
               at ./build.rs:67:9
     5: core::ops::function::FnOnce::call_once
               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:250:5
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...
       Error [tauri_cli_node] Failed to run `cargo build`: command ["cargo", "build", "--package", "rostangatest", "--manifest-path", "/Users/guillemcordoba/rostanga-test/src-tauri/Cargo.toml", "--target", "aarch64-apple-ios-sim", "--features", "tauri/rustls-tls", "--lib", "--no-default-features"] exited with code 101
Command PhaseScriptExecution failed with a nonzero exit code

note: Run script build phase 'Build Rust Code' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'rostangatest_iOS' from project 'rostangatest')
** BUILD FAILED **

The following build commands failed:
    PhaseScriptExecution Build\ Rust\ Code /Users/guillemcordoba/Library/Developer/Xcode/DerivedData/rostangatest-bovehlqdustugiesclixeelluihr/Build/Intermediates.noindex/rostangatest.build/debug-iphonesimulator/rostangatest_iOS.build/Script-0D7C97BCCD76470A8D0AABED.sh (in target 'rostangatest_iOS' from project 'rostangatest')
(1 failure)
       Error command ["xcodebuild"] exited with code 65

Should support for this target be added in this crate? Should I be trying to change the architecture of the iOS simulator so that libsodium compiles?

jedisct1 commented 1 year ago

libsodium itself supports all Apple targets, including VisionOS.

So yes, it's mostly about adding support to the Rust build file.

jedisct1 commented 1 year ago

71a46bfcf2c2fdc41d0acb724c0e824695452bbd should do it.