moby/hyperkit

error: include location '/usr/local/include' is unsafe for cross-compilation

dgeorg42 opened this issue · 2 comments

I am attempting to build Hyperkit on macOS Catalina 10.15.7 It is failing with the following:

(master) >> make
cc src/lib/vmm/intel/vmcs.c
error: include location '/usr/local/include' is unsafe for cross-compilation [-Werror,-Wpoison-system-directories]
1 error generated.
make: *** [build/lib/vmm/intel/vmcs.o] Error 1

Any thoughts on how to resolve this? I tried Googling the error message, but didn't find any clear solutions.

Thanks,
Dale

After a combination of research, experimentation, and luck I managed to resolve the issue. First I resolved it by editing the Makefile and adding another -I flag to put the gcc include directory ahead of /usr/local/include. That got me past that problem, but then started giving me another error about #include_next being a language extension. Ultimately, I figured out that commenting out the flags set by CFLAGS_WARN actually solves both problems and allows the compilation to succeed.

# enable everything and then selectively disable some warnings
CFLAGS_WARN := \
#  -Weverything \
#  -Werror \
#  \
#  -Wno-dollar-in-identifier-extension \
#  -Wno-gnu-statement-expression \
#  -Wno-packed \
#  -Wno-padded \
#  -Wno-reserved-id-macro \
#  -Wno-unknown-warning-option \
#  -Wno-unused-macros \
#  -Wno-switch-enum
sab24 commented

This error isn't resolved, please reopen. Especially because you are not cross-compiling. This error should not occur.