Open DaveLomber opened 5 months ago
What Clang version do you have? I have the same issue in my case (running demo also fails for host target). I suspect it's related to the build tools version, since I upgrade to macOS sequoia recently. My error:
process didn't exit successfully: `/Users/indirection42/projects/web3/XCQ/target/debug/build/cxx-ad5153b859977d0b/build-script-build` (exit status: 1)
--- stdout
TARGET = Some("aarch64-apple-darwin")
OPT_LEVEL = Some("0")
HOST = Some("aarch64-apple-darwin")
cargo:rerun-if-env-changed=CXX_aarch64-apple-darwin
CXX_aarch64-apple-darwin = None
cargo:rerun-if-env-changed=CXX_aarch64_apple_darwin
CXX_aarch64_apple_darwin = None
cargo:rerun-if-env-changed=HOST_CXX
HOST_CXX = None
cargo:rerun-if-env-changed=CXX
CXX = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
cargo:rerun-if-env-changed=CXXFLAGS_aarch64-apple-darwin
CXXFLAGS_aarch64-apple-darwin = None
cargo:rerun-if-env-changed=CXXFLAGS_aarch64_apple_darwin
CXXFLAGS_aarch64_apple_darwin = None
cargo:rerun-if-env-changed=HOST_CXXFLAGS
HOST_CXXFLAGS = None
cargo:rerun-if-env-changed=CXXFLAGS
CXXFLAGS = None
cargo:warning=In file included from /Users/indirection42/.cargo/registry/src/rsproxy.cn-0dccff568467c15b/cxx-1.0.123/src/cxx.cc:1:
cargo:warning=/Users/indirection42/.cargo/registry/src/rsproxy.cn-0dccff568467c15b/cxx-1.0.123/src/../include/cxx.h:2:10: fatal error: 'algorithm' file not found
cargo:warning= 2 | #include <algorithm>
cargo:warning= | ^~~~~~~~~~~
cargo:warning=1 error generated.
--- stderr
error occurred: Command env -u IPHONEOS_DEPLOYMENT_TARGET "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=arm64-apple-darwin" "-mmacosx-version-min=15.0" "-std=c++11" "-Wall" "-Wextra" "-o" "/Users/indirection42/projects/web3/XCQ/target/debug/build/cxx-7a469828725bb041/out/97d06b5a3c8389c7-cxx.o" "-c" "/Users/indirection42/.cargo/registry/src/rsproxy.cn-0dccff568467c15b/cxx-1.0.123/src/cxx.cc" with args c++ did not execute successfully (status code exit status: 1).
I checked the header locates at /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm
I have solved the problem by using the following workaround:
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/* /Library/Developer/CommandLineTools/usr/include/c++/v1
.
However, I'm not sure how the normal /Library/Developer/CommandLineTools/usr/include/c++/v1
dir looks like.
I have the following
% clang --version
Homebrew clang version 18.1.7
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
I'm on macOS Sonoma 14.5
clang -v -E -x c++ - < /dev/null
give me the following:
Apple clang version 16.0.0 (clang-1600.0.21.4)
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
... OMIT SOME LINES...
clang -cc1 version 16.0.0 (clang-1600.0.21.4) default target arm64-apple-darwin24.0.0
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1
/Library/Developer/CommandLineTools/usr/lib/clang/16/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 439 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
which indicates the cpp header file search files. And I think /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
should be /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
clang -v -E -x c++ - < /dev/null
gives me the following:
Homebrew clang version 18.1.7
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
(in-process)
"/opt/homebrew/Cellar/llvm/18.1.7/bin/clang-18" -cc1 -triple arm64-apple-macosx14.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -funwind-tables=1 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -fbuiltin-headers-in-system-modules -fdefine-target-os-macros -target-cpu apple-m1 -target-feature +zcm -target-feature +zcz -target-feature +v8.5a -target-feature +aes -target-feature +crc -target-feature +dotprod -target-feature +complxnum -target-feature +fp-armv8 -target-feature +fullfp16 -target-feature +fp16fml -target-feature +jsconv -target-feature +lse -target-feature +pauth -target-feature +ras -target-feature +rcpc -target-feature +rdm -target-feature +sha2 -target-feature +sha3 -target-feature +neon -target-abi darwinpcs -debugger-tuning=lldb -fdebug-compilation-dir=/Users/devio/workspace/hg/hg-force-api -target-linker-version 1053.12 -v -fcoverage-compilation-dir=/Users/devio/workspace/hg/hg-force-api -resource-dir /opt/homebrew/Cellar/llvm/18.1.7/lib/clang/18 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -c-isystem /Users/devio/.wasmedge/include -cxx-isystem /Users/devio/.wasmedge/include -internal-isystem /opt/homebrew/opt/llvm/bin/../include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/local/include -internal-isystem /opt/homebrew/Cellar/llvm/18.1.7/lib/clang/18/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include -fdeprecated-macro -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcolor-diagnostics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o - -x c++ -
clang -cc1 version 18.1.7 based upon LLVM 18.1.7 default target arm64-apple-darwin23.5.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/Users/devio/.wasmedge/include
/opt/homebrew/opt/llvm/bin/../include/c++/v1
/opt/homebrew/Cellar/llvm/18.1.7/lib/clang/18/include
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks (framework directory)
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 508 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
I ran into this today too on linux. exact same problem with missing algorithm header
I have solved the problem by using the following workaround:
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/* /Library/Developer/CommandLineTools/usr/include/c++/v1
. However, I'm not sure how the normal/Library/Developer/CommandLineTools/usr/include/c++/v1
dir looks like.
this worked for me too, I guess its an issue with the new Mac OS sequoia update
I have solved the problem by using the following workaround:
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/* /Library/Developer/CommandLineTools/usr/include/c++/v1
. However, I'm not sure how the normal/Library/Developer/CommandLineTools/usr/include/c++/v1
dir looks like.
this worked for me too👍
I'm trying to compile the demo https://github.com/dtolnay/cxx/tree/master/demo for wasm under macOS
The command is the following:
But getting an error:
What could be wrong?