Skip to content

build_symbolizer.sh: Ensure libcxx include path comes first #149431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MatzeB
Copy link
Contributor

@MatzeB MatzeB commented Jul 18, 2025

libc++ expects to come first in the search path, before libc. See for example: https://github.com/llvm/llvm-project/blob/main/libcxx/include/cstddef#L45

Make sure the C++ include path comes first even if custom paths to libc and other packages are passed in via the FLAGS variable.

@MatzeB MatzeB requested review from pcc and vitalybuka July 18, 2025 00:42
@MatzeB MatzeB marked this pull request as ready for review July 18, 2025 00:42
@llvmbot
Copy link
Member

llvmbot commented Jul 18, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Matthias Braun (MatzeB)

Changes

libc++ expects to come first in the search path, before libc. See for example: https://github.com/llvm/llvm-project/blob/main/libcxx/include/cstddef#L45

Make sure the C++ include path comes first even if custom paths to libc and other packages are passed in via the FLAGS variable.


Full diff: https://github.com/llvm/llvm-project/pull/149431.diff

1 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh (+1-1)
diff --git a/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh b/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
index 4d435976d3a10..c13a94f1279e1 100755
--- a/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
+++ b/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
@@ -120,7 +120,7 @@ ninja cxx cxxabi && ninja install-cxx install-cxxabi
 
 FLAGS="${FLAGS} -fno-rtti -fno-exceptions"
 LLVM_CFLAGS="${FLAGS} -Wno-global-constructors"
-LLVM_CXXFLAGS="${LLVM_CFLAGS} -nostdinc++ -I${ZLIB_BUILD} -isystem ${LIBCXX_INSTALL}/include -isystem ${LIBCXX_INSTALL}/include/c++/v1"
+LLVM_CXXFLAGS="-isystem ${LIBCXX_INSTALL}/include/c++/v1 ${LLVM_CFLAGS} -nostdinc++ -I${ZLIB_BUILD}"
 
 # Build LLVM.
 if [[ ! -f ${LLVM_BUILD}/build.ninja ]]; then

@MatzeB MatzeB force-pushed the build_symbolizer_fix branch from ef929f7 to 7754f9a Compare July 18, 2025 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants