Hi Ryan, Bill...

  I got a response from the submitter of the Rosetta Code Go task in
question.  He is puzzled why it is not working. [ So am I :-) ] He
said that no changes had occurred that he is aware of that have any
pertinence. This guy (PureFox) is one of the premier Rosetta Code
experts (very helpful, very patient and very knowledgeable) so when he
is puzzled it is indeed puzzling.  Which generally means that it is I
who has messed up :-)

  This Go+GMP+GO_GMP_wrapper has worked fine for me in the past with
other Rosetta Code tasks written in Go. The build process as
illustrated by "go help" and "go [cmd] help" do not expand to anything
regarding compile and/or linkage flags.  Perhaps I should look deeper
than just "go help" and friends :-)

Generally, what is in the import section of the go program is acted on
by the following commands:
/opt/local/bin/go mod init example.com/m/v2
/opt/local/bin/go mod tidy
/opt/local/bin/go run ./file.go
--or-
/opt/local/bin/go build ./file.go

I looked at the Go Gmp module on GitHub and there is nothing really
more to learn about the usage than what I already know.

I do not recall what has changed on my end with regards to MacPorts
"go" and "gmp" ports other than the usual self update and upgrade
dance.

I still have a problem with C++ (via clang++) and Gmp that I did not
have before (since the last very helpful email exchange previously, [a
year ago?], with Ryan)...this one I still am researching...

Thanks,
Ken Wolcott

On Mon, Jun 22, 2026 at 12:12 PM Kenneth Wolcott
<[email protected]> wrote:
>
> Thank you very much! That is definitely useful.  Awesome!
>
> I think that the Go problem (a Rosetta Code task) is probably an aged
> Go GMP module wrapper, which I've made a query on Rosetta Code about.
>
> I'm still investigating my C++ GMP issue.
>
> Ken Wolcott
>
> On Mon, Jun 22, 2026 at 12:03 PM Ryan Carsten Schmidt
> <[email protected]> wrote:
> >
> > 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