[odb-users] Re: macOS Sonoma Include (and Lib?) Issues

Brian E. Coggins becoggins at hotmail.com
Tue Dec 5 23:26:39 EST 2023


Upon further review, I’m thinking that exporting SYSROOT may have helped.  I’m no longer getting errors for ordinary C/C++ standard library headers; instead, all of the errors building odb look like this, and specifically involve gmp.h being invoked from system.h:

...
error: process g++-13 exited with code 1
  info: command line: g++-13 -I/Users/brian/Software/odb-build/odb-gcc-13/odb-2.5.0-b.25/odb/pregenerated -I/Users/brian/Software/odb-build/odb-gcc-13/odb-2.5.0-b.25 -I/Users/brian/Software/odb-build/odb-gcc-13/odb-2.5.0-b.25 -I/usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc/x86_64-apple-darwin23/13/plugin/include -DODB_GXX_NAME="g++-13" -DODB_BUILD2 -I/Users/brian/Software/odb-build/odb-gcc-13/libcutl-1.11.0-b.9+1 -I/Users/brian/Software/odb-build/odb-gcc-13/libcutl-1.11.0-b.9+1 -DLIBCUTL_SHARED -I/Users/brian/Software/odb-build/odb-gcc-13/libstudxml-1.1.0-b.10+2 -I/Users/brian/Software/odb-build/odb-gcc-13/libstudxml-1.1.0-b.10+2 -DLIBSTUDXML_SHARED -O3 -std=c++23 -fdiagnostics-color -finput-charset=UTF-8 -o odb-2.5.0-b.25/odb/source.dylib.o -c -x c++ /Users/brian/Software/odb-build/odb-gcc-13/odb-2.5.0-b.25/odb/source.cxx
  info: while updating odb-2.5.0-b.25/odb/objs{source}
  info: while updating odb-2.5.0-b.25/odb/libus{odb}
  info: while updating odb-2.5.0-b.25/odb/plugin{odb}
  info: while updating odb-2.5.0-b.25/dir{odb/}
  info: while updating dir{odb-2.5.0-b.25/}
c++ odb-2.5.0-b.25/odb/cxx{common} -> odb-2.5.0-b.25/odb/objs{common}
In file included from /Users/brian/Software/odb-build/odb-gcc-13/odb-2.5.0-b.25/odb/gcc-fwd.hxx:24,
                 from /Users/brian/Software/odb-build/odb-gcc-13/odb-2.5.0-b.25/odb/context.hxx:7,
                 from /Users/brian/Software/odb-build/odb-gcc-13/odb-2.5.0-b.25/odb/common.hxx:12,
                 from /Users/brian/Software/odb-build/odb-gcc-13/odb-2.5.0-b.25/odb/common.cxx:4:
/usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc/x86_64-apple-darwin23/13/plugin/include/system.h:703:10: fatal error: gmp.h: No such file or directory
  703 | #include <gmp.h>
      |          ^~~~~~~
compilation terminated.
…


Thoughts?

(I also realize I may not have been completely clear in my original message.  The problem wasn't that gcc couldn't find headers like iostream and needed a -I flag; homebrew g++-13 can find those out of the box.  Rather, the problem is that those headers are stubs that invoke system headers in the Apple SDK, and homebrew gcc didn’t seem to know how to find that Apple SDK.  I think the export SYSROOT trick may have solved that for most of the headers.  Except, evidently, this gmp.h, whatever that is.)



> On 05 Dec 2023, at 21:44, Brian E. Coggins <becoggins at hotmail.com> wrote:
> 
> Hi friends,
> 
> Another macOS upgrade, another set of annoying problems with finding system headers.  Sonoma’s clang++ removed some deprecated C++ stuff, breaking my installed version of boost, upgrading boost in homebrew for some reason forced an irreversible gcc update that prevented my old compilation of odb from finding its dynamic libraries, so now I’m trying to recompile odb…and g++-13 can’t find the system headers (and probably libraries, too, but I haven’t gotten that far).  As many of us know, Apple has been making this harder and harder with each update, for reasons that are impossible for us mortals to understand.
> 
> Questions:
> 
> 1.  Does anybody know of a nice and clean solution for the whole system that would allow g++-13 to find the headers with no special magic?  It would be brilliant if homebrew gcc knew how to invoke xcrun, but my installation doesn’t seem to know how to do this.  Maybe I’m doing something wrong.  Any advice appreciated.
> 
> 2.  One web post suggested
> 
> export SDKROOT="`xcrun --show-sdk-path`”
> 
> which does brilliantly solve the problem for that terminal session, and can go in .bashrc to make lots of things smooth.  However, bpkg doesn’t pay attention to this.  I imagine there’s some incantation that could be added to my "bpkg create” call to get the right directories added in?  Can anyone share what that might be?
> 
> Thanks,
> Brian
> 




More information about the odb-users mailing list