Problems compiling GMP from source (seg fault on make test)
Simon Burnet
simbur at yahoo.com
Fri Mar 23 21:00:22 CET 2012
On my Debian 6.0.4 AMD 64 system (just installed yesterday), GMP v5.0.4 (downloaded from gmplib.org, not patched or modified at all) compiles with no issues, but the "make check" subsequently fails.
I'm trying to create a sort of minimal compiler system, but with newer versions of libraries. The configure I'm running is the following:
LDFLAGS="-L$1/lib" CFLAGS="-I$1/include" CPPFLAGS="-I$1/include" ./configure --prefix="$1"
This is run from a script: $1 is the directory I'm building all the tools into.
This was all working until yesterday -- I was using a similar Debian system, but only 32-bit. As of yesterday, I moved to compile everything as 64-bit, and hence installed the 64-bit variant.
The 'make' completes with no errors:
libtool: link: ln mpn/remove.o .libs/libgmp.lax/lt104-remove.o || cp mpn/remove.o .libs/libgmp.lax/lt104-remove.o
libtool: link: ar cq .libs/libgmp.a assert.o compat.o errno.o extract-dbl.o invalid.o memory.o mp_bpl.o mp_clz_tab.o mp_dv_tab.o mp_minv_tab.o mp_get_fns.o mp_set_fns.o rand.o randclr.o randdef.o randiset.o randlc2s.o randlc2x.o randmt.o randmts.o rands.o randsd.o randsdui.o randbui.o randmui.o version.o nextprime.o tal-reent.o mpf/init.o mpf/init2.o mpf/inits.o mpf/set.o mpf/set_ui.o mpf/set_si.o mpf/set_str.o mpf/set_d.o mpf/set_z.o mpf/iset.o mpf/iset_ui.o mpf/iset_si.o mpf/iset_str.o mpf/iset_d.o mpf/clear.o mpf/clears.o mpf/get_str.o mpf/dump.o mpf/size.o mpf/eq.o mpf/reldiff.o mpf/sqrt.o mpf/random2.o mpf/inp_str.o mpf/out_str.o mpf/add.o mpf/add_ui.o mpf/sub.o mpf/sub_ui.o mpf/ui_sub.o mpf/mul.o mpf/mul_ui.o mpf/div.o mpf/div_ui.o mpf/cmp.o mpf/cmp_d.o mpf/cmp_ui.o mpf/cmp_si.o mpf/mul_2exp.o mpf/div_2exp.o mpf/abs.o mpf/neg.o mpf/set_q.o mpf/get_d.o mpf/get_d_2exp.o mpf/set_dfl_prec.o mpf/set_prc.o mpf/set_prc_raw.o mpf/get_dfl_prec.o
mpf/get_prc.o mpf/ui_div.o mpf/sqrt_ui.o mpf/ceilfloor.o mpf/trunc.o mpf/pow_ui.o mpf/urandomb.o mpf/swap.o mpf/fits_sint.o mpf/fits_slong.o mpf/fits_sshort.o mpf/fits_uint.o mpf/fits_ulong.o mpf/fits_ushort.o mpf/get_si.o mpf/get_ui.o mpf/int_p.o .libs/libgmp.lax/lt1-abs.o .libs/libgmp.lax/lt2-add.o .libs/libgmp.lax/lt3-add_ui.o mpz/aorsmul.o mpz/aorsmul_i.o mpz/and.o mpz/array_init.o mpz/bin_ui.o mpz/bin_uiui.o mpz/cdiv_q.o mpz/cdiv_q_ui.o mpz/cdiv_qr.o mpz/cdiv_qr_ui.o mpz/cdiv_r.o mpz/cdiv_r_ui.o mpz/cdiv_ui.o mpz/cfdiv_q_2exp.o mpz/cfdiv_r_2exp.o .libs/libgmp.lax/lt4-clear.o .libs/libgmp.lax/lt5-clears.o mpz/clrbit.o .libs/libgmp.lax/lt6-cmp.o .libs/libgmp.lax/lt7-cmp_d.o .libs/libgmp.lax/lt8-cmp_si.o .libs/libgmp.lax/lt9-cmp_ui.o mpz/cmpabs.o mpz/cmpabs_d.o mpz/cmpabs_ui.o mpz/com.o mpz/combit.o mpz/cong.o mpz/cong_2exp.o mpz/cong_ui.o mpz/divexact.o mpz/divegcd.o mpz/dive_ui.o mpz/divis.o mpz/divis_ui.o mpz/divis_2exp.o
.libs/libgmp.lax/lt10-dump.o mpz/export.o mpz/fac_ui.o mpz/fdiv_q.o mpz/fdiv_q_ui.o mpz/fdiv_qr.o mpz/fdiv_qr_ui.o mpz/fdiv_r.o mpz/fdiv_r_ui.o mpz/fdiv_ui.o mpz/fib_ui.o mpz/fib2_ui.o .libs/libgmp.lax/lt11-fits_sint.o .libs/libgmp.lax/lt12-fits_slong.o .libs/libgmp.lax/lt13-fits_sshort.o .libs/libgmp.lax/lt14-fits_uint.o .libs/libgmp.lax/lt15-fits_ulong.o .libs/libgmp.lax/lt16-fits_ushort.o mpz/gcd.o mpz/gcd_ui.o mpz/gcdext.o .libs/libgmp.lax/lt17-get_d.o .libs/libgmp.lax/lt18-get_d_2exp.o .libs/libgmp.lax/lt19-get_si.o .libs/libgmp.lax/lt20-get_str.o .libs/libgmp.lax/lt21-get_ui.o mpz/getlimbn.o mpz/hamdist.o mpz/import.o .libs/libgmp.lax/lt22-init.o .libs/libgmp.lax/lt23-init2.o .libs/libgmp.lax/lt24-inits.o mpz/inp_raw.o .libs/libgmp.lax/lt25-inp_str.o mpz/invert.o mpz/ior.o .libs/libgmp.lax/lt26-iset.o .libs/libgmp.lax/lt27-iset_d.o .libs/libgmp.lax/lt28-iset_si.o .libs/libgmp.lax/lt29-iset_str.o .libs/libgmp.lax/lt30-iset_ui.o mpz/jacobi.o
mpz/kronsz.o mpz/kronuz.o mpz/kronzs.o mpz/kronzu.o mpz/lcm.o mpz/lcm_ui.o mpz/lucnum_ui.o mpz/lucnum2_ui.o mpz/millerrabin.o mpz/mod.o .libs/libgmp.lax/lt31-mul.o .libs/libgmp.lax/lt32-mul_2exp.o mpz/mul_si.o .libs/libgmp.lax/lt33-mul_ui.o mpz/n_pow_ui.o .libs/libgmp.lax/lt34-neg.o .libs/libgmp.lax/lt35-nextprime.o mpz/out_raw.o .libs/libgmp.lax/lt36-out_str.o mpz/perfpow.o mpz/perfsqr.o mpz/popcount.o .libs/libgmp.lax/lt37-pow_ui.o mpz/powm.o mpz/powm_sec.o mpz/powm_ui.o mpz/pprime_p.o mpz/random.o .libs/libgmp.lax/lt38-random2.o mpz/realloc.o mpz/realloc2.o mpz/remove.o mpz/root.o mpz/rootrem.o mpz/rrandomb.o mpz/scan0.o mpz/scan1.o .libs/libgmp.lax/lt39-set.o .libs/libgmp.lax/lt40-set_d.o mpz/set_f.o .libs/libgmp.lax/lt41-set_q.o .libs/libgmp.lax/lt42-set_si.o .libs/libgmp.lax/lt43-set_str.o .libs/libgmp.lax/lt44-set_ui.o mpz/setbit.o .libs/libgmp.lax/lt45-size.o mpz/sizeinbase.o .libs/libgmp.lax/lt46-sqrt.o mpz/sqrtrem.o .libs/libgmp.lax/lt47-sub.o
.libs/libgmp.lax/lt48-sub_ui.o .libs/libgmp.lax/lt49-swap.o mpz/tdiv_ui.o mpz/tdiv_q.o mpz/tdiv_q_2exp.o mpz/tdiv_q_ui.o mpz/tdiv_qr.o mpz/tdiv_qr_ui.o mpz/tdiv_r.o mpz/tdiv_r_2exp.o mpz/tdiv_r_ui.o mpz/tstbit.o mpz/ui_pow_ui.o .libs/libgmp.lax/lt50-ui_sub.o .libs/libgmp.lax/lt51-urandomb.o mpz/urandomm.o mpz/xor.o .libs/libgmp.lax/lt52-abs.o mpq/aors.o mpq/canonicalize.o .libs/libgmp.lax/lt53-clear.o .libs/libgmp.lax/lt54-clears.o .libs/libgmp.lax/lt55-cmp.o .libs/libgmp.lax/lt56-cmp_si.o .libs/libgmp.lax/lt57-cmp_ui.o .libs/libgmp.lax/lt58-div.o .libs/libgmp.lax/lt59-get_d.o mpq/get_den.o mpq/get_num.o .libs/libgmp.lax/lt60-get_str.o .libs/libgmp.lax/lt61-init.o .libs/libgmp.lax/lt62-inits.o .libs/libgmp.lax/lt63-inp_str.o mpq/inv.o mpq/md_2exp.o .libs/libgmp.lax/lt64-mul.o .libs/libgmp.lax/lt65-neg.o .libs/libgmp.lax/lt66-out_str.o .libs/libgmp.lax/lt67-set.o mpq/set_den.o mpq/set_num.o .libs/libgmp.lax/lt68-set_si.o .libs/libgmp.lax/lt69-set_str.o
.libs/libgmp.lax/lt70-set_ui.o mpq/equal.o .libs/libgmp.lax/lt71-set_z.o .libs/libgmp.lax/lt72-set_d.o .libs/libgmp.lax/lt73-set_f.o .libs/libgmp.lax/lt74-swap.o mpn/fib_table.o mpn/mp_bases.o .libs/libgmp.lax/lt75-add.o mpn/add_1.o mpn/add_n.o .libs/libgmp.lax/lt76-sub.o mpn/sub_1.o mpn/sub_n.o .libs/libgmp.lax/lt77-neg.o .libs/libgmp.lax/lt78-com.o mpn/mul_1.o mpn/addmul_1.o mpn/submul_1.o mpn/lshift.o mpn/rshift.o mpn/dive_1.o mpn/diveby3.o .libs/libgmp.lax/lt79-divis.o mpn/divrem.o mpn/divrem_1.o mpn/divrem_2.o .libs/libgmp.lax/lt80-fib2_ui.o mpn/mod_1.o mpn/mod_34lsub1.o mpn/mode1o.o mpn/pre_mod_1.o .libs/libgmp.lax/lt81-dump.o mpn/mod_1_1.o mpn/mod_1_2.o mpn/mod_1_3.o mpn/mod_1_4.o mpn/lshiftc.o .libs/libgmp.lax/lt82-mul.o mpn/mul_fft.o mpn/mul_n.o mpn/sqr.o mpn/mul_basecase.o mpn/sqr_basecase.o mpn/nussbaumer_mul.o .libs/libgmp.lax/lt83-random.o .libs/libgmp.lax/lt84-random2.o mpn/pow_1.o .libs/libgmp.lax/lt85-rootrem.o
.libs/libgmp.lax/lt86-sqrtrem.o .libs/libgmp.lax/lt87-get_str.o .libs/libgmp.lax/lt88-set_str.o .libs/libgmp.lax/lt89-scan0.o .libs/libgmp.lax/lt90-scan1.o .libs/libgmp.lax/lt91-popcount.o .libs/libgmp.lax/lt92-hamdist.o .libs/libgmp.lax/lt93-cmp.o .libs/libgmp.lax/lt94-perfsqr.o .libs/libgmp.lax/lt95-perfpow.o mpn/gcd_1.o .libs/libgmp.lax/lt96-gcd.o mpn/gcdext_1.o .libs/libgmp.lax/lt97-gcdext.o mpn/gcd_lehmer.o mpn/gcd_subdiv_step.o mpn/gcdext_lehmer.o mpn/gcdext_subdiv_step.o mpn/div_q.o .libs/libgmp.lax/lt98-tdiv_qr.o mpn/jacbase.o .libs/libgmp.lax/lt99-get_d.o mpn/matrix22_mul.o mpn/hgcd2.o mpn/hgcd.o mpn/mullo_n.o mpn/mullo_basecase.o mpn/toom22_mul.o mpn/toom32_mul.o mpn/toom42_mul.o mpn/toom52_mul.o mpn/toom62_mul.o mpn/toom33_mul.o mpn/toom43_mul.o mpn/toom53_mul.o mpn/toom63_mul.o mpn/toom44_mul.o mpn/toom6h_mul.o mpn/toom6_sqr.o mpn/toom8h_mul.o mpn/toom8_sqr.o mpn/toom_couple_handling.o mpn/toom2_sqr.o mpn/toom3_sqr.o mpn/toom4_sqr.o
mpn/toom_eval_dgr3_pm1.o mpn/toom_eval_dgr3_pm2.o mpn/toom_eval_pm1.o mpn/toom_eval_pm2.o mpn/toom_eval_pm2exp.o mpn/toom_eval_pm2rexp.o mpn/toom_interpolate_5pts.o mpn/toom_interpolate_6pts.o mpn/toom_interpolate_7pts.o mpn/toom_interpolate_8pts.o mpn/toom_interpolate_12pts.o mpn/toom_interpolate_16pts.o mpn/invertappr.o .libs/libgmp.lax/lt100-invert.o mpn/binvert.o mpn/mulmod_bnm1.o mpn/sqrmod_bnm1.o mpn/sbpi1_div_q.o mpn/sbpi1_div_qr.o mpn/sbpi1_divappr_q.o mpn/dcpi1_div_q.o mpn/dcpi1_div_qr.o mpn/dcpi1_divappr_q.o mpn/mu_div_qr.o mpn/mu_divappr_q.o mpn/mu_div_q.o mpn/bdiv_q_1.o mpn/sbpi1_bdiv_q.o mpn/sbpi1_bdiv_qr.o mpn/dcpi1_bdiv_q.o mpn/dcpi1_bdiv_qr.o mpn/mu_bdiv_q.o mpn/mu_bdiv_qr.o mpn/bdiv_q.o mpn/bdiv_qr.o .libs/libgmp.lax/lt101-divexact.o mpn/bdiv_dbm1c.o mpn/redc_1.o mpn/redc_2.o mpn/redc_n.o .libs/libgmp.lax/lt102-powm.o mpn/powlo.o .libs/libgmp.lax/lt103-powm_sec.o mpn/subcnd_n.o mpn/redc_1_sec.o mpn/trialdiv.o
.libs/libgmp.lax/lt104-remove.o mpn/and_n.o mpn/andn_n.o mpn/nand_n.o mpn/ior_n.o mpn/iorn_n.o mpn/nior_n.o mpn/xor_n.o mpn/xnor_n.o mpn/copyi.o mpn/copyd.o mpn/zero.o mpn/invert_limb.o mpn/mul_2.o mpn/addmul_2.o mpn/addlsh1_n.o mpn/sublsh1_n.o mpn/rsblsh1_n.o mpn/rsh1add_n.o mpn/rsh1sub_n.o mpn/addlsh2_n.o mpn/rsblsh2_n.o mpn/addlsh_n.o mpn/rsblsh_n.o mpn/addaddmul_1msb0.o printf/asprintf.o printf/asprntffuns.o printf/doprnt.o printf/doprntf.o printf/doprnti.o printf/fprintf.o printf/obprintf.o printf/obvprintf.o printf/obprntffuns.o printf/printf.o printf/printffuns.o printf/snprintf.o printf/snprntffuns.o printf/sprintf.o printf/sprintffuns.o printf/vasprintf.o printf/vfprintf.o printf/vprintf.o printf/vsnprintf.o printf/vsprintf.o printf/repl-vsnprintf.o scanf/doscan.o scanf/fscanf.o scanf/fscanffuns.o scanf/scanf.o scanf/sscanf.o scanf/sscanffuns.o scanf/vfscanf.o scanf/vscanf.o scanf/vsscanf.o
libtool: link: ranlib .libs/libgmp.a
libtool: link: rm -fr .libs/libgmp.lax
libtool: link: ( cd ".libs" && rm -f "libgmp.la" && ln -s "../libgmp.la" "libgmp.la" )
make[2]: Leaving directory `/home/simon/Development/server_builder/build/egg/src/gmp-5.0.4'
make[1]: Leaving directory `/home/simon/Development/server_builder/build/egg/src/gmp-5.0.4'
Unfortunately the 'make check' fails as follows:
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I/home/simon/Development/server_builder/build/egg/include -I/home/simon/Development/server_builder/build/egg/include -c t-sub.c
/bin/bash ../libtool --tag=CC --mode=link gcc -std=gnu99 -I/home/simon/Development/server_builder/build/egg/include -L/home/simon/Development/server_builder/build/egg/lib -o t-sub t-sub.o libtests.la ../libgmp.la
libtool: link: gcc -std=gnu99 -I/home/simon/Development/server_builder/build/egg/include -o .libs/t-sub t-sub.o -L/home/simon/Development/server_builder/build/egg/lib ./.libs/libtests.a /home/simon/Development/server_builder/build/egg/src/gmp-5.0.4/.libs/libgmp.so ../.libs/libgmp.so -Wl,-rpath -Wl,/home/simon/Development/server_builder/build/egg/lib
make[4]: Leaving directory `/home/simon/Development/server_builder/build/egg/src/gmp-5.0.4/tests'
make check-TESTS
make[4]: Entering directory `/home/simon/Development/server_builder/build/egg/src/gmp-5.0.4/tests'
/bin/bash: line 5: 22977 Segmentation fault ${dir}$tst
FAIL: t-bswap
PASS: t-constants
/bin/bash: line 5: 23022 Segmentation fault ${dir}$tst
FAIL: t-count_zeros
PASS: t-gmpmax
PASS: t-hightomask
/bin/bash: line 5: 23087 Segmentation fault ${dir}$tst
FAIL: t-modlinv
/bin/bash: line 5: 23110 Segmentation fault ${dir}$tst
FAIL: t-popc
/bin/bash: line 5: 23133 Segmentation fault ${dir}$tst
FAIL: t-parity
/bin/bash: line 5: 23156 Segmentation fault ${dir}$tst
FAIL: t-sub
======================================================================================
6 of 9 tests failed
Please report to gmp-bugs at gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html
======================================================================================
make[4]: *** [check-TESTS] Error 1
make[4]: Leaving directory `/home/simon/Development/server_builder/build/egg/src/gmp-5.0.4/tests'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory `/home/simon/Development/server_builder/build/egg/src/gmp-5.0.4/tests'
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory `/home/simon/Development/server_builder/build/egg/src/gmp-5.0.4/tests'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/simon/Development/server_builder/build/egg/src/gmp-5.0.4'
make: *** [check] Error 2
(Perhaps the tests that passed are a clue of what might have gone wrong?)
A bit more information about the environment:
simon at LinuxDev64:~$ uname -a
Linux LinuxDev64 2.6.32-5-amd64 #1 SMP Mon Jan 16 16:22:28 UTC 2012 x86_64 GNU/Linux
simon at LinuxDev64:~$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-8)
simon at LinuxDev64:~/Development/server_builder/build/egg/src/gmp-5.0.4/.libs$ file libgmp.so.10.0.4
libgmp.so.10.0.4: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
And the stack trace of one of the tests (sorry I couldn't figure the exact command line it was supposed to run, as I couldn't follow the shell script very well :-S), hoping the stack trace is helpful...
simon at LinuxDev64:~/Development/server_builder/build/egg/src/gmp-5.0.4/tests/.libs$ gdb ./t-bswap
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/simon/Development/server_builder/build/egg/src/gmp-5.0.4/tests/.libs/t-bswap...done.
(gdb) run
Starting program: /home/simon/Development/server_builder/build/egg/src/gmp-5.0.4/tests/.libs/t-bswap
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000001 in ?? ()
(gdb) bt
#0 0x0000000000000001 in ?? ()
#1 0x00007ffff78d5606 in *__GI__dl_addr (address=0x7ffff7838870,
info=0x7fffffffe060, mapp=0x7fffffffe088, symbolp=0x0) at dl-addr.c:132
#2 0x00007ffff7838a27 in ptmalloc_init () at arena.c:521
#3 0x00007ffff783d127 in malloc_hook_ini (sz=140737354127688,
caller=0x7fffffffe060) at hooks.c:37
#4 0x00007ffff7b5b7c4 in __gmp_default_allocate ()
from /home/simon/Development/server_builder/build/egg/lib/libgmp.so.10
#5 0x0000000000409fd4 in tests_allocate ()
#6 0x00007ffff7b5cc9c in __gmp_randinit_mt_noseed ()
from /home/simon/Development/server_builder/build/egg/lib/libgmp.so.10
#7 0x00007ffff7b5cfda in __gmp_randinit_mt ()
from /home/simon/Development/server_builder/build/egg/lib/libgmp.so.10
#8 0x00007ffff7b5bae0 in __gmp_randinit_default ()
from /home/simon/Development/server_builder/build/egg/lib/libgmp.so.10
#9 0x000000000040230c in tests_rand_start ()
#10 0x00000000004022b8 in tests_start ()
#11 0x0000000000402171 in main ()
(gdb)
(gdb) f 1
#1 0x00007ffff78d5606 in *__GI__dl_addr (address=0x7ffff7838870,
info=0x7fffffffe060, mapp=0x7fffffffe088, symbolp=0x0) at dl-addr.c:132
132 __rtld_lock_lock_recursive (GL(dl_load_lock));
(gdb) list
127 {
128 const ElfW(Addr) addr = DL_LOOKUP_ADDRESS (address);
129 int result = 0;
130
131 /* Protect against concurrent loads and unloads. */
132 __rtld_lock_lock_recursive (GL(dl_load_lock));
133
134 /* Find the highest-addressed object that ADDRESS is not below. */
135 for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
136 for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l; l = l->l_next)
*************************
****
**** Please make sure any replies are copied to simbur at yahoo.com because I'm not subscribed to the list. Thanks! :-)
**** Alternatively I'm hanging out in #gcc on freenode as ElGrotto. Please feel free to message me there if that's more convenient to anyone.
****
*************************
Many thanks in advance for any help you can provide. If you need any further information please don't hesitate to ask.
Kind regards,
- Simon.
More information about the gmp-bugs
mailing list