[MacPorts] #72380: gh: Unable to build on High Sierra - invalid value "'-Wl, -headerpad_max_install_names" for flag -extldflags: unterminated ' string
MacPorts
noreply at macports.org
Mon Apr 21 22:32:11 UTC 2025
#72380: gh: Unable to build on High Sierra - invalid value
"'-Wl,-headerpad_max_install_names" for flag -extldflags: unterminated '
string
-------------------------+-------------------------
Reporter: RobK88 | Owner: herbygillot
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version: 2.10.5
Resolution: | Keywords: highsierra
Port: gh, golang |
-------------------------+-------------------------
Changes (by ryandesign):
* port: gh => gh, golang
Comment:
Replying to [comment:1 RobK88]:
> You will see that there is a single quote that is never terminated....
Sure, that's what the message makes it sound like. It's clearly being
terminated though if you look in the log.
The log makes it look like single quotes are used for both inner and outer
quoting:
{{{
:debug:build
BOOT_GO_LDFLAGS='-extldflags='-Wl,-headerpad_max_install_names
-L/opt/local/lib -lMacportsLegacySupport''
}}}
{{{
:debug:build GO_LDFLAGS='-extldflags='-Wl,-headerpad_max_install_names
-L/opt/local/lib -lMacportsLegacySupport -arch x86_64''
}}}
However that is just an artifact of the [https://github.com/macports
/macports-
base/blob/0a2b4687620912c4379a6c7deb0a1257d9bc6928/src/port1.0/portutil.tcl#L899
MacPorts base debug code that displays environment variables] and isn't
really the problem here. The value of the `GO_LDFLAGS` environment
variable here, for example, is in fact
`-extldflags='-Wl,-headerpad_max_install_names -L/opt/local/lib
-lMacportsLegacySupport -arch x86_64'` (no second set of surrounding
quotes).
The problem is happening because something, somewhere, is not quoting a
value properly. I don't know how go build systems work so I don't know
whether the problem is in the golang portgroup, the gh port, the go port,
or elsewhere.
The code that adds these environment variables is not in the gh port; it's
[https://github.com/macports/macports-
ports/blob/fc48317b24200dd0dbaf30adb25bbe1074efe8ce/_resources/port1.0/group/golang-1.0.tcl#L217-L223
in the golang portgroup]. For one thing, that code uses literal single
quotes to enclose the contents of variables, which won't work if those
variables' values contain single quotes. That may not be the problem here
but the portgroup should still use the `shellescape` proc instead of doing
manual quoting with literal single quotes.
--
Ticket URL: <https://trac.macports.org/ticket/72380#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list