5

To compile my own gcc, I require gmp. Therefore, I downloaded a tarball of gmp, and installed it by the usual steps of configure, make and make install. However, afterwards, I can't see any gmp in my system by typing 'which gmp'. So my question is where is gmp hidden? I am using CentOS 5.6.

EDIT

OK, I can see the header and library files of gmp in /usr/local/include and /usr/local/lib. I used --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib but the gcc's configure still complains about not finding gmp. What is going on here?

MetallicPriest
  • 29,191
  • 52
  • 200
  • 356
  • 1
    gmp is a library. what were you expecting from `which gmp` exactly? – Mat May 04 '12 at 10:19
  • Basically after installing gmp, the configure of gcc still doesn't see it. I can basically see the header file in /usr/local/include and library files in /usr/local/lib. But how do I tell gcc installer so? – MetallicPriest May 04 '12 at 10:23
  • 5
    Try `configure --help` and look for a gmp configuration flag. Typically, `--gmp-include-path` or something like that. – HonkyTonk May 04 '12 at 10:24
  • Did you run `ldconfig` after installing the gmp package? Typically `configure` scripts try to build a program using the library and if that fails, this is reported as a non-existing library. `ldconfig` rebuilds the linker database letting `ld` do its job properly. – HonkyTonk May 04 '12 at 11:30

4 Answers4

2

Try to change

-–with-gmp=

to

-–with-gmp-prefix=

Thanks to doober

bartolo-otrit
  • 2,396
  • 3
  • 32
  • 50
  • what's the explanation for this? and you mean "to," not "on." we change one thing "to" another. – abcd Oct 10 '15 at 06:47
  • I've edited my answer as you suggested. I don't know the reason why the second option works whereas gcc manual contains only --with-gmp= option. But -–with-gmp-prefix= worked in my case at that time. – bartolo-otrit Oct 12 '15 at 17:37
1

I think you should run ./configure script with some params:

./configure --prefix=/usr

default prefix is /usr/local

and if your system is 64-bit:

./configure --prefix=/usr --libdir=/usr/lib64

After that 'make && make install' should install everything in proper locations.

PauliusZ
  • 403
  • 5
  • 7
1

You're right that you need --with-gmp-xxx switches.

You may also need to set to set run-path to /usr/local/lib or wherever you install gmp if it's not in the default runtime linker locations:

$ export LD_RUN_PATH=/usr/local/lib
$ configure ...
$ make ...
Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271
0

The crucial point here that is only mentioned in one passing comment (by @Mat) is that gmp is a library. It is not a binary. So the resource that is produced is a bunch of libgmp* files in $prefix/lib.

There is no $prefix/bin/gmp...

Oscar Bravo
  • 250
  • 4
  • 11