stdlib.h compilation error for macports gcc9.

Carlo Tambuatco oraclmaster at gmail.com
Sun Feb 7 22:24:40 UTC 2021


Well what's odd is I'm only getting this error after upgrading to the
latest macports gcc9. Indeed when I use the XCode provided clang version of
gcc, it finds all the required libraries. My CPATH environment variable was
sufficient to specify the locations of the libraries before the upgrade, so
the question is, what changed post-upgrade?

On Sun, Feb 7, 2021, 5:03 PM Chris Jones <jonesc at hep.phy.cam.ac.uk> wrote:

>
> It sounds like your builds are not correctly specifying the SDK gcc is to
> use. There are a number of ways you can do this, either by pass it via a
> compiler flag, by running the complication through xcrun, or by setting the
> SDKROOT variables to the required path.
>
> Cheers Chris
>
> > On 7 Feb 2021, at 9:25 pm, Carlo Tambuatco <oraclmaster at gmail.com>
> wrote:
> >
> > I don’t know if this is a result of updating to the latest macports
> gcc9, or the update of XCode, but
> > all of a sudden when I try to build my C++ program which includes
> <cstdio> I get this strange
> > chain reaction of errors.
> >
> > In file included from
> /opt/local/include/gcc9/c++/ext/string_conversions.h:41,
> >                 from
> /opt/local/include/gcc9/c++/bits/basic_string.h:6493,
> >                 from /opt/local/include/gcc9/c++/string:55,
> >                 from
> /opt/local/include/gcc9/c++/bits/locale_classes.h:40,
> >                 from /opt/local/include/gcc9/c++/bits/ios_base.h:41,
> >                 from /opt/local/include/gcc9/c++/ios:42,
> >                 from /opt/local/include/gcc9/c++/ostream:38,
> >                 from /opt/local/include/gcc9/c++/iostream:39,
> >                 from ../../standard_includes.h:1,
> >                 from E2.5.2.cpp:1:
> > /opt/local/include/gcc9/c++/cstdlib:75:15: fatal error: stdlib.h: No
> such file or directory
> >   75 | #include_next <stdlib.h>
> >
> >
> > From my makefile this seems to be the offending includes statement:
> >
> > #include <iostream>
> > #include <cstdio>
> >
> >
> > I’ve googled and it seems that it can’t find stdlib.h, even though it is
> on my CPATH environment variable:
> >
> > export
> CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include:/usr/local/include:/opt/local/include:/usr/local/dart-sdk/include:/Library/Frameworks/R.framework/Resources/include
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20210207/11d660ac/attachment.htm>


More information about the macports-users mailing list