From 43fc00326154c7f7da907e1e38a0f51accbd31b4 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 11 Jan 2023 13:22:12 +0900 Subject: [PATCH] Specify CMAKE_OSX_DEPLOYMENT_TARGET when building llvm The version 11.0 is chosen because Apple seems providing support for two previous releases. (As of writing this, the latest is 13.) REVISIT: as we don't need any brand-new OS features, it might make more sense to specify even older version. This might explain the following error i've seen with wasi-sdk-17.0 release binary on macos-11.0: ``` Run Build Command(s):/usr/bin/make -f Makefile cmTC_254ef/fast && /Applications/Xcode_13.2.1.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_254ef.dir/build.make CMakeFiles/cmTC_254ef.dir/build Building C object CMakeFiles/cmTC_254ef.dir/testCCompiler.c.obj /Users/runner/work/toywasm/toywasm/.wasi-sdk-17.0/bin/clang -o CMakeFiles/cmTC_254ef.dir/testCCompiler.c.obj -c /Users/runner/work/toywasm/toywasm/build.wasm/CMakeFiles/CMakeScratch/TryCompile-aWXHXM/testCCompiler.c dyld: Symbol not found: __ZTTNSt3__114basic_ifstreamIcNS_11char_traitsIcEEEE Referenced from: /Users/runner/work/toywasm/toywasm/.wasi-sdk-17.0/bin/clang (which was built for Mac OS X 12.0) Expected in: /usr/lib/libc++.1.dylib in /Users/runner/work/toywasm/toywasm/.wasi-sdk-17.0/bin/clang make[1]: *** [CMakeFiles/cmTC_254ef.dir/testCCompiler.c.obj] Abort trap: 6 make: *** [cmTC_254ef/fast] Error 2 ``` References: https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 88c9f66..8e78a09 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,7 @@ build/llvm.BUILT: -DLLVM_STATIC_LINK_CXX_STDLIB=ON \ -DLLVM_HAVE_LIBXAR=OFF \ -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ -DCMAKE_INSTALL_PREFIX=$(PREFIX) \ -DLLVM_TARGETS_TO_BUILD=WebAssembly \ -DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-wasi \