LLVM 8 + Mavericks?

Does LLVM 8 work in macOS 10.9.5?

It should do. The released binaries appear to have been compiled so
they can run on that version, and Apple Clang 6.0 (from the newest
Xcode that runs on 10.9) meets the build requirements, even for trunk
(Getting Started with the LLVM System — LLVM 16.0.0git documentation).

Are you seeing any problems?

Tim.

W dniu 2019-04-04 o 09:18, Tim Northover pisze:

Does LLVM 8 work in macOS 10.9.5?

It should do. The released binaries appear to have been compiled so
they can run on that version, and Apple Clang 6.0 (from the newest
Xcode that runs on 10.9) meets the build requirements, even for trunk
(Getting Started with the LLVM System — LLVM 16.0.0git documentation).

Are you seeing any problems?

Tim.

I's keen to build LLVM, I ran:

cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_CCACHE_BUILD=ON -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm/6.0.1-bin-cc/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm/6.0.1-bin-cc/bin/clang++ -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_CREATE_XCODE_TOOLCHAIN=ON -DLLVM_ENABLE_CXX1Y=ON -DLLVM_ENABLE_CXX1Z=ON -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/llvm/8.0.0-bin/ ..

I noticed seeing amidst msgs "Could NOT find Z3 (missing: Z3_LIBRARIES Z3_INCLUDE_DIR) (Required is at least version "4.7.1")"

and after that:
make -j4

that stopped saying it didn't find "compression.h", I thought it should be somewhere because I've zlib installed, I looked and it wasn't anywhere, although I webbed that MacOSX 10.13 sdk has it so I unpacked it to Xcode so I had MacOSX10.9.sdk and MacOSX10.13.sdk in SDKs, I erased all build files, cmake now displayed "Found SDK version 10.10" (it puzzled me, I've 10.13), I ran make and got:

/Users/mkl/Downloads/llvm/llvm-8.0.0.src/tools/lldb/tools/debugserver/source/RNBRemote.cpp:45:10: fatal error:
'compression.h' file not found
/Users/mkl/Downloads/llvm/llvm-8.0.0.src/tools/lldb/tools/debugserver/source/MacOSX/MachTask.mm:408:35: error: use of undeclared identifier 'vm_kernel_page_size'
/Users/mkl/Downloads/llvm/llvm-8.0.0.src/tools/lldb/tools/debugserver/source/MacOSX/MachProcess.mm:584:12: error: use of undeclared identifier 'LC_VERSION_MIN_TVOS'
/Users/mkl/Downloads/llvm/llvm-8.0.0.src/tools/lldb/tools/debugserver/source/MacOSX/MachProcess.mm:584:42: error: use of undeclared identifier 'LC_VERSION_MIN_WATCHOS'
/Users/mkl/Downloads/llvm/llvm-8.0.0.src/tools/lldb/tools/debugserver/source/MacOSX/MachProcess.mm:601:10: error: use of undeclared identifier 'LC_VERSION_MIN_TVOS'
/Users/mkl/Downloads/llvm/llvm-8.0.0.src/tools/lldb/tools/debugserver/source/MacOSX/MachProcess.mm:603:10: error: use of undeclared identifier 'LC_VERSION_MIN_WATCHOS'

I thought I'll dl LLVM 8 bin pkg and see if it goes so instead of LLVM 5 with CLion 2018.3.4 (which is fine) I used in Settings > Build, Execution, Deployment > Toolchains:
CMake - Bundled (Version: 3.13.2)
Make - Detected (/usr/bin/make)
C Compiler - /usr/local/Cellar/llvm/8.0.0-bin/bin/clang
C++ Compiler - /usr/local/Cellar/llvm/8.0.0-bin/bin/clang++
Debugger - Bundled LLDB (Version: 6.0.1)

basic C++ "cout" program runs fine:

====================[ Build | untitled | Debug ]================================
"/Applications/CLion 2018.3.app/Contents/bin/cmake/mac/bin/cmake" --build /Users/mkl/Documents/Projects/CLionProjects/untitled/cmake-build-debug --target untitled -- -j 2
Scanning dependencies of target untitled
[ 50%] Building CXX object CMakeFiles/untitled.dir/main.cpp.o
[100%] Linking CXX executable untitled
ld: warning: ignoring unknown argument: -search_paths_first
ld: warning: ignoring unknown argument: -headerpad_max_install_names
ld: warning: -sdk_version is required when emitting min version load command. Setting sdk version to match provided min version
[100%] Built target untitled

although for OpenGL app this shows:

====================[ Build | Gearoids | Debug ]================================
"/Applications/CLion 2018.3.app/Contents/bin/cmake/mac/bin/cmake" --build /Users/mkl/Documents/Projects/CLionProjects/Gearoids/cmake-build-debug --target Gearoids -- -j 2
Scanning dependencies of target Gearoids
[ 16%] Building CXX object CMakeFiles/Gearoids.dir/main.cpp.o
[ 33%] Building CXX object CMakeFiles/Gearoids.dir/GameState.cpp.o
[ 50%] Building CXX object CMakeFiles/Gearoids.dir/GameData.cpp.o
[ 83%] Building CXX object CMakeFiles/Gearoids.dir/PBall.cpp.o
[ 83%] Building CXX object CMakeFiles/Gearoids.dir/StarShip.cpp.o
[100%] Linking CXX executable Gearoids
ld: warning: ignoring unknown argument: -search_paths_first
ld: warning: ignoring unknown argument: -headerpad_max_install_names
ld: warning: -sdk_version is required when emitting min version load command. Setting sdk version to match provided min version
Stack dump:
0. Program arguments: /usr/local/Cellar/llvm/8.0.0-bin/bin/ld -demangle -lto_library /usr/local/Cellar/llvm/8.0.0-bin/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o Gearoids -L/usr/local/Cellar/glfw3/3.2.1/lib -L/usr/local/lib/fmod -search_paths_first -headerpad_max_install_names CMakeFiles/Gearoids.dir/main.cpp.o CMakeFiles/Gearoids.dir/GameState.cpp.o CMakeFiles/Gearoids.dir/GameData.cpp.o CMakeFiles/Gearoids.dir/StarShip.cpp.o CMakeFiles/Gearoids.dir/PBall.cpp.o -rpath /usr/local/Cellar/glfw3/3.2.1/lib -rpath /usr/local/lib/fmod -framework OpenGL -framework OpenGL -lglfw3 -framework Carbon -framework Cocoa -framework ApplicationServices -lz /usr/local/lib/libfltk_images.dylib /usr/local/lib/libfltk_forms.dylib /usr/local/lib/libfltk_gl.dylib -framework OpenGL /usr/local/lib/libfltk.dylib -lfmod -lglfw3 -framework Carbon -framework Cocoa -framework ApplicationServices -lz /usr/local/lib/libfltk_images.dylib /usr/local/lib/libfltk_forms.dylib /usr/local/lib/libfltk_gl.dylib /usr/local/lib/libfltk.dylib -lfmod -lc++ -lSystem /usr/local/Cellar/llvm/8.0.0-bin/lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a
0 ld 0x000000010e740c85 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 ld 0x000000010e73fd68 llvm::sys::RunSignalHandlers() + 248
2 ld 0x000000010e7412e8 SignalHandler(int) + 264
3 libsystem_platform.dylib 0x00007fff8cc005aa _sigtramp + 26
4 libsystem_platform.dylib 0x00007fff5156f6e8 _sigtramp + 3298226520
5 ld 0x000000010e977ad5 lld::mach_o::MachODylibFile::exports(llvm::StringRef, llvm::StringRef) const + 53
6 ld 0x000000010e977b5a lld::mach_o::MachODylibFile::exports(llvm::StringRef, llvm::StringRef) const + 186
7 ld 0x000000010e977b5a lld::mach_o::MachODylibFile::exports(llvm::StringRef, llvm::StringRef) const + 186
8 ld 0x000000010e977b5a lld::mach_o::MachODylibFile::exports(llvm::StringRef, llvm::StringRef) const + 186
9 ld 0x000000010e977a6c lld::mach_o::MachODylibFile::exports(llvm::StringRef) const + 28
10 ld 0x000000010e9b9f0f std::__1::__function::__func<lld::Resolver::handleSharedLibrary(lld::File&)::$_1, std::__1::allocator<lld::Resolver::handleSharedLibrary(lld::File&)::$_1>, llvm::Expected<bool> (llvm::StringRef)>::operator()(llvm::StringRef&&) + 47
11 ld 0x000000010e9b7bb2 lld::Resolver::forEachUndefines(lld::File&, std::__1::function<llvm::Expected<bool> (llvm::StringRef)>) + 402
12 ld 0x000000010e9b7edd lld::Resolver::handleSharedLibrary(lld::File&) + 221
13 ld 0x000000010e9b85bd lld::Resolver::resolveUndefines() + 1149
14 ld 0x000000010e9b9af6 lld::Resolver::resolve() + 22
15 ld 0x000000010e7ba9be lld::mach_o::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&) + 1070
16 ld 0x000000010e69164f main + 815
17 libdyld.dylib 0x00007fff91c165fd start + 1
18 libdyld.dylib 0x000000000000003b start + 1849596479
clang-8: error: unable to execute command: Segmentation fault: 11
clang-8: error: linker command failed due to signal (use -v to see invocation)
make[3]: *** [Gearoids] Error 254
make[2]: *** [CMakeFiles/Gearoids.dir/all] Error 2
make[1]: *** [CMakeFiles/Gearoids.dir/rule] Error 2
make: *** [Gearoids] Error 2

I've ld linked to ld.lld in LLVM 8's bin folder if that means anything...

Mark

Hi,

I noticed seeing amidst msgs "Could NOT find Z3 (missing: Z3_LIBRARIES
Z3_INCLUDE_DIR) (Required is at least version "4.7.1")"

This is normal. Z3 is a SAT solver library, and not even remotely
essential to compiling or running LLVM. I've seen the message
thousands of times.

that stopped saying it didn't find "compression.h", I thought it should
be somewhere because I've zlib installed, I looked and it wasn't
anywhere, although I webbed that MacOSX 10.13 sdk has it so I unpacked
it to Xcode so I had MacOSX10.9.sdk and MacOSX10.13.sdk in SDKs, I
erased all build files, cmake now displayed "Found SDK version 10.10"
(it puzzled me, I've 10.13), I ran make and got:

/Users/mkl/Downloads/llvm/llvm-8.0.0.src/tools/lldb/tools/debugserver/source/RNBRemote.cpp:45:10:
fatal error:

That's unfortunate, but if it's restricted to lldb you might have some
luck if you just didn't bother compiling that and just used the system
debugger. If you're actually trying to work on lldb you may need a
more robust solution, but that's pretty rare.

lld::mach_o::MachODylibFile::exports(llvm::StringRef, llvm::StringRef)
const + 53

lld is unfortunately not a suitable replacement for the system's own
ld64. Some work was done a few years back, but it never reached
anything near feature parity and has bitrotted since. You should only
be using it for ELF and COFF (and WAsm) unless you're planning on
working on lld itself, and then you'd know the issues.

So, in summary my advice is:

1. Only build the bits of LLVM you intend to work on and use.
2. Use the system tools to do that build where possible.

Cheers.

Tim.

W dniu 2019-04-08 o 21:39, Tim Northover pisze:

Hi,

I noticed seeing amidst msgs "Could NOT find Z3 (missing: Z3_LIBRARIES
Z3_INCLUDE_DIR) (Required is at least version "4.7.1")"

This is normal. Z3 is a SAT solver library, and not even remotely
essential to compiling or running LLVM. I've seen the message
thousands of times.

that stopped saying it didn't find "compression.h", I thought it should
be somewhere because I've zlib installed, I looked and it wasn't
anywhere, although I webbed that MacOSX 10.13 sdk has it so I unpacked
it to Xcode so I had MacOSX10.9.sdk and MacOSX10.13.sdk in SDKs, I
erased all build files, cmake now displayed "Found SDK version 10.10"
(it puzzled me, I've 10.13), I ran make and got:

/Users/mkl/Downloads/llvm/llvm-8.0.0.src/tools/lldb/tools/debugserver/source/RNBRemote.cpp:45:10:
fatal error:

That's unfortunate, but if it's restricted to lldb you might have some
luck if you just didn't bother compiling that and just used the system
debugger. If you're actually trying to work on lldb you may need a
more robust solution, but that's pretty rare.

lld::mach_o::MachODylibFile::exports(llvm::StringRef, llvm::StringRef)
const + 53

lld is unfortunately not a suitable replacement for the system's own
ld64. Some work was done a few years back, but it never reached
anything near feature parity and has bitrotted since. You should only
be using it for ELF and COFF (and WAsm) unless you're planning on
working on lld itself, and then you'd know the issues.

So, in summary my advice is:

1. Only build the bits of LLVM you intend to work on and use.
2. Use the system tools to do that build where possible.

Cheers.

Tim.

Hi,
I get another thing if I build 32-bit version, tsan_platform.h: only 64-bit supported and error around MappingImpl in compiler-rt, should it be built without it as well due to this crap?

Mark