-1

I'm not sure what the problem is.
The command is:

root@root:/usr/lib/buildroot# make

And the error message is:

llvm 9.0.1 Building PATH="/usr/lib/buildroot/output/host/bin:/usr/lib/buildroot/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" /usr/bin/make -j3 -C /usr/lib/buildroot/output/build/llvm-9.0.1//buildroot-build make[1]: Entering directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' make[2]: Entering directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' make[3]: Entering directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' make[3]: Entering directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' make[3]: Entering directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' make[3]: Leaving directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' make[3]: Leaving directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' make[3]: Leaving directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' make[3]: Entering directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' make[3]: Entering directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' [ 0%] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o make[3]: Entering directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' [ 0%] Building CXX object lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o aarch64-none-linux-gnu-g++: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build/lib/TableGen' lib/TableGen/CMakeFiles/LLVMTableGen.dir/build.make:62: recipe for target 'lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o' failed make[3]: *** [lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o] Error 1 make[3]: Leaving directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' CMakeFiles/Makefile2:879: recipe for target 'lib/TableGen/CMakeFiles/LLVMTableGen.dir/all' failed make[2]: *** [lib/TableGen/CMakeFiles/LLVMTableGen.dir/all] Error 2 make[2]: *** Waiting for unfinished jobs.... [ 0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/AArch64TargetParser.cpp.o [ 0%] Building CXX object lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o aarch64-none-linux-gnu-g++: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build/lib/Demangle' lib/Demangle/CMakeFiles/LLVMDemangle.dir/build.make:62: recipe for target 'lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o' failed make[3]: *** [lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o] Error 1 make[3]: *** Waiting for unfinished jobs.... aarch64-none-linux-gnu-g++: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build/lib/Support' lib/Support/CMakeFiles/LLVMSupport.dir/build.make:62: recipe for target 'lib/Support/CMakeFiles/LLVMSupport.dir/AArch64TargetParser.cpp.o' failed make[3]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/AArch64TargetParser.cpp.o] Error 1 make[3]: *** Waiting for unfinished jobs.... aarch64-none-linux-gnu-g++: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build/lib/Demangle' lib/Demangle/CMakeFiles/LLVMDemangle.dir/build.make:75: recipe for target 'lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o' failed make[3]: *** [lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o] Error 1 make[3]: Leaving directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' CMakeFiles/Makefile2:640: recipe for target 'lib/Demangle/CMakeFiles/LLVMDemangle.dir/all' failed make[2]: *** [lib/Demangle/CMakeFiles/LLVMDemangle.dir/all] Error 2 [ 0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ARMTargetParser.cpp.o aarch64-none-linux-gnu-g++: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build/lib/Support' lib/Support/CMakeFiles/LLVMSupport.dir/build.make:75: recipe for target 'lib/Support/CMakeFiles/LLVMSupport.dir/ARMTargetParser.cpp.o' failed make[3]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/ARMTargetParser.cpp.o] Error 1 make[3]: Leaving directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' CMakeFiles/Makefile2:800: recipe for target 'lib/Support/CMakeFiles/LLVMSupport.dir/all' failed make[2]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/all] Error 2 make[2]: Leaving directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' Makefile:151: recipe for target 'all' failed make[1]: *** [all] Error 2 make[1]: Leaving directory '/usr/lib/buildroot/output/build/llvm-9.0.1/buildroot-build' package/pkg-generic.mk:266: recipe for target '/usr/lib/buildroot/output/build/llvm-9.0.1/.stamp_built' failed make: *** [/usr/lib/buildroot/output/build/llvm-9.0.1/.stamp_built] Error 2

samabcde
  • 6,988
  • 2
  • 25
  • 41
Winson
  • 1
  • 1
  • Make error message more readable. Fix typo(waht). Suggest to include the scenario or background on how the problem occur. Briefly describe the project you are building and post the make file also. – samabcde Jul 13 '20 at 05:32

2 Answers2

0

You have added a host system library path to your build (maybe by error? Since you did not post the necessary information we do not know). Host library paths are paths outside of the cross-toolchain or buildroot path.

This Feature for detecting unsafe include paths has been included into buildroot a couple of years ago. See: https://git.busybox.net/buildroot/commit/?id=5aa205eba4063ddf17a2e11420eea2a8aa7536a5

Either you will need to remove host system include paths from your build (which you always should do). But if you are sure everything is right you can define BR_COMPILER_PARANOID_UNSAFE_PATH to an empty value so it will be just a warning, and not an error.

A.K.
  • 861
  • 6
  • 12
0

You cannot build Buildroot under /usr/lib. Move the directory somewhere else, e.g. /home/buildroot. Note that after moving you have to do a clean build.

Note also that you shouldn't do the build as root. Create a non-root user and do the build as that user.

Arnout
  • 2,927
  • 16
  • 24