clang++ Include File Search Question
I am running Catalina 10.15.7, Xcode 12.4, Command Line Tools 12.4
and I am trying to build Octave from source.
I am getting clang++ compiler errors because the compiler is bringing in 'math.h' from /usr/local/include instead of /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include.
In file included from libinterp/dldfcn/__delaunayn__.cc:54:
In file included from ./liboctave/array/dMatrix.h:31:
In file included from liboctave/numeric/DET.h:33:
In file included from liboctave/numeric/lo-mappers.h:35:
./liboctave/util/lo-ieee.h:78:53: error: expected unqualified-id
inline int __lo_ieee_isnan (double x) { return std::isnan (x); }
^
/usr/local/include/math.h:165:5: note: expanded from macro 'isnan'
( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x))
$ ls -l /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
total 0
lrwxr-xr-x 1 root wheel 14 Feb 27 10:28 MacOSX.sdk -> MacOSX11.1.sdk
drwxr-xr-x@ 6 davidlaxer staff 192 Sep 27 07:55 MacOSX10.11.sdk
drwxr-xr-x 8 root wheel 256 Feb 27 10:36 MacOSX10.15.sdk
drwxr-xr-x 7 root wheel 224 Feb 27 10:33 MacOSX11.1.sdk
$ xcode-select -p
/Library/Developer/CommandLineTools
$ xcrun -show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
export CFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk"
export CCFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk"
export CXXFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk"
export CPPFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk"
export CXXFLAGS="-std=c++11 -stdlib=libc++ $CXXFLAGS"
export CPPFLAGS="-std=c++11 -stdlib=libc++ $CPPFLAGS"
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
export CCLD=/usr/bin/clang
export CXXLD=/usr/bin/clang++
export DEVELOPER_DIR=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
Any idea why clang++ is accessing /usr/local/include before /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include?
I tried various clang++ flags (e.g. -nostdinc++), but it broke ./configure.
MacBook Pro 15″, macOS 10.15