Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Apr 2004 21:17:24 -0400
From:      Kaarthik Sivakumar <kaarthik@comcast.net>
To:        current@freebsd.org
Subject:   libmp and libcrypto
Message-ID:  <86vfkb2rq3.fsf@comcast.net>

next in thread | raw e-mail | index | archive | help
Hi

I am trying to compile a program that requires libmp for bignum and
other large numbers. The configure test for libmp fails though. The
output from config.log is at the end of the mail. It seems like
linking with libmp requires linking with libcrypto also, libmp has
undefined reference to BN_mul, etc. Is this how it is intended? I have
been led to believe that neither Solaris' libmp or libgmp require it
like this and usually it is the other way around, ie libcrypto would
require libmp. So can anyone confirm that libcrypto is indeed needed
for libmp?

libmp also defines a function called min() that takes one argument.
The prototype for this function is in mp.h and this function takes one
argument. This causes redefinition errors when compiling, since most
programs seem to define a min() macro that takes 2 args and returns
the minimum value. Would it possible to work around this in some way?
Even better would be if the libmp functions had a mp_ prefix, like
Solaris does. Is that something being considered? 

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


Thanks..

This is the output from config.log, when testing for libmp.

configure:15699: checking for mfree in -lmp
configure:15715: gcc -o conftest   -Wall -Wno-switch -Winline -Wmissing-prototypes -Wsign-compare -Wundef -Wstrict-prototypes -Wpacked -Wshadow -Wmissing-declarations -Wpointer-arith -g -O3   -I/usr/local/include     -I/usr/X11R6/include    -L/usr/local/lib   -L/usr/X11R6/lib  -Xlinker -R/usr/local/lib:/usr/X11R6/lib conftest.c   -lmp   -laudio -lXaw3d -ltiff -lpng -ljpeg -lz -lcompface -lXpm -lXmu -lXt -lXext -lX11   -lSM -lICE -lncurses -lm   -lutil -lxpg4  1>&5
configure:15708: warning: function declaration isn't a prototype
configure:15710: warning: function declaration isn't a prototype
/usr/X11R6/lib/libXaw3d.so: warning: tmpnam() possibly used unsafely; consider using mkstemp()
/usr/lib/libmp.so: undefined reference to `BN_mul'
/usr/lib/libmp.so: undefined reference to `BN_sub'
/usr/lib/libmp.so: undefined reference to `BN_gcd'
/usr/lib/libmp.so: undefined reference to `BN_add'
/usr/lib/libmp.so: undefined reference to `BN_CTX_init'
/usr/lib/libmp.so: undefined reference to `BN_mod_exp'
/usr/lib/libmp.so: undefined reference to `BN_hex2bn'
/usr/lib/libmp.so: undefined reference to `CRYPTO_free'
/usr/lib/libmp.so: undefined reference to `BN_div'
/usr/lib/libmp.so: undefined reference to `BN_bn2dec'
/usr/lib/libmp.so: undefined reference to `BN_clear'
/usr/lib/libmp.so: undefined reference to `BN_dec2bn'
/usr/lib/libmp.so: undefined reference to `BN_free'
/usr/lib/libmp.so: undefined reference to `ERR_reason_error_string'
/usr/lib/libmp.so: undefined reference to `BN_CTX_free'
/usr/lib/libmp.so: undefined reference to `BN_exp'
/usr/lib/libmp.so: undefined reference to `ERR_get_error'
/usr/lib/libmp.so: undefined reference to `BN_copy'
/usr/lib/libmp.so: undefined reference to `BN_bn2hex'
/usr/lib/libmp.so: undefined reference to `ERR_load_crypto_strings'
/usr/lib/libmp.so: undefined reference to `BN_init'
/usr/lib/libmp.so: undefined reference to `BN_ucmp'
/usr/lib/libmp.so: undefined reference to `BN_new'
/usr/lib/libmp.so: undefined reference to `BN_cmp'
configure: failed program was:
#line 15704 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mfree();

int main() {
mfree()
; return 0; }





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86vfkb2rq3.fsf>