Bignums, libmp and FreeBSD

Kaarthik Sivakumar kaarthik at comcast.net
Wed Apr 7 00:34:22 EDT 2004


Hi Jerry

This is a long mail, sorry about that. I tried to compile your changes
on FreeBSD 5.2RC2 and configure failed with this:

---
[...lots of stuff...]
checking for mp.h... yes
checking for mp_mfree in -lmp... no
checking for mfree in -lmp... no
Error: Required MP numeric support cannot be provided.
---

On FreeBSD, atleast the version I am using, -lcrypto is also needed
for -lmp. A change to configure is needed, which I have put in this
mail near the end; these changes are most likely NOT the exact ones -
a check for FreeBSD might be necessary here, but I dont understand
configure scripting enough to get that done.

After these changes, I get:

---
checking for mp.h... yes
checking for mp_mfree in -lmp... no
checking for mfree in -lmp... yes
    Prepending "-lmp -lcrypto" to $LIBS
checking for move... yes
    Defining HAVE_MP_MOVE
    Defining WITH_NUMBER_TYPES
    Defining WITH_MP
    Defining HAVE_UNIX_PROCESSES
---

which I think is good, right? But that is not the end of the problems.
When I try to compile xemacs, I get the following error:

---
cd ./src && make   CC='gcc' CFLAGS='-Wall -Wno-switch -Winline -Wmissing-prototypes -Wsign-compare -Wundef -Wstrict-prototypes -Wpacked -Wshadow -Wmissing-declarations -Wpointer-arith -g -O3' LDFLAGS='' CPPFLAGS='' all
gcc -c -Wall -Wno-switch -Winline -Wmissing-prototypes -Wsign-compare -Wundef -Wstrict-prototypes -Wpacked -Wshadow -Wmissing-declarations -Wpointer-arith -g -O3  -Demacs -I. -DHAVE_CONFIG_H -I/usr/local/include -I/usr/X11R6/include abbrev.c
In file included from number-mp.h:37,
                 from number.h:65,
                 from lisp.h:3383,
                 from abbrev.c:36:
/usr/include/mp.h:20:16: macro "min" requires 2 arguments, but only 1 given
/usr/include/mp.h:20: error: storage size of `min' isn't known
*** Error code 1

Stop in /usr/home/programs/xemacs/21.5/src.
*** Error code 1

Stop in /usr/home/programs/xemacs/21.5.
---

There really is a function named min() in libmp, with a prototype in
mp.h and the function takes only one argument. This obviously
conflicts with a macro min defined in compiler.h. In number-mp.h, I
tried to do the trick that you do for pow():

---
Index: number-mp.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/number-mp.h,v
retrieving revision 1.1
diff -u -r1.1 number-mp.h
--- number-mp.h 2004/04/05 22:49:56     1.1
+++ number-mp.h 2004/04/07 04:21:05
@@ -34,8 +34,10 @@
    function anyway, so we do this for safety purposes.  However, this means
    that number-mp.h must always be included before math.h. */
 #define pow mp_pow
+#define min mp_min
 #include <mp.h>
 #undef pow
+#undef min

 #ifdef MP_PREFIX
 #define MP_GCD   mp_gcd
Exit 1
---

but this causes warnings all over the place about min() being
redefined. I dont think this will work very well. But that is not the
end of the problems either :)

Compilation later on stops at:

---
gcc -c -Wall -Wno-switch -Winline -Wmissing-prototypes -Wsign-compare -Wundef -Wstrict-prototypes -Wpacked -Wshadow -Wmissing-declarations -Wpointer-arith -g -O3  -Demacs -I. -DHAVE_CONFIG_H -I/usr/local/include -I/usr/X11R6/include data.c
In file included from number.h:65,
                 from lisp.h:3383,
                 from data.c:29:
number-mp.h:37:1: warning: "min" redefined
In file included from lisp.h:822,
                 from data.c:29:
compiler.h:42:1: warning: this is the location of the previous definition
data.c: In function `Fminus':
data.c:1419: warning: implicit declaration of function `get_number_type'
data.c: In function `Fmax':
data.c:1798: warning: label `retry' defined but not used
data.c:1998:65: macro "make_int" passed 2 arguments, but takes just 1
data.c: In function `Flogand':
data.c:1998: error: `make_int' undeclared (first use in this function)
data.c:1998: error: (Each undeclared identifier is reported only once
data.c:1998: error: for each function it appears in.)
data.c: At top level:
data.c:851: warning: `number_char_or_marker_to_int_or_double' defined but not used
data.c:867: warning: `number_char_or_marker_to_double' defined but not used
data.c:1218: warning: `digit_to_number' defined but not used
*** Error code 1

Stop in /usr/home/programs/xemacs/21.5/src.
*** Error code 1

Stop in /usr/home/programs/xemacs/21.5.
---

data.c:1998 calls make_int with 2 arguments, which is wrong. But I am
not sure why the compiler complains that make_int is undeclared.

Thats where my compile currently stands. Sorry, I am not able to
provide any patches, except for the configure bit. Hope this helps.
This is my system:

OS:
FreeBSD the-saint 5.2-RC2 FreeBSD 5.2-RC2 #0: Sat Mar 13 20:37:02 EST 2004     kaarthik at the-saint:/usr/src/sys/i386/compile/THE-SAINT  i386

gcc:
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.3.3 [FreeBSD] 20031106

kaarthik

--- configure change ---
Index: configure
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/configure,v
retrieving revision 1.216
diff -u -r1.216 configure
--- configure   2004/04/06 18:08:15     1.216
+++ configure   2004/04/07 04:02:22
@@ -15663,7 +15663,7 @@
 echo "configure:15664: checking for mp_mfree in -lmp" >&5
 ac_lib_var=`echo mp'_'mp_mfree | sed 'y%./+-%__p_%'`

-xe_check_libs=" -lmp "
+xe_check_libs=" -lmp -lcrypto "
 cat > conftest.$ac_ext <<EOF
 #line 15669 "configure"
 #include "confdefs.h"
@@ -15698,7 +15698,7 @@
 echo "configure:15699: checking for mfree in -lmp" >&5
 ac_lib_var=`echo mp'_'mfree | sed 'y%./+-%__p_%'`

-xe_check_libs=" -lmp "
+xe_check_libs=" -lmp -lcrypto "
 cat > conftest.$ac_ext <<EOF
 #line 15704 "configure"
 #include "confdefs.h"
@@ -15747,7 +15747,7 @@
 EOF
 }

-    LIBS="-lmp $LIBS" &&  if test "$extra_verbose" = "yes"; then echo "    Prepending \"-lmp\" to \$LIBS"; fi
+    LIBS="-lmp -lcrypto $LIBS" &&  if test "$extra_verbose" = "yes"; then echo "    Prepending \"-lmp -lcrypto\" to \$LIBS"; fi
     echo $ac_n "checking for mp_move""... $ac_c" 1>&6
 echo "configure:15753: checking for mp_move" >&5

@@ -15801,7 +15801,7 @@
 fi

   elif test "$have_mfree" = "yes"; then
-    LIBS="-lmp $LIBS" &&  if test "$extra_verbose" = "yes"; then echo "    Prepending \"-lmp\" to \$LIBS"; fi
+    LIBS="-lmp -lcrypto $LIBS" &&  if test "$extra_verbose" = "yes"; then echo "    Prepending \"-lmp -lcrypto\" to \$LIBS"; fi
     echo $ac_n "checking for move""... $ac_c" 1>&6
 echo "configure:15807: checking for move" >&5

---




More information about the XEmacs-Beta mailing list