Apple clang 9/libc++ errno.h
libc++ has added a redirection of errno.h, which causes problems with cotire. In application source specifying #include <errno.h>, cotire adds #include "/Library/Developer/CommandLineTools/usr/include/c++/v1/errno.h" to the _CXX_prefix.cxx file. This file (from libc++) then in-turn has the #include_next "errno.h" which silently fails during c++ -x;c++-header ..../_CXX_prefix.hxx -o ..._CXX_prefix.hcc.pch command. Then, since errno isn't available, all dependents fail to compile due to undefined symbol 'errno'.
Perhaps cotire shouldn't add absolute paths to headers found in /Library/Developer/CommandLineTools/usr/include/c++/v1/, since this is a system path anyway.
this is the same as https://github.com/sakra/cotire/issues/145
@todd-richmond I have fixed this locally with the following patch:
diff --git a/cotire.orig b/cotire.cmake
index 62cd23d..15c02e8 100644
--- a/cotire.orig
+++ b/cotire.cmake
@@ -1122,6 +1122,11 @@ function (cotire_parse_includes _language _scanOutput _ignoredIncludeDirs _honor
string (REPLACE ";" "\\;" _scanOutput "${_scanOutput}")
# then separate lines
string (REGEX REPLACE "\n" ";" _scanOutput "${_scanOutput}")
+ if ("${_language}" STREQUAL "CXX")
+ #Fix clang9's libc++ errno
+ message (STATUS "replacing <errno.h> with <cerrno>")
+ string (REGEX REPLACE "errno.h" "cerrno" _scanOutput "${_scanOutput}")
+ endif()
list (LENGTH _scanOutput _len)
# remove duplicate lines to speed up parsing
list (REMOVE_DUPLICATES _scanOutput)
Thx! - that fixes this problem (removed previous comment for my own bug). Defnitely merge the change
spoke too soon - did a make clean and the problem is still there. This seems like a general problem for every header that gets pulled in from the xcode dir instead of /usr/include.