Skip to content

Current master does not build on MacOS #165

@mouse07410

Description

@mouse07410

Config:
MacOS Sequoia 15.7.2, Xcode-26.1. Current master.


Problem: dependency safe-oqs-sys seems unable to locate system/SDK header files.

$ export C_INCLUDE_PATH=/opt/local/include:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk:/usr/local/include:.
$ export C_INCLUDE_DIR=/opt/local/include:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk:/usr/local/include:.
$ cargo build && cargo build --release && cargo test --release
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.20s
    Finished `release` profile [optimized] target(s) in 0.16s
   Compiling safe-oqs-sys v0.10.0+liboqs-0.10.1
error: failed to run custom build command for `safe-oqs-sys v0.10.0+liboqs-0.10.1`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/Users/ur20980/src/KEMs/target/release/build/safe-oqs-sys-97b4142a9a4e1ded/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBOQS_NO_VENDOR
  cargo:rerun-if-env-changed=LIBOQS_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_apple_darwin
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBOQS_STATIC
  cargo:rerun-if-env-changed=LIBOQS_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_apple_darwin
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_apple_darwin
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_apple_darwin
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  CMAKE_TOOLCHAIN_FILE_x86_64-apple-darwin = None
  CMAKE_TOOLCHAIN_FILE_x86_64_apple_darwin = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-apple-darwin = None
  CMAKE_GENERATOR_x86_64_apple_darwin = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-apple-darwin = None
  CMAKE_PREFIX_PATH_x86_64_apple_darwin = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-apple-darwin = None
  CMAKE_x86_64_apple_darwin = None
  HOST_CMAKE = None
  CMAKE = None
  running: cd "/Users/ur20980/src/KEMs/target/release/build/safe-oqs-sys-14b630aac4e6c5a1/out/build" && CMAKE_PREFIX_PATH="" LC_ALL="C" "cmake" "/Users/ur20980/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/safe-oqs-sys-0.10.0+liboqs-0.10.1/liboqs" "-DCMAKE_OSX_ARCHITECTURES=x86_64" "-DOQS_BUILD_ONLY_LIB=Yes" "-DOQS_DIST_BUILD=Yes" "-DOQS_ENABLE_KEM_BIKE=No" "-DOQS_ENABLE_KEM_CLASSIC_MCELIECE=No" "-DOQS_ENABLE_KEM_FRODOKEM=Yes" "-DOQS_ENABLE_KEM_HQC=No" "-DOQS_ENABLE_KEM_KYBER=No" "-DOQS_ENABLE_KEM_NTRUPRIME=No" "-DOQS_ENABLE_KEM_ML_KEM=No" "-DOQS_ENABLE_SIG_DILITHIUM=No" "-DOQS_ENABLE_SIG_FALCON=No" "-DOQS_ENABLE_SIG_SPHINCS=No" "-DOQS_ENABLE_SIG_ML_DSA=No" "-DOQS_USE_OPENSSL=No" "-DCMAKE_INSTALL_PREFIX=/Users/ur20980/src/KEMs/target/release/build/safe-oqs-sys-14b630aac4e6c5a1/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 --target=x86_64-apple-macosx -mmacosx-version-min=26.1 -std=gnu18 -march=native -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" "-DCMAKE_C_COMPILER=/opt/local/bin/clang" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 --target=x86_64-apple-macosx -mmacosx-version-min=26.1 -std=gnu++20 -march=native -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" "-DCMAKE_CXX_COMPILER=/opt/local/bin/clang++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 --target=x86_64-apple-macosx -mmacosx-version-min=26.1 -std=gnu18 -march=native -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" "-DCMAKE_ASM_COMPILER=/opt/local/bin/clang" "-DCMAKE_BUILD_TYPE=Release"
  -- Alg enablement unchanged
  -- Configuring done (0.6s)
  -- Generating done (0.1s)
  -- Build files have been written to: /Users/ur20980/src/KEMs/target/release/build/safe-oqs-sys-14b630aac4e6c5a1/out/build
  running: cd "/Users/ur20980/src/KEMs/target/release/build/safe-oqs-sys-14b630aac4e6c5a1/out/build" && LC_ALL="C" "cmake" "--build" "/Users/ur20980/src/KEMs/target/release/build/safe-oqs-sys-14b630aac4e6c5a1/out/build" "--target" "oqs" "--config" "Release" "--parallel" "4"
  [  2%] Building C object src/kem/frodokem/CMakeFiles/frodokem_avx2.dir/external/frodo640aes_avx2.c.o
  [  5%] Built target xkcp_low_keccakp_1600_plain64
  [  8%] Built target xkcp_low_keccakp_1600times4_serial
  [ 10%] Building C object src/common/CMakeFiles/common.dir/aes/aes.c.o
  [ 13%] Building C object src/kem/frodokem/CMakeFiles/frodokem_avx2.dir/external/frodo976aes_avx2.c.o
  [ 16%] Building C object src/kem/frodokem/CMakeFiles/frodokem_avx2.dir/external/frodo1344aes_avx2.c.o
  [ 18%] Building C object src/common/CMakeFiles/common.dir/aes/aes_c.c.o
  [ 21%] Building C object src/kem/frodokem/CMakeFiles/frodokem_avx2.dir/external/frodo640shake_avx2.c.o
  [ 24%] Building C object src/common/CMakeFiles/common.dir/aes/aes128_ni.c.o
  [ 27%] Building C object src/common/CMakeFiles/common.dir/aes/aes256_ni.c.o
  [ 32%] Built target xkcp_low_keccakp_1600_avx2
  [ 32%] Building C object src/kem/frodokem/CMakeFiles/frodokem_avx2.dir/external/frodo976shake_avx2.c.o
  [ 35%] Building C object src/common/CMakeFiles/common.dir/sha2/sha2.c.o
  [ 37%] Building C object src/kem/frodokem/CMakeFiles/frodokem_avx2.dir/external/frodo1344shake_avx2.c.o
  [ 40%] Built target xkcp_low_keccakp_1600times4_avx2
  [ 43%] Building C object src/common/CMakeFiles/common.dir/sha2/sha2_c.c.o
  [ 45%] Building C object src/common/CMakeFiles/common.dir/sha3/xkcp_sha3.c.o
  [ 48%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/kem_frodokem640aes.c.o
  [ 48%] Built target frodokem_avx2
  [ 51%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/external/frodo640aes.c.o
  [ 54%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/kem_frodokem640shake.c.o
  [ 56%] Building C object src/common/CMakeFiles/common.dir/sha3/xkcp_sha3x4.c.o
  [ 59%] Building C object src/common/CMakeFiles/common.dir/common.c.o
  [ 62%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/external/frodo640shake.c.o
  [ 64%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/kem_frodokem976aes.c.o
  [ 67%] Building C object src/common/CMakeFiles/common.dir/pqclean_shims/fips202.c.o
  [ 70%] Building C object src/common/CMakeFiles/common.dir/pqclean_shims/fips202x4.c.o
  [ 72%] Building C object src/common/CMakeFiles/common.dir/rand/rand.c.o
  [ 75%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/external/frodo976aes.c.o
  [ 78%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/kem_frodokem976shake.c.o
  [ 81%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/external/frodo976shake.c.o
  [ 81%] Built target common
  [ 83%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/kem_frodokem1344aes.c.o
  [ 86%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/external/frodo1344aes.c.o
  [ 89%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/kem_frodokem1344shake.c.o
  [ 91%] Building C object src/kem/frodokem/CMakeFiles/frodokem.dir/external/frodo1344shake.c.o
  [ 91%] Built target frodokem
  [ 94%] Building C object src/CMakeFiles/oqs.dir/kem/kem.c.o
  [ 97%] Building C object src/CMakeFiles/oqs.dir/sig/sig.c.o
  [100%] Linking C static library ../lib/liboqs.a
  [100%] Built target oqs
  cargo:root=/Users/ur20980/src/KEMs/target/release/build/safe-oqs-sys-14b630aac4e6c5a1/out
  cargo:rustc-link-lib=static=oqs
  cargo:rustc-link-search=native=/Users/ur20980/src/KEMs/target/release/build/safe-oqs-sys-14b630aac4e6c5a1/out/build/lib

  --- stderr
  /Users/ur20980/src/KEMs/target/release/build/safe-oqs-sys-14b630aac4e6c5a1/out/build/include/oqs/common.h:14:10: fatal error: 'stdlib.h' file not found

  thread 'main' (5841282) panicked at /Users/ur20980/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/safe-oqs-sys-0.10.0+liboqs-0.10.1/build.rs:33:10:
  Unable to generate bindings: ClangDiagnostic("/Users/ur20980/src/KEMs/target/release/build/safe-oqs-sys-14b630aac4e6c5a1/out/build/include/oqs/common.h:14:10: fatal error: 'stdlib.h' file not found\n")
  stack backtrace:
     0: __rustc::rust_begin_unwind
     1: core::panicking::panic_fmt
     2: core::result::unwrap_failed
     3: core::result::Result<T,E>::expect
     4: build_script_build::generate_bindings
     5: build_script_build::main::{{closure}}
     6: build_script_build::main
     7: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
$
$
$ ll /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h
-rw-r--r--  1 root  wheel  2980 Oct 11 01:38 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h
$

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions