GMP, math library, good question, note my posting showed confusion :-) On Sat, Sep 27, 2025 at 1:25 PM Felipe Gasper <[email protected]> wrote:
> Is that GIMP, or GNU GMP, a math library? > > > On Sep 27, 2025, at 15:51, Kenneth Wolcott <[email protected]> > wrote: > > > > > > Hi; > > > > confused about MacPorts GIMP libraries when using C as a library binding > language... > > > > So I have several GIMP-oriented ports: > > > > port installed | grep -i gmp > > gmp @6.3.0_0 (active) > > p5.34-alien-gmp @1.160.0_0 (active) > > p5.34-crypt-dh-gmp @0.0.120_0 (active) > > p5.34-math-bigint-gmp @1.700.300_0 (active) > > p5.34-math-bigint-gmpz @0.1.800_0 (active) > > p5.34-math-gmp @2.250.0_0 (active) > > p5.34-math-gmpf @0.530.0_0 (active) > > p5.34-math-gmpq @0.670.0_0 (active) > > p5.34-math-gmpz @0.670.0_0 (active) > > p5.34-math-prime-util-gmp @0.520.0_0 (active) > > R-gmp @0.7-5_0 (active) > > > > So is "gmp" the library or the executable or both? Apparently only the > library. But is it complete? > > > > Apparently I have several gmp C++ bindings (gmp, gmpc, gmpz, gmpq?) but > only one C gmp binding (gmp). So I can get a C++ gmpz binding to work > great but I cannot get a C gmpz created (please show me how). > > > > So, this is why the Pluto GMP library binding is failing; there is no > gmpz library to bind to (??) > > > > I see lots of Perl gmp bindings as ports; where is Perl getting its gmpz > from? > > > > Here's my attempt to build a Pluto GMP binding: > > > > #!/bin/bash > > > > # clang -c -fpic libpluto-gmp.c -I > /opt/homebrew/Cellar/gmp/6.3.0/include/ > > # clang -O3 -fpic -shared -o libpluto-gmp.dylib libpluto-gmp.o -lgmp -L > /opt/homebrew/Cellar/gmp/6.3.0/lib/ > > > > # clang -v -mmacosx-version-min=26.0 -c -fpic ./libpluto-gmp.c > > # clang -v -mmacosx-version-min=26.0 -O3 -fpic -shared -o > ../libpluto-gmp.dylib ./libpluto-gmp.o -lgmp -lgmpz > > > > # /opt/local/bin/gcc-mp-15 -v -c -fpic ./libpluto-gmp.c > > # /opt/local/bin/gcc-mp-15 -v -O3 -fpic -shared -lgmp -o > ../libpluto-gmp.dylib ./libpluto-gmp.o > > > > clang -v -c -fpic ./libpluto-gmp.c > > clang -v -O3 -fpic -shared -o ../libpluto-gmp.dylib ./libpluto-gmp.o > -lgmp > > rm ./libpluto-gmp.o > > > > Note that I do not have homebrew, but I'm including that to show that > apparently homebrew is providing a C-based gmpz library (this was provided > by a MacOS Sequoia (now Tahoe) arm64 homebrew Rosetta Code contributor). > > > > So, there's a Pluto RC library (written in Pluto) and a Pluto gmp > library binding (written in C). My building of the library binding is > apparently successful, but fails when run with the Pluto Rosetta Code task; > stating, basically, that the gmpz portion cannot be loaded. > > > > I don't think that this is a problem with the Rosetta Code Pluto task > code. > > > > I don't think that this is a problem with the Rosetta Code Pluto library. > > > > I don't think that this is a problem with the Rosetta Code Pluto library > gmp binding. > > > > I don't think that this is a problem with my compiling of the Rosetta > Code Pluto library gmp binding. (Please show me if I'm wrong). > > > > I think that there is a missing gmp library code MacPorts port (for C) > that contains mpz. Please show me that I'm wrong, and if so, show me what I > should be doing instead. > > > > To, me it looks bad that someone gets this to work seemlessly via > homebrew and I struggle via MacPorts. I feel like an idiot. > > > > Here's the results from running the Pluto task code: > > > > (cd Pluto/Fermat_Numbers; ./fermat_numbers.pluto) > > The first 10 fermat numbers are: > > F₀ = 3 > > F₁ = 5 > > F₂ = 17 > > F₃ = 257 > > F₄ = 65537 > > F₅ = 4294967297 > > F₆ = 18446744073709551617 > > F₇ = 340282366920938463463374607431768211457 > > F₈ = > 115792089237316195423570985008687907853269984665640564039457584007913129639937 > > F₉ = > 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084097 > > > > Factors of the first 9 Fermat numbers: > > /opt/pluto/v.0.12.0/bin/pluto: ./bignum.pluto:1391: failed to load > library './libpluto-gmp.dylib' > > stack traceback: > > [C]: in function 'pluto:ffi.open' > > ./bignum.pluto:1391: in field 'init' > > ./fermat_numbers.pluto:29: in main chunk > > [C]: in ? > > > > Thanks, > > Ken Wolcott > >
