Setting system gcc when `port select --set gcc app-gcc*` is set

Chris Jones jonesc at hep.phy.cam.ac.uk
Thu Oct 3 18:28:29 UTC 2019


Hi,

> On 3 Oct 2019, at 6:50 pm, Steven Smith <steve.t.smith at gmail.com> wrote:
> 
> I have a build failure on a system with `port select --set gcc mp-gcc9` set:
> 
>> :info:build /opt/local/lib/gcc9/gcc/x86_64-apple-darwin18/9.2.0/include-fixed/ma
>> th.h:45:10: error:
>> :info:build      fatal error: sys/cdefs.h: No such file or directory
>> :info:build        45 | #include <sys/cdefs.h>
>> :info:build           |          ^~~~~~~~~~~~~
> 
> 
> This is with the port hlint, which uses port group haskell_cabal:
> https://github.com/macports/macports-ports/blob/master/_resources/port1.0/group/haskell_cabal-1.0.tcl
> 
> The build works if I make sure that “gcc” points to /usr/bin/gcc.
> 
> How should this be done in MacPorts to avoid this issue? I just want to make sure that the native system gcc is used, not the MacPorts gcc.

The build needs to be configured to use a fully specified compiler, with the full path, rather than relying on whatever it happens to pick up via the PATH env var, which is the only way a port select setting can have an impact on a port build.

B.t.w. MacOS no long really has gcc, at least on all but now ancient OS versions. /usr/bin/gcc is really just a convenience wrapper around the system clang compiler...

Chris

> 
> We’re already setting these compiler options in haskell_cabal:
> 
>> compiler.library_path
>> compiler.cpath
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20191003/710cc014/attachment-0001.html>


More information about the macports-dev mailing list