-
Notifications
You must be signed in to change notification settings - Fork 0
/
dealing_with_llvm_clang.txt
53 lines (49 loc) · 1.81 KB
/
dealing_with_llvm_clang.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# Source https://libcxx.llvm.org/BuildingLibcxx.html
# This commmand first build the clang and use the just-built clang to build the runtime
#
```
$ cmake -G "Unix Makefiles" \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt" \
-DCMAKE_INSTALL_PREFIX=/usr/local/opt/llvm-15 \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DBUILTINS_CMAKE_ARGS=-DCOMPILER_RT_ENABLE_IOS=OFF \
../llvm
```
#
# WSL2 compilation command
#
```
cmake -G "Unix Makefiles" \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt" \
-DCMAKE_INSTALL_PREFIX=/usr/local/llvm-15 \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
../llvm
```
#
# This link shows how to use the newly built runtime while skipping the runtime install in the system
# https://libcxx.llvm.org/UsingLibcxx.html#alternate-libcxx
#
#
# Another way to get the list of includes from a system
#
```
$ echo | g++ -Wp,-v -x c++ - -fsyntax-only
clang -cc1 version 14.0.0 (clang-1400.0.29.102) default target x86_64-apple-darwin21.6.0
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:
/usr/local/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/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.
```