Error during cmake build, missing header file that I know the path to (mac)

℡╲_俬逩灬. 提交于 2020-03-04 15:34:35

问题


This post is bumping a 3 year old unresolved issue from here

I am following instructions from here.

As the title suggests, I'm running mac os mojave.

I can successfully build with cmake, but I cannot make successfully and receive the following error:

$ cmake --build . -v -- include_dir=/usr/include/
...
...
...
[ 32%] Building C object projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.eprintf.dir/eprintf.c.o
cd /Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/build/projects/compiler-rt/lib/builtins && /usr/bin/clang -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/build/projects/compiler-rt/lib/builtins -I/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/projects/compiler-rt/lib/builtins -I/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/build/include -I/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/include  -O3 -DNDEBUG -arch i386    -isysroot -mmacosx-version-min=10.5 -arch i386 -fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer -o CMakeFiles/clang_rt.eprintf.dir/eprintf.c.o   -c /Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/projects/compiler-rt/lib/builtins/eprintf.c
clang: warning: no such sysroot directory: '-mmacosx-version-min=10.5' [-Wmissing-sysroot]
/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/projects/compiler-rt/lib/builtins/eprintf.c:14:10: fatal error: 
      'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
make[2]: *** [projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.eprintf.dir/eprintf.c.o] Error 1
make[1]: *** [projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.eprintf.dir/all] Error 2
make: *** [all] Error 2

I cannot locate where I need to edit in order to change the input to the -isysroot flag that seems to be the culprit, to be where I know stdio.h is (/usr/include/).

I have also done xcode-select --install, have installed the mac os x sdk headers, and rm -rf my build folder and remade the build folder again to no avail.

After spending all day trying different things, I think this made the most sense (but didn't work):

rm -rf build; mkdir build; cd build;
cmake -G "Unix Makefiles" -DINTEL_SPECIFIC_CILKPLUS=1 -DCMAKE_INSTALL_PREFIX= -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 -DEO_SOURCE_DIR:PATH=/usr/include -DCMAKE_SYSROOT=/ -DCMAKE_C_FLAGS=-isysroot\ / -DCMAKE_CXX_FLAGS=-isysroot\ / -DCMAKE_CLANG_FLAGS=-isysroot\ / -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. 
cmake --build . -v -- include_dir=/usr/include

The key is the -DCMAKE_CLANG_FLAGS=-isysroot\ / flag getting the build ready. But this did not work.

来源:https://stackoverflow.com/questions/60192073/error-during-cmake-build-missing-header-file-that-i-know-the-path-to-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!