Skip to content

Commit 9c72741

Browse files
get libc++ building thanks to @compnerd
1 parent 6a08c94 commit 9c72741

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ sysroot
3232
├── libc++abi.so.1.0
3333
├── libcrypt.a
3434
├── libc.so
35+
├── libc++.so.1 -> libc++.so.1.0
36+
├── libc++.so.1.0
3537
├── libdl.a
3638
├── libm.a
3739
├── libpthread.a
@@ -43,6 +45,9 @@ sysroot
4345
├── libutil.a
4446
├── libxnet.a
4547
├── linux
48+
│   ├── clang_rt.crtbegin-x86_64.o
49+
│   ├── clang_rt.crtend-x86_64.o
50+
│   └── libclang_rt.builtins-x86_64.a
4651
├── rcrt1.o
4752
└── Scrt1.o
4853
```

bootstrap.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,19 @@ function build_libcxx () {
168168
-D LIBCXX_SYSROOT=$SYSROOT/usr/local \
169169
-D LIBCXX_HAS_MUSL_LIBC=YES \
170170
-D LIBCXX_USE_COMPILER_RT=YES \
171-
--debug-trycompile \
171+
-D LIBCXX_INCLUDE_BENCHMARKS=NO \
172172
-D CMAKE_EXE_LINKER_FLAGS="-rtlib=compiler-rt -resource-dir=$RESOURCE --sysroot=$RESOURCE" \
173+
-D LIBCXX_SUPPORTS_NOSTDLIBXX_FLAG=NO \
173174
-G Ninja \
174175
-S ..
176+
# TODO: should we add LIBCXX_BUILTINS_LIBRARY="${SYSROOT}/usr/local/lib/linux/libclang_rt.builtins-x86_64.a"
177+
# as per @compnerd?
178+
#--debug-trycompile \
175179
#-D CMAKE_C_COMPILER_WORKS=YES \
176180
#-D LIBCXX_LINK_FLAGS="-stdlib=libc++" \
177181
#-D LIBCXX_LINK_FLAGS="-nodefaultlibs -lc -rtlib=compiler-rt" \
178182
ninja libc++.so
179-
183+
DESTDIR=$SYSROOT ninja install-cxx install-cxx-headers
180184

181185
popd
182186
}
@@ -187,8 +191,7 @@ bootstrap_compiler_rt
187191
./musl.sh
188192
build_libunwind
189193
build_libcxxabi
190-
#TODO: this doesn't work yet
191-
#build_libcxx
194+
build_libcxx
192195

193196
# Fangrui says try:
194197
# -DLLVM_HOST_TRIPLE=

0 commit comments

Comments
 (0)