Robert Paprocki <[email protected]> writes:

> Hello,
>
> I have compiled Nettle 3.3 with GMP 6.1.2 on a variety of systems (various
> Ubuntu/Debian distros, CentOS 7, Alpine) with success:
>
> ###### build nettle
> # pwd
> /tmp/nettle-3.3
> # CPPFLAGS="-I../gmp-6.1.2/" LDFLAGS="-L../gmp-6.1.2/.libs" ./configure &&
> make
>

Using relative file names for -I and -L won't quite work, since they will
point at the wrong place when make is run in subdirectories.

> Again this works as expected on a variety of systems, except for CentOS 6
> (using the centos:6 docker image). On CentOS 6 nettle configure fails with
> the following:
>
> checking for GMP limb size... configure: error: in `/tmp/nettle-3.3':
> configure: error: cannot find value of GMP_NUMB_BITS
>
> Full configure output: https://pastebin.com/9s3nfA8G

You should check config.log to investigate this kind of problems.
My best guess is that the runtime linker can't find libgmp.so, you'd
have to either set LD_LIBRARY_PATH, or add something like
-Wl,-rpath,/tmp/gmp-6.1.2/... to LDFLAGS, or use --with-lib-path, in
which case nettle's configure script will attempt to add the needed
linker flags automatically.

> Oddly enough, if I install GMP (via 'make install') to a default search
> path, configure/make works as expected.

The way I'd recommend, is to do a GMP make install with some suitable
--prefix (/usr/local, /opt, /tmp/local, $HOME/local, whatever), and
configure nettle with --with-include-path and --with-lib-path to point
out the install location (using absolute file names).

> gcc -I.. -I.. -I../gmp-6.1.2/ -DHAVE_CONFIG_H -g -O2 -ggdb3
> -Wno-pointer-sign -Wall -W   -Wmissing-prototypes -Wmissing-declarations
> -Wstrict-prototypes   -Wpointer-arith -Wbad-function-cast -Wnested-externs
>  -MT pkcs1-conv.o -MD -MP -MF pkcs1-conv.o.d -c pkcs1-conv.c && true
> In file included from ../rsa.h:38,
>                  from pkcs1-conv.c:47:
> ../bignum.h:54:18: error: gmp.h: No such file or directory
>
> Which is very odd because we gmp.h definitely does exist (our gcc call has
> the following: -I../gmp-6.1.2/):
>
> # file ../gmp-6.1.2/gmp.h
> ../gmp-6.1.2/gmp.h: ASCII C program text

gcc and file are not running with the same working directory, that's why
they get different results when attempting to open "../gmp-6.1.2/gmp.h".
pkcs1-conv is built in the tools/ subdirectory. 

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to