OpenCilk / infrastructure

Installation instructions and build scripts for OpenCilk.
21 stars 6 forks source link

Build error on Apple M1 #11

Open tina80lvl opened 2 years ago

tina80lvl commented 2 years ago

Got an error while building sources with infrastructure/tools/build $(pwd)/opencilk $(pwd)/build command. Terminal opened with Rosetta.

MacBook Pro 2020 macOS Big Sur 11.6 Apple M1 chip clang-1300.0.29.3 x86_64-apple-darwin20.6.0

[ 96%] Performing build step for 'builtins'
[  9%] Built target clang_rt.cc_kext_i386_osx
[ 18%] Built target clang_rt.builtins_i386_osx
[ 27%] Built target clang_rt.builtins_i386_iossim
[ 49%] Built target clang_rt.cc_kext_x86_64h_osx
[ 63%] Built target clang_rt.builtins_x86_64h_osx
[ 70%] Built target clang_rt.builtins_x86_64_osx
[ 99%] Built target clang_rt.builtins_x86_64_iossim
[ 99%] Built target clang_rt.cc_kext_x86_64_osx
[100%] Built target clang_rt.osx
[100%] Built target clang_rt.cc_kext
[100%] Built target builtins
[100%] Built target compiler-rt
[ 96%] No install step for 'builtins'
[ 96%] Completed 'builtins'
[ 98%] Built target builtins
[ 98%] Built target runtimes-clobber
[ 98%] Performing configure step for 'runtimes'
-- Linker detection: ld64
CMake Warning at /Users/tina/opencilk/llvm/cmake/modules/HandleLLVMStdlib.cmake:28 (message):
  Can't specify libc++ with '-stdlib='
Call Stack (most recent call first):
  /Users/tina/opencilk/llvm/cmake/modules/HandleLLVMOptions.cmake:10 (include)
  CMakeLists.txt:114 (include)

CMake Warning at /Users/tina/opencilk/llvm/cmake/modules/HandleLLVMOptions.cmake:230 (message):
  -fPIC is not supported.
Call Stack (most recent call first):
  /Users/tina/opencilk/llvm/cmake/modules/HandleLLVMOptions.cmake:261 (add_flag_or_print_warning)
  CMakeLists.txt:114 (include)

-- Found libtool - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Found OSX_SYSROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk
-- Found libtool - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
CMake Error at /Users/tina/opencilk/compiler-rt/cmake/config-ix.cmake:172 (message):
  Please use architecture with 4 or 8 byte pointers.
Call Stack (most recent call first):
  /Users/tina/opencilk/compiler-rt/CMakeLists.txt:236 (include)

-- Configuring incomplete, errors occurred!
See also "/Users/tina/build/runtimes/runtimes-bins/CMakeFiles/CMakeOutput.log".
See also "/Users/tina/build/runtimes/runtimes-bins/CMakeFiles/CMakeError.log".
make[2]: *** [runtimes/runtimes-stamps/runtimes-configure] Error 1
make[1]: *** [runtimes/CMakeFiles/runtimes.dir/all] Error 2
make: *** [all] Error 2
neboat commented 2 years ago

Thanks for submitting an issue.

What version of cmake do you have on your system?

tina80lvl commented 2 years ago

cmake version 3.19.1

neboat commented 2 years ago

Thanks.

I'm a little concerned about that version of CMake, since it seems Apple Silicon support was added in CMake 3.19.2: https://cmake.org/cmake/help/v3.19/release/3.19.html#platforms. You might try using a newer version of CMake to see if it resolves the issue (and generates arm64 binaries or fat binaries for OpenCilk, instead of just x86_64 binaries).

tina80lvl commented 2 years ago

Updated CMake to version=3.22.1, got the same problem🥲

neboat commented 2 years ago

Just to double check, after you updated CMake, did you clear the build directory before rerunning? (Otherwise, CMake may have reused a value it cached from a previous run, which could cause it to fail the same way.)

It also looks like you're building OpenCilk version 1.0. You might try building OpenCilk version 1.1 instead by cloning a fresh copy of the infrastructure repo and following the updated instructions here in INSTALLING.md.

tina80lvl commented 2 years ago

I do exactly how you say. Cloning an actual version of OpenCilk from repo (did it 2 days ago). About build folder - yes, I did cleanup and got the same error after that.

neboat commented 2 years ago

Strange. Unfortunately I'm having trouble replicating the issue on my end.

I have a few thoughts and ideas, though, for diagnosing or working around the issue:

  1. Can you please share the CMakeError.log and CMakeOutput.log files generated?
  2. In your copy of infrastructure/tools/build, try replacing this line https://github.com/OpenCilk/infrastructure/blob/release/tools/build#L80 with the following: : "${COMPILER_RT_RUNTIMES:=";compiler-rt;libcxx;libcxxabi"}" ;; (In other words, change COMPILER_RT_COMPONENTS to COMPILER_RT_RUNTIMES in that line.) Then rebuild (with a clean build directory) and see if the issue persists or changes.
  3. In your copy of infrastructure/tools/build, try replacing this line https://github.com/OpenCilk/infrastructure/blob/release/tools/build#L80 with the following: : "${COMPILER_RT_COMPONENTS:=";libcxx;libcxxabi"}" ;; (In other words, undo the previous change, and then remove ;compiler-rt from the list.) Then rebuild and see if the issue persists or changes. (If this builds successfully, the resulting OpenCilk system won't have Google's sanitizers, but it should still have Cilksan and Cilkscale.)
  4. In your copy of infrastructure/tools/build, try adding -DCMAKE_SIZEOF_VOID_P=8 right before this line: https://github.com/OpenCilk/infrastructure/blob/release/tools/build#L107, then rebuild and see if the issue persists or changes. You might also try combining this change with one of the above changes.

Let us know how that goes.