configure: error: Unable to locate gmp.h

6

Per https://stackoverflow.com/a/19894267/569976 I tried the following to no avail:

  • ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
  • --with-gmp=/usr/include/x86_64-linux-gnu

Both of them get me this error:

configure: error: Unable to locate gmp.h

When I do ln /usr/include/x86-64-linux-gnu/ I see this:

a.out.h  asm  bits  c++  fpu_control.h  gmp.h  gnu  ieee754.h  sys

Any ideas?

neubert

Posted 2014-08-23T15:17:15.297

Reputation: 3 991

Essentially a duplicate of http://superuser.com/questions/802022/locate-doesnt-find-all-the-files-it-should.

– Kenster – 2014-08-23T15:24:12.313

How is this a duplicate? The answer to that one was to do sudo updatedb and that's obviously not an answer for this one as, even after having done that, I'm still getting this error.. – neubert – 2014-08-23T21:11:20.483

First of all, make sure you're using the correct path to gmp.h when you run configure or make the symlink. As in the other question, you're not being consistent about the correct pathname to the file. Next, see if configure is leaving its config.log file behind when it fails. config.log should list the specific commands that configure ran and what exactly happened. – Kenster – 2014-08-23T22:10:08.353

The path name is correct. Here's my config.log: http://pastebin.com/XcmqhGZr I'm not seeing any specific command mentioned..

– neubert – 2014-08-23T23:07:50.103

That particular configure run appears to have failed because it was interrupted, perhaps because someone hit Ctrl-C. Maybe you could rerun configure and reproduce the error to make sure you have an accurate version of the log. – Kenster – 2014-08-23T23:12:09.227

Answers

11

Have you tried

ls /usr/include/x86_64-linux-gnu/gmp.h

Please make sure whether the gmp.h file exists.

Maybe you should run the following command:

sudo apt-get install libgmp-dev

Haozhe Xie

Posted 2014-08-23T15:17:15.297

Reputation: 211

8

just in case someone having same issue while trying to compile php via phpbrew, although /usr/include/x86_64-linux-gnu/gmp.h is definitely there and available:

symlink for gmp.h solved this for me

ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h

Marat

Posted 2014-08-23T15:17:15.297

Reputation: 201

+1 This is the fix for psptoolchain it helped me to compile it. – mondlos – 2018-01-01T17:19:56.743

great!, it worked – vkGunasekaran – 2019-09-17T07:05:06.003

1

Had the same problem in a Debian/PHP Docker container when running:

RUN docker-php-ext-install gmp

This fixed it for me (run it before the docker-php-ext-install command):

RUN apt-get update && apt-get install -y libgmp-dev
RUN ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h

ryu

Posted 2014-08-23T15:17:15.297

Reputation: 11

You saved my day! I was trying to add gmp to a standard wordpress docker image and spent many hours figuring out how to do it – Marco Ottolini – 2020-02-07T04:51:20.870