Using Macports' gcc8 to build C programs and libraries

Andrew Udvare audvare at gmail.com
Mon Apr 1 09:18:59 UTC 2019



> On 2019-04-01, at 05:10, Sean Lake <odysseus9672 at gmail.com> wrote:
> 
> In file included from MWReddening.c:1:
> /opt/local/lib/gcc8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/math.h:45:10:fatal
> error: sys/cdefs.h: No such file or directory
> #include <sys/cdefs.h>
>          ^~~~~~~~~~~~~

You should have this file at:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h

Assuming GCC 8 can use Apple's headers, add:

-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include

> 
> Looking for similar errors on the web, I get pages like this
> 
> https://stackoverflow.com/questions/31045721/c-compiler-error-cdefs-h-not-found
> 
> that recommend installing a libc package. Will a similar solution work
> in Macports? If so, which package(s)? If not, will modifying my CFLAGS
> and LDFLAGS suffice? Currently, I have included "-I/opt/local/include"
> in CFLAGS and "-L/opt/local/lib" in LDFLAGS, but that's obviously not
> enough (or wrong).


There are some (dated) libc* packages. Run `port search 'Library for cross-platform C'`.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20190401/bc60ea92/attachment.sig>


More information about the macports-users mailing list