Building GMP 5.0.2 & linking Nettle 2.4 to it (missing '__gmpz_getlimbn' symbol)

Morgan Aldridge morgant at makkintosshu.com
Tue Nov 8 13:34:11 CET 2011


I'm attempting to build GMP 5.0.2 and Nettle 2.4 on Mac OS X 10.5
Leopard Server and am running into the following issue which I am
hopeful you all can help with (or at least give me closure on the GMP
side). GMP built and installed successfully, as follows:

    curl -O ftp://ftp.gmplib.org/pub/gmp-5.0.2/gmp-5.0.2.tar.bz2
    tar xjf gmp-5.0.2.tar.bz2
    pushd gmp-5.0.2
    CC=gcc-4.2 CXX=g++4.2 ./configure --prefix=/usr/local
    make
    sudo make install
    popd

However, Nettle's `configure` fails to find the '__gmpz_getlimbn' symbol:

    configure:6469: checking for __gmpz_getlimbn in -lgmp
    configure:6494: gcc -o conftest -g -O2   conftest.c -lgmp   >&5
    ld warning: in /usr/local/lib/libgmp.dylib, file is not of
required architecture
    Undefined symbols:
      "___gmpz_getlimbn", referenced from:
          _main in ccNP0jza.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    configure:6494: $? = 1
    configure:6503: result: no
    configure:6514: WARNING: GNU MP not found, or not 3.1 or up, see
http://gmplib.org/.
    Support for public key algorithms will be unavailable.

Obviously, GMP 5.0.2 is newer than 3.1, plus both '__gmpz_getlimbn' &
'__gmpz_powm_sec' are defined in /usr/local/include/gmp.h. Running
`file /usr/local/lib/libgmp.dylib` returns the following, which is
correct for the Core 2 Duo processor this server is running (but that
was only a warning anyway):

    /usr/local/lib/libgmp.dylib: Mach-O 64-bit dynamically linked
shared library x86_64

Now, I had thought that `make check` had passed all the tests, but had
doubts, so re-checked everything. The following shows the last test
('mpbsd'; the only failure and which is okay to have failed because I
left it at the default of "--enable-mpbsd=no") and the final output:

    Making check in mpbsd
    make
    make[4]: Nothing to be done for `all'.
    make  check-TESTS
    ==================
    All 0 tests passed
    ==================
    Making check in mpn
    make[2]: Nothing to be done for `check'.
    Making check in mpz
    make[2]: Nothing to be done for `check'.
    Making check in mpq
    make[2]: Nothing to be done for `check'.
    Making check in mpf
    make[2]: Nothing to be done for `check'.
    Making check in printf
    make[2]: Nothing to be done for `check'.
    Making check in scanf
    make[2]: Nothing to be done for `check'.
    Making check in cxx
    make[2]: Nothing to be done for `check'.
    Making check in mpbsd
    make[2]: Nothing to be done for `check'.
    Making check in demos
    Making check in calc
    make  check-am
    make[4]: Nothing to be done for `check-am'.
    Making check in expr
    make[3]: Nothing to be done for `check'.
    make[3]: Nothing to be done for `check-am'.
    Making check in tune
    make[2]: Nothing to be done for `check'.
    Making check in doc
    make[2]: Nothing to be done for `check'.

I'm assuming that the messages that follow the mpbsd test are just
leftover messages from all the individual tests (hence the "Nothing to
be done for..,", correct? Here's the 'mpz' check which seems to pass
with flying colors:

    Making check in mpz
    make  t-addsub t-cmp t-mul t-mul_i t-tdiv t-tdiv_ui t-fdiv
t-fdiv_ui t-cdiv_ui t-gcd t-gcd_ui t-lcm dive dive_ui t-sqrtrem
convert io t-inp_str logic bit t-powm t-powm_ui t-pow t-div_2exp reuse
t-root t-perf sqr t-perfpow t-jac t-bin t-get_d t-get_d_2exp t-get_si
t-set_d t-set_si t-fac_ui t-fib_ui t-lucnum_ui t-scan t-fits t-divis
t-divis_2exp t-cong t-cong_2exp t-sizeinbase t-set_str t-aorsmul
t-cmp_d t-cmp_si t-hamdist t-oddeven t-popcount t-set_f t-io_raw
t-import t-export t-pprime_p t-nextprime
    make  check-TESTS
    PASS: t-addsub
    PASS: t-cmp
    PASS: t-mul
    PASS: t-mul_i
    PASS: t-tdiv
    PASS: t-tdiv_ui
    PASS: t-fdiv
    PASS: t-fdiv_ui
    PASS: t-cdiv_ui
    PASS: t-gcd
    PASS: t-gcd_ui
    PASS: t-lcm
    PASS: dive
    PASS: dive_ui
    PASS: t-sqrtrem
    PASS: convert
    PASS: io
    PASS: t-inp_str
    PASS: logic
    PASS: bit
    PASS: t-powm
    PASS: t-powm_ui
    PASS: t-pow
    PASS: t-div_2exp
    PASS: reuse
    PASS: t-root
    PASS: t-perfsqr
    PASS: t-perfpow
    PASS: t-jac
    PASS: t-bin
    PASS: t-get_d
    PASS: t-get_d_2exp
    PASS: t-get_si
    PASS: t-set_d
    PASS: t-set_si
    PASS: t-fac_ui
    PASS: t-fib_ui
    PASS: t-lucnum_ui
    PASS: t-scan
    PASS: t-fits
    PASS: t-divis
    PASS: t-divis_2exp
    PASS: t-cong
    PASS: t-cong_2exp
    PASS: t-sizeinbase
    PASS: t-set_str
    PASS: t-aorsmul
    PASS: t-cmp_d
    PASS: t-cmp_si
    PASS: t-hamdist
    PASS: t-oddeven
    PASS: t-popcount
    PASS: t-set_f
    PASS: t-io_raw
    PASS: t-import
    PASS: t-export
    PASS: t-pprime_p
    PASS: t-nextprime
    ===================
    All 58 tests passed
    ===================

I was concerned that maybe GMP wasn't being linked against zlib. I
couldn't find a configuration option (or even a check) for zlib, so I
tried configuring as follows in the hopes that it'd link against the
built-in zlib:

    CC=gcc-4.2 CXX=g++4.2 CPPFLAGS="-I/usr/include"
LDFLAGS="-L/usr/lib" LIBS="-lz" ./configure --prefix=/usr/local

No `make` failures, `make check` still has the same output, and
Nettle's `configure --prefix=/usr/local` still fails.

I'd greatly appreciate any hints, suggestions, or solutions you all
may have to help me resolve this. Or, if everything I've described
here confirms that GMP has been built & installed correctly, then I'll
go back to bugging the Nettle developer (very helpful, BTW, I just
don't want pester if my problem lies elsewhere).

Thanks,

Morgan
---
http://makkintosshu.com/
http://seriesparts.com/
http://rikuwoiku.com/
http://unna.org/


More information about the gmp-discuss mailing list