diff --git a/prepare-cross-toolchain.sh b/prepare-cross-toolchain.sh index 7519501..4bafc4d 100755 --- a/prepare-cross-toolchain.sh +++ b/prepare-cross-toolchain.sh @@ -37,8 +37,21 @@ for i in libc++ libunwind; do fi done -# Copy the clang bundled runtime libraries (compiler-rt) -cp -a $CLANG_RESOURCE_DIR/lib $DEST/lib/clang/$CLANG_VERSION +# Copy the clang resource files (include, lib, share). The clang cross +# build installs the main headers, but since we didn't build the runtimes +# (compiler-rt), we're lacking the files that are installed by them. The +# compiler-rt build primarily installs some libs, but also a few files under +# share, and headers for some of the runtime libraries. +# +# Instead of trying to merge these files on top of the headers installed +# by the clang cross build, just wipe the existing files and copy the whole +# resource directory from the complete toolchain. As long as it's a matching +# version of clang, the headers that were installed by it should be identical. +# +# Alternatively, we could copy the lib and share subdirectories, and +# copy the individual include subdirectories that are missing. +rm -rf $DEST/lib/clang/$CLANG_VERSION +cp -a $CLANG_RESOURCE_DIR $DEST/lib/clang/$CLANG_VERSION rm -rf $DEST/include # Copy over headers and arch specific files, converting a unix style