On Jun 22, 2026, at 12:51, Kenneth Wolcott wrote:

> On Mon, Jun 22, 2026 at 10:40 AM Ryan Carsten Schmidt wrote:
> 
>> Kenneth Wolcott wrote:
>> 
>>> ld: warning: ignoring duplicate libraries: '-lgmp'
>>> ld: library 'gmp' not found
>>> clang: error: linker command failed with exit code 1 (use -v to see 
>>> invocation)
>> 
>> In those command line arguments I don't see -L/opt/local/lib to tell the 
>> linker where the gmp library is.
> 
> I'm sorry, I don't understand your reply.  Is my cmds.bash file
> lacking important content?

Oh, well the thread started with you wondering if something was wrong with gmp. 
The error message you got from building your go software was "ld: library 'gmp' 
not found". I was just pointing out that that doesn't necessarily mean there's 
anything wrong with gmp; it just means the linker doesn't know where the gmp 
library can be found. One way to tell the linker where the MacPorts gmp library 
is located is to pass the -L/opt/local/lib flag to the linker. In many build 
systems, one specifies what flags to pass to the linker via the LDFLAGS 
environment variable. For example, with a Makefile, one can often use:

LDFLAGS=-L/opt/local/lib make

However, I imagine your go software doesn't use a Makefile, so you may have to 
specify it in a different way. I haven't built any go software so I don't know 
how to do it there.

Looking in your cmds.bash file, I only see the commands Bill suggested you run 
as a diagnostic; I don't see the commands you used to build your go software. 
If you show us those commands, maybe someone can suggest how to modify them to 
add the right flags.


> BTW, the ls output was hard-coded as I
> could not figure out (me dumb) how to parse the output of 'port
> contents gmp' to derive the ls output.

Two quick and dirty ways to get ls -l output for a port's contents would be:

ls -l $(port -q contents gmp)
port -q contents gmp | xargs ls -l

These will work for gmp because it doesn't install any files whose paths 
contain special characters.

However the more robust method which handles any file paths would be:

port -q contents gmp | sed 's/^  //' | tr '\n' '\0' | xargs -0 ls -l

If you wanted a shortcut for this that you could use in your shell anytime, you 
could put this in your shell startup file (.zshrc, .zprofile, etc):

portll() {
        port -q contents "$@" | sed 's/^  //' | tr '\n' '\0' | xargs -0 ls -l
}

Then, after opening a new terminal, you could just use:

portll gmp


Reply via email to