Issue 104759
Summary clang18.1.8 meet search path bug when cross compiling
Labels new issue
Assignees
Reporter xiedeacc
    I cross compiling jemalloc for macosx on linux, I'm sure that header exists, and path included by -isystem, because if I manually execute command from error log, it successed. 




```
export ASFLAGS='-v -isystem /root/src/software/MacOSX14.2.sdk/usr/include -isystem /root/src/software/MacOSX14.2.sdk/System/Library/Frameworks --target=x86_64-apple-darwin23.3 -mmacosx-version-min=10.11'
export CFLAGS='-v -isystem /root/src/software/MacOSX14.2.sdk/usr/include -isystem /root/src/software/MacOSX14.2.sdk/System/Library/Frameworks --target=x86_64-apple-darwin23.3 -isystem /root/src/software/MacOSX14.2.sdk/llvm18.1.8/lib/clang/18/include -mmacosx-version-min=10.11 --sysroot=/root/src/software/MacOSX14.2.sdk'
export CXXFLAGS='-v -isystem /root/src/software/MacOSX14.2.sdk/usr/include -isystem /root/src/software/MacOSX14.2.sdk/System/Library/Frameworks --target=x86_64-apple-darwin23.3 -nostdinc -nostdinc++ -isystem /root/src/software/MacOSX14.2.sdk/llvm18.1.8/include/c++/v1 -isystem /root/src/software/MacOSX14.2.sdk/llvm18.1.8/lib/clang/18/include -mmacosx-version-min=10.11 --sysroot=/root/src/software/MacOSX14.2.sdk'
export LDFLAGS='-mmacosx-version-min=10.11 -v -lc -lm -nostdlib -L/root/src/software/MacOSX14.2.sdk/llvm18.1.8/lib/ -L/root/src/software/MacOSX14.2.sdk/llvm18.1.8/lib/clang/18/lib/darwin/ -L/root/src/software/MacOSX14.2.sdk/usr/lib/ -rtlib=compiler-rt -stdlib=libc++ -lc++ -lc++abi -lunwind --target=x86_64-apple-darwin23.3 --sysroot=/root/src/software/MacOSX14.2.sdk'
export AR=/usr/local/llvm/18/bin/x86_64-apple-darwin23.3-libtool
export CC=/usr/local/llvm/18/bin/clang
export CXX=/usr/local/llvm/18/bin/clang
export LD=/usr/local/llvm/18/bin/ld64
export NM=/usr/local/llvm/18/bin/x86_64-apple-darwin-nm
./configure --prefix=/root/jemalloc --disable-static --enable-shared --with-version=5.3.0-186-g21bcc0a8d49ab2944ae53c7e43f5c84fc8a34322 --host=x86_64-apple-darwin23.3
make

```

error log
```
/usr/local/llvm/18/bin/clang -std=gnu11 -Werror=unknown-warning-option -Wall -Wextra -Wshorten-64-to-32 -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-arith -Wno-missing-braces -Wno-missing-field-initializers -pipe -g3 -Wimplicit-fallthrough -Wdeprecated-declarations -O3 -funroll-loops -v -isystem /root/src/software/MacOSX14.2.sdk/usr/include -isystem /root/src/software/MacOSX14.2.sdk/System/Library/Frameworks --target=x86_64-apple-darwin23.3 -isystem /root/src/software/MacOSX14.2.sdk/llvm18.1.8/lib/clang/18/include -mmacosx-version-min=10.11 -fPIC -DPIC -c -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/jemalloc.sym.o src/jemalloc.c
clang version 18.1.8 (g...@code.xiamu.com:llvm/llvm-project.git 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
Target: x86_64-apple-darwin23.3
Thread model: posix
InstalledDir: /usr/local/llvm/18/bin
 (in-process)
 "/usr/local/llvm/18/bin/clang-18" -cc1 -triple x86_64-apple-macosx10.11.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name jemalloc.c -mrelocation-model pic -pic-level 2 -mframe-pointer=all -ffp-contract=on -fno-rounding-math -funwind-tables=2 -faligned-alloc-unavailable -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -fbuiltin-headers-in-system-modules -fdefine-target-os-macros -target-cpu core2 -tune-cpu generic -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -fdebug-compilation-dir=/root/.cache/bazel/_bazel_root/d7f4cad81e2b036f4c3382027c9d9c7a/sandbox/linux-sandbox/329/execroot/bazel_template/bazel-out/x86_64-opt-ST-8a34343ab408/bin/external/jemalloc/jemalloc.build_tmpdir -v -fcoverage-compilation-dir=/root/.cache/bazel/_bazel_root/d7f4cad81e2b036f4c3382027c9d9c7a/sandbox/linux-sandbox/329/execroot/bazel_template/bazel-out/x86_64-opt-ST-8a34343ab408/bin/external/jemalloc/jemalloc.build_tmpdir -resource-dir /usr/local/llvm/18/lib/clang/18 -isystem /root/src/software/MacOSX14.2.sdk/usr/include -isystem /root/src/software/MacOSX14.2.sdk/System/Library/Frameworks -isystem /root/src/software/MacOSX14.2.sdk/llvm18.1.8/lib/clang/18/include -D PIC -D _REENTRANT -I include -I include -D JEMALLOC_NO_PRIVATE_NAMESPACE -internal-isystem /usr/local/include -internal-isystem /usr/local/llvm/18/lib/clang/18/include -internal-externc-isystem /usr/include -O3 -Werror=unknown-warning-option -Wall -Wextra -Wshorten-64-to-32 -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-arith -Wno-missing-braces -Wno-missing-field-initializers -Wimplicit-fallthrough -Wdeprecated-declarations -std=gnu11 -ferror-limit 19 -funroll-loops -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fmax-type-align=16 -fcolor-diagnostics -vectorize-loops -vectorize-slp -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o src/jemalloc.sym.o -x c src/jemalloc.c
clang -cc1 version 18.1.8 based upon LLVM 18.1.8 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/System/Library/Frameworks"
ignoring nonexistent directory "/Library/Frameworks"
ignoring duplicate directory "include"
#include "..." search starts here:
#include <...> search starts here:
 include
 /root/src/software/MacOSX14.2.sdk/usr/include
 /root/src/software/MacOSX14.2.sdk/System/Library/Frameworks
 /root/src/software/MacOSX14.2.sdk/llvm18.1.8/lib/clang/18/include
 /usr/local/llvm/18/lib/clang/18/include
 /usr/include
End of search list.
In file included from src/jemalloc.c:1:
In file included from include/jemalloc/internal/jemalloc_preamble.h:5:
include/jemalloc/internal/jemalloc_internal_decls.h:53:14: fatal error: 'mach/mach_time.h' file not found
   53 | #    include <mach/mach_time.h>
      |              ^~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Makefile:496: src/jemalloc.sym.o] Error 1

```
![image](https://github.com/user-attachments/assets/e4b9700c-8059-476d-b6e8-79af6fd26577)


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to