https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90330
--- Comment #21 from Matt Thompson <matthew.thompson at nasa dot gov> --- (In reply to Iain Sandoe from comment #20) > (In reply to Iain Sandoe from comment #19) > > (In reply to Matt Thompson from comment #17) > > > > > > Now, I'm not sure that gcc itself needs /usr/include, but many of the > > > libraries and more I compile with gcc seem to assume it. And I've gotten > > > to > > > the point where I just couldn't figure out how to pass '-isysroot' down to > > > code like f2py (gcc is called by f2py but f2py only passes down Fortran > > > flags. And I just *cannot* get our CMake system to pass > > > CFLAGS='-isysroot...' to the gcc call within f2py). > > Packages that assume /usr/include should "just work" with the sysrooted > compiler without any extra magic (I build LLVM and its associated things > with GCC and a sysroot all the time). cmake can take a > CMAKE_OSX_SYSROOT=/path/to/sysroot if you need to be explicit. > > otherwise, I'd expect it to honour CMAKE_CFLAGS= and CMAKE_CXXFLAGS= (but...) Iain, Oh, no, CMake is smart. It's f2py that isn't smart. It doesn't really understand its own environment. CMake is smart and sees it's on Darwin and does CMAKE_OSX_SYSROOT so it uses it in all the C code it compiles. The problem is f2py deep in its own code base is calling $CC and it is too removed from the CMake system. Running CFLAGS='-isysroot...' f2py does work, but CMake is munging the freaking call so it gets things like: CFLAGS='\-isysroot \'/Library...' and I'm not enough of a CMake guru to fix it. Luckily, my boss (who is) will be back from travel soon.