Nicolas
Nicolas

Reputation: 33

LIBTOOL fails while attempting to compile GMP

I am trying to install gmp2 as explained in https://code.google.com/p/gmpy/wiki/InstallingGmpy2 under ubuntu 12.04 LTS.

Therefore I need to compile GMP, MPFR, and MPC.

To compile GMP, according to above instructions, I need:

$ cd ~/src/gmp-5.1.0
$ ./configure --prefix=/home/case/local
$ make
$ make check
$ make install

The ./configure step worked fine, although I had to prefix the command with /bin/bash.

When I invoke the make command, I run into this error involving libtool:

/bin/sh ../libtool --tag=CC --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_echo fib_table | sed 's/_$//' -m32 -O2 -pedantic -fomit-frame-pointer -mtune=core2 -march=core2 -c -o fib_table.lo fib_table.c
../libtool: 1581: ../libtool: preserve_args+= --tag CC: not found
../libtool: 1: eval: base_compile+= gcc: not found
../libtool: 1: eval: base_compile+= -std=gnu99: not found
../libtool: 1: eval: base_compile+= -DHAVE_CONFIG_H: not found
../libtool: 1: eval: base_compile+= -I.: not found
../libtool: 1: eval: base_compile+= -I..: not found
../libtool: 1: eval: base_compile+= -D__GMP_WITHIN_GMP: not found
../libtool: 1: eval: base_compile+= -I..: not found
../libtool: 1: eval: base_compile+= -DOPERATION_fib_table: not found
../libtool: 1: eval: base_compile+= -m32: not found
../libtool: 1: eval: base_compile+= -O2: not found
../libtool: 1: eval: base_compile+= -pedantic: not found
../libtool: 1: eval: base_compile+= -fomit-frame-pointer: not found
../libtool: 1: eval: base_compile+= -mtune=core2: not found
../libtool: 1: eval: base_compile+= -march=core2: not found
../libtool: 1: eval: base_compile+= -c: not found
libtool: compile: you must specify a compilation command
libtool: compile: Try 'libtool --help --mode=compile' for more information. make[2]: *** [fib_table.lo] Error 1
make[2]: Leaving directory '/home/nicolas/Dropbox/crypto/gcc-lib/gmp-5.1.3/mpn'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/nicolas/Dropbox/crypto/gcc-lib/gmp-5.1.3'
make: *** [all] Error 2

I suspect that the libtool call prefixed by /bin/sh is wrong but I can not figure how to change it:

Any idea how to complete compiling GMP?

Upvotes: 2

Views: 5457

Answers (4)

PR7
PR7

Reputation: 1912

Make sure libtool-bin package is installed.

sudo apt-get install libtool-bin

With only libtool, which libtool command prints /mnt/c/MinGW/bin/libtool.

After installing libtool-bin, which libtool command prints /usr/bin/libtool.

This somehow fixed the issue for me, hope this helps someone.

Upvotes: 0

Zacki
Zacki

Reputation: 177

As the error log says: can't find gcc indicates you don't have gcc ( the gnu c compiler ) installed.
Run sudo apt-get install gcc && gcc --version

Upvotes: 0

user7338786
user7338786

Reputation:

apr invokes a internal libtool under /usr/share/apr-1/libtool which is different from the one you normally use.

Probably to avoid environment issues and ironically creating compiler issues: mv arp-1/libtool to apr-1/libtool.bak and ln -sv /usr/bin/libtool to /usr/share/apr-1/libtool would fix this regardless of your environment or invocation method.

Similary, check where libtool is being called from. A lot of source packages build from internal binaries that may not be compatible with your system.

Upvotes: 0

Adrian Frühwirth
Adrian Frühwirth

Reputation: 45686

As you say, this happens because calls to libtool get prefixed by /bin/sh and your /bin/sh implementation (my educated guess: dash) doesn't implement the += syntax (which is not a POSIX feature). libtool itself has /bin/bash as hashbang.

If you can't figure out where your SHELL prefix comes from you can "fix" libtool itself by changing all occurrances of:

base_compile+=" ${foo}"

to

base_compile="${base_compile} ${foo}"

Note that this is a quick hack and you should rather fix the underlying problem which is invoking libtool with /bin/sh.

(I ran into the same problem after switching default shell from bash to dash due to shellshock when trying to build apr-util.)

Upvotes: 5

Related Questions