gmp - enable-fat: missing dispatch function for __gmpn_add_nc
Dan Grayson
dan at math.uiuc.edu
Thu Oct 12 03:55:25 CEST 2006
If I configure gmp 4.2.1 with --enable-fat then I can get a link error:
% cat foo.c
main () {
__gmpn_add_n();
}
% gcc foo.c -L$HOME/local.Linux/lib -lgmp
/home/25/dan/local.Linux/lib/libgmp.so: undefined reference to `__gmpn_add_nc'
/home/25/dan/local.Linux/lib/libgmp.so: undefined reference to `__gmpn_sub_nc'
collect2: ld returned 1 exit status
Here is one fix that seems to work, but I don't know whether it's really right.
diff -ur ../4.2.1-orig/gmp-4.2.1/mpn/generic/addsub_n.c ./gmp-4.2.1/mpn/generic/addsub_n.c
--- ../4.2.1-orig/gmp-4.2.1/mpn/generic/addsub_n.c 2006-03-14 09:57:54.000000000 -0600
+++ ./gmp-4.2.1/mpn/generic/addsub_n.c 2006-10-11 20:50:55.000000000 -0500
@@ -58,13 +58,13 @@
for (off = 0; off < n; off += PART_SIZE)
{
this_n = MIN (n - off, PART_SIZE);
-#if HAVE_NATIVE_mpn_add_nc || !HAVE_NATIVE_mpn_add_n
+#if HAVE_NATIVE_mpn_add_nc
acyo = mpn_add_nc (r1p + off, s1p + off, s2p + off, this_n, acyo);
#else
acyn = mpn_add_n (r1p + off, s1p + off, s2p + off, this_n);
acyo = acyn + mpn_add_1 (r1p + off, r1p + off, this_n, acyo);
#endif
-#if HAVE_NATIVE_mpn_sub_nc || !HAVE_NATIVE_mpn_sub_n
+#if HAVE_NATIVE_mpn_sub_nc
scyo = mpn_sub_nc (r2p + off, s1p + off, s2p + off, this_n, scyo);
#else
scyn = mpn_sub_n (r2p + off, s1p + off, s2p + off, this_n);
@@ -81,13 +81,13 @@
for (off = 0; off < n; off += PART_SIZE)
{
this_n = MIN (n - off, PART_SIZE);
-#if HAVE_NATIVE_mpn_sub_nc || !HAVE_NATIVE_mpn_sub_n
+#if HAVE_NATIVE_mpn_sub_nc
scyo = mpn_sub_nc (r2p + off, s1p + off, s2p + off, this_n, scyo);
#else
scyn = mpn_sub_n (r2p + off, s1p + off, s2p + off, this_n);
scyo = scyn + mpn_sub_1 (r2p + off, r2p + off, this_n, scyo);
#endif
-#if HAVE_NATIVE_mpn_add_nc || !HAVE_NATIVE_mpn_add_n
+#if HAVE_NATIVE_mpn_add_nc
acyo = mpn_add_nc (r1p + off, s1p + off, s2p + off, this_n, acyo);
#else
acyn = mpn_add_n (r1p + off, s1p + off, s2p + off, this_n);
@@ -105,13 +105,13 @@
for (off = 0; off < n; off += PART_SIZE)
{
this_n = MIN (n - off, PART_SIZE);
-#if HAVE_NATIVE_mpn_add_nc || !HAVE_NATIVE_mpn_add_n
+#if HAVE_NATIVE_mpn_add_nc
acyo = mpn_add_nc (tp, s1p + off, s2p + off, this_n, acyo);
#else
acyn = mpn_add_n (tp, s1p + off, s2p + off, this_n);
acyo = acyn + mpn_add_1 (tp, tp, this_n, acyo);
#endif
-#if HAVE_NATIVE_mpn_sub_nc || !HAVE_NATIVE_mpn_sub_n
+#if HAVE_NATIVE_mpn_sub_nc
scyo = mpn_sub_nc (r2p + off, s1p + off, s2p + off, this_n, scyo);
#else
scyn = mpn_sub_n (r2p + off, s1p + off, s2p + off, this_n);
Details of system:
u123% gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /home/25/dan/local/encap/capybara/share/capybara/packages/gcc/TMP/4.1.0/./gcc-4.1.0/./configure --prefix=/home/25/dan/local.Linux --enable-languages=c++,f95 --with-local-prefix=/home/25/dan/local.Linux/local --enable-shared --enable-threads=posix --with-as=/home/25/dan/local.Linux/bin/as --with-ld=/home/25/dan/local.Linux/bin/ld
Thread model: posix
gcc version 4.1.0
u123% uname -a
Linux u123.math.uiuc.edu 2.4.22-1.2199.4.legacy.nptl #1 Sun Feb 20 18:21:21 EST 2005 i686 i686 i386 GNU/Linux
gmp configuration command:
CC="gcc" CPPFLAGS="-I/home/25/dan/local/include -I/home/25/dan/local.Linux/include" LDFLAGS="-L/home/25/dan/local/lib" ./configure --prefix=/home/25/dan/local.Linux --enable-cxx --enable-fat
More information about the gmp-bugs
mailing list