Reason is clang auto search add -isystem Header file order error
include_directories(
SYSTEM
${CMAKE_SYSROOT}/arm-linux-gnueabihf/include/c++/8.2.1
${CMAKE_SYSROOT}/arm-linux-gnueabihf/include/c++/8.2.1/arm-linux-gnueabihf
${CMAKE_SYSROOT}/arm-linux-gnueabihf/include/c++/8.2.1/backward
${CMAKE_SYSROOT}/lib/gcc/arm-linux-gnueabihf/8.2.1/include
${CMAKE_SYSROOT}/lib/gcc/arm-linux-gnueabihf/8.2.1/include-fixed
${CMAKE_SYSROOT}/arm-linux-gnueabihf/include
${CMAKE_SYSROOT}/arm-linux-gnueabihf/libc/usr/include
)
By Manual setting resolved
It is not clear whether the automatic addition of -isystem can be ignored ?
Later I learned that it can be -nostdinc shielded.
issue 2:
ld.lld: error: cannot open crt1.o/crti.o/crtn.o: no such file or directory
cmake set link_directories(${CMAKE_SYSROOT}/arm-linux-gnueabihf/libc/usr/lib) can't solve
cmake set target_link_libraries(demo ${CMAKE_SYSROOT}/arm-linux-gnueabihf/libc/usr/lib/crt1.o ...) can't solve
Unable to find a solution, I had no choice but to find another way
The automatic search is successful only when the position is changed finally
Is there no way to set this path ?
After cmake is manually set, multiple duplicates of - l param are automatically added.
There is no way to ignore the automatically added - L param ?
After comparing arm-linux-gnueabi-g++ -v , I try
After setting, the automatic search of Inc and lib by clang is normal.
But I haven't found how to manually set clang to search the crtlib directory, maybe only by setting -nostdlib to make -l path/crtx.o take effect.
My host env = Windows10(x64) + CMake3.23.1 + Ninja1.11.0 + Clang14.0.3 clang version 14.0.3 Target: x86_64-pc-windows-msvc Thread model: posix InstalledDir: D:\Program Files\LLVM\bin
Target host pack = gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf
During compilation issue 1:
Reason is clang auto search add
-isystem
Header file order errorBy Manual setting resolved It is not clear whether the automatic addition of
-isystem
can be ignored ? Later I learned that it can be -nostdinc shielded.issue 2:
Unable to find a solution, I had no choice but to find another way
The automatic search is successful only when the position is changed finally Is there no way to set this path ? After cmake is manually set, multiple duplicates of - l param are automatically added. There is no way to ignore the automatically added - L param ? After comparing arm-linux-gnueabi-g++ -v , I try
After setting, the automatic search of Inc and lib by clang is normal. But I haven't found how to manually set clang to search the crtlib directory, maybe only by setting -nostdlib to make -l path/crtx.o take effect.
Error detail log: