[MacPorts] #71707: libtool (GNU) hardcodes CC and LD, which breaks building some ports

MacPorts noreply at macports.org
Wed Jan 1 16:44:23 UTC 2025


#71707: libtool (GNU) hardcodes CC and LD, which breaks building some ports
---------------------------+--------------------
  Reporter:  barracuda156  |      Owner:  (none)
      Type:  defect        |     Status:  new
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:  2.10.5
Resolution:                |   Keywords:
      Port:  libtool       |
---------------------------+--------------------

Comment (by barracuda156):

 I was able to force the correct behavior of picking MacPorts-chosen
 compiler at linking time by the following:

 1. In `libtool` portfile:

 {{{
 post-destroot {
     reinplace "s|\"/usr/bin/gcc-4.2 -std=gnu99\"|\$CC|g"
 ${destroot}${prefix}/bin/glibtool
     reinplace "s|\"/usr/bin/g++-4.2\"|\$CXX|g"
 ${destroot}${prefix}/bin/glibtool
 }}}

 2. In a dependent portfile:

 {{{
 build.cmd-prepend   CC=${configure.cc} \
                     CXX=${configure.cxx}
 }}}
 Picking from env does not work, apparently, because
 `/opt/local/bin/glibtool` uses `\$CC` and `\CXX` in the script.

 This is obviously a hack, as it is, but at least I get sane linking,
 finally.

-- 
Ticket URL: <https://trac.macports.org/ticket/71707#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list