Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

build php5.3.8 on ubuntu , get error: configure: error: Unable to locate gmp.h

Tags:

php

build

ubuntu

I am using ubuntu 13.10 x64, and I'm trying build php 5.3.8, I downloaded the source code and run the configure:

./configure --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data 
--with-tidy --with-config-file-path=/usr/local/php/conf 
--with-config-file-scan-dir=/usr/local/php/conf.d --enable-debug --with-openssl 
--with-kerberos --with-zlib --enable-calendar --with-curl --with-curlwrappers 
--with-enchant --enable-exif --enable-ftp --with-gd --with-jpeg-dir=/usr 
--with-png-dir=/usr --with-vpx-dir=/usr --with-freetype-dir=/usr --with-t1lib 
--enable-exif --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext 
--with-gmp --with-mhash --enable-intl --enable-mbstring --with-mcrypt --with-mysql 
--with-mysqli --enable-pcntl --with-pdo-mysql --with-pdo-pgsql 
--with-pgsql --with-pspell --with-libedit --with-readline --enable-shmop 
--with-snmp --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvshm 
--with-xsl --enable-zip --with-pear --enable-zend-signals --enable-maintainer-zts

And I got this error: configure: error: Unable to locate gmp.h

I have installed libgmp-dev and libgmp3-dev use sudo apt-get install libgmp-dev libgmp3-dev but still can't run the configure successfully, how can I fix this problem?


if I run locate gmp.h I can see it here:

/usr/include/linux/igmp.h
/usr/include/netinet/igmp.h
/usr/include/x86_64-linux-gnu/gmp.h
/usr/src/linux-headers-3.11.0-12/include/linux/igmp.h
/usr/src/linux-headers-3.11.0-12/include/uapi/linux/igmp.h
/usr/src/linux-headers-3.11.0-12-generic/include/linux/igmp.h
/usr/src/linux-headers-3.11.0-13/include/linux/igmp.h
/usr/src/linux-headers-3.11.0-13/include/uapi/linux/igmp.h
/usr/src/linux-headers-3.11.0-13-generic/include/linux/igmp.h

Thanks!

like image 526
aserww106 Avatar asked Nov 10 '13 19:11

aserww106


2 Answers

Do you have gmp.h anywhere on the system? If it is installed on a non-standard location (or the standard location has changed since the release of php 5.3.8) GCC might be looking for it in the wrong path.

My advice would be to locate gmp.h and if it isn't at usr/include/gmp.h try to symlink to it.

In response to your comment (and since comments syntax highligher is limited).

try symlinking it

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

if that fails, see if you can compile including the parameter

--with-gmp=/usr/include/x86_64-linux-gnu

give a look to the gcc documentation. It has a small section about gmp path.

http://gcc.gnu.org/install/configure.html

like image 127
ffflabs Avatar answered Nov 04 '22 15:11

ffflabs


This is a bug. I reported it -- https://bugs.php.net/bug.php?id=69993 -- and provided a patch to fix it.

like image 25
Mark A. Hershberger Avatar answered Nov 04 '22 15:11

Mark A. Hershberger