problems with --enable-shared

Niels Möller nisse at lysator.liu.se
01 Nov 2002 11:32:26 +0100


James Ralston <qralston+ml.nettle-bugs@andrew.cmu.edu> writes:

> I tried building nettle 1.6 with --enabled-shared on Red Hat Linux 8.0
> on x86.

Thanks for testing this.

> The command to build the shared library doesn't get the soname or the
> filename correct:
> 
>     gcc  -shared -Wl,-soname=libnettle.so. aes_p.o [...] nettle-openssl_p.o -o libnettle.so
> 
> The attached patch fixes the problem.

I've applied the patch.

There seems to be one more problem with that command line:
nettle-openssl_p.o should probably not be included in the shared
library. It is used only for benchmarking against openssl, and
including it in the shared library will make the entire library depend
on openssl, which isn't good. Perhaps the file should simply be moved
out of the library and down into the examples directory. The same will
apply whenever I add similar glue code for libgcrypt.

> The example programs are built like this:
> 
>     [...] ../libnettle.a -lcrypto -lgmp
> 
> In order to test the shared libraries, that needs to be something like
> this:
> 
>     [...] -L.. -lnettle -lcrypto -lgmp

Fixed.

> That will work even if a shared library wasn't build.  The example
> programs will need to be invoked with LD_LIBRARY_PATH set
> appropriately.

And I added a line to the testsuite and examples Makefiles to set
LD_LIBRARY_PATH when running the tests. Actually, I set it to
../.lib, and install a link from .lib/libnettle.so.0 to libnettle.so.

> ../libnettle.so: undefined reference to `memxor'

memxor should be included in the library, via LIBOBJS, but that didn't
happen. Fixed.

Can you try getting the current nettle from cvs and check if that
works? It should be something like

  cvs -d :pserver:anonymous@cvs.lysator.liu.se:/cvsroot/lsh co nettle
  cd nettle
  ./.bootstrap && configure --enable-shared && make && make check

(You may not want to install it, I won't promise that the current
nettle is compatible with 1.6 nor with the next released version).

Thanks,
/Niels