Skip to content

Commit

Permalink
xcode-cross: Execute clang within the xctoolchain directory
Browse files Browse the repository at this point in the history
This makes it pick up the libc++ headers from within there,
instead of the ones that were shipped with the vanilla clang,
allowing us to remove the libc++ headers shipped with clang.

Clang still uses the compiler-rt files from the directory
next to the actual clang executable though.
  • Loading branch information
mstorsjo committed Apr 2, 2024
1 parent 6ab28b9 commit 55b67db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ RUN set -x \
&& mv bin/clang-11 bin/clang bin/clang++ bin/dsymutil bin/llvm-nm bin-new \
&& rm -rf bin \
&& mv bin-new bin \
&& mkdir include-new \
&& mv include/c++ include-new \
&& rm -rf include \
&& mv include-new include \
&& rm -rf lib/*.a lib/*.so lib/*.so.* lib/clang/11.0.0/lib/linux
&& rm -rf lib/*.a lib/*.so lib/*.so.* lib/clang/11.0.0/lib/linux include

RUN set -x \
&& git clone https://github.com/facebook/xcbuild.git xcbuild-src \
Expand Down
6 changes: 3 additions & 3 deletions setup-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ if [ -z "\$SYSROOT_SET" ]; then
fi
export PATH=$CCTOOLS/bin:\$PATH
if [ "\$TOOL" = "clang++" ] || [ "\$TOOL" = "c++" ] || [ "\$TOOL" = "g++" ]; then
EXE=$CLANG/bin/clang++
else
EXE=$CLANG/bin/clang
ARGS+=(--driver-mode=g++)
fi
EXE=\$(dirname \$(readlink -f \$0))/clang-exe
\$EXE "\${ARGS[@]}"
EOF
chmod a+x clang
Expand All @@ -99,6 +98,7 @@ ln -sf clang g++

ln -s $CLANG/bin/dsymutil .
ln -s $CLANG/bin/llvm-nm nm
ln -s $CLANG/bin/clang clang-exe

cd ../lib
mkdir -p $CLANG/lib/arc
Expand Down

0 comments on commit 55b67db

Please sign in to comment.