PHP compile: off_t undefined

Viewed 5074

Just a quick question: I want to compile PHP 7.1.6 and running into the following issue while executing the configure-script:

checking size of short... (cached) 2
checking size of int... (cached) 4
checking size of long... (cached) 8
checking size of long long... (cached) 8
checking size of off_t... 0
configure: error: off_t undefined; check your library configuration

These are my configure options:

./configure --prefix=/usr/local/php --disable-all --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-pdo --with-pdo-mysql=/usr/local/mysql --with-zlib=/usr/local --with-zlib-dir=/usr/local --with-ldap=/usr/local --with-curl=/usr/local --with-openssl=/usr/local/ssl --with-libxml-dir=/usr/local --with-iconv=/usr/local --with-iconv-dir=/usr/local --with-pcre-regex=/usr/local --with-pcre-dir=/usr/local --enable-filter --disable-debug --enable-inline-optimization --disable-rpath --disable-static --enable-session --enable-dom --enable-json --enable-ctype --enable-hash --enable-tokenizer --enable-xmlreader --enable-shared --enable-xml --enable-libxml --enable-simplexml --with-pic --enable-bcmath --with-gd --with-freetype-dir=/usr/local --with-png-dir=/usr/local --with-jpeg-dir=/usr/local --enable-gd-native-ttf --enable-mbstring --enable-zip --enable-intl --enable-soap --enable-exif

Maybe someone of you have some hints for me?

5 Answers

The libzip version is not compatible with the php version. Using the latest version of libzip when compiling php7.3 will have this problem, and the downgrade will be fine.

wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make && make install

May have another problem: zipconf.h: No such file or directory https://github.com/Homebrew/legacy-homebrew/issues/13390

cp php-7.3.0/ext/zip/lib/zipconf.h /usr/local/include/ 

On my configuration (PHP 7.3.7 and Centos 7.6.1810), the solution was a mix of Anastas Giokov's response and kkuhrman's response:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PHP_DIR/build-src/srclib/libzip-1.2.0/lib"

and

ln -s ../lib/zipconf.h $PHP_DIR//build-src/srclib/libzip-1.2.0/include/zipconf.h

I found out that the issue is caused by the libzip library location missing from the LD_LIBRARY_PATH environment variable. In my case, I have added the lib sub-folder, while the actual library was installed under lib64. Adding the correct path solved the issue.

Try

    $ aclocal

...and /then/...

    $ autoreconf ./configure.ac

...lastly...

    $ ./configure

This solved the same problem for me. You may have to run ldconfig on /usr/lib64 if you installed libzip from source.

I encountered this problem again a little more than a year after the post above so this further clarifies the solution for my machine. In my case I'm trying to compile PHP 7.3 with a more recent version of libzip than the available RPM on CentOS at the time. I had to compile libzip from source, too. In my case builds of HTTPD, PHP and libzip were all installed to /usr/local sub-directories. I was able to get PHP to build by doing the following:

echo '/usr/local/lib64
>/usr/local/lib
>/usr/lib
>/usr/lib64'>>/etc/ld.so.conf
ldconfig -v

And then from my build directory:

./config.nice
make
make install

The hint for adding my local directories to my dynamic library configuration above came from this post:

https://programmer.group/lnmp-centos7-install-php7.3-nginx-1.4-deploy-and-install-wordpress.html

Related