Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure: error: you need at least libvips 8.2 for this module #30

Open
vedmant opened this issue Jul 4, 2019 · 20 comments
Open

configure: error: you need at least libvips 8.2 for this module #30

vedmant opened this issue Jul 4, 2019 · 20 comments

Comments

@vedmant
Copy link

vedmant commented Jul 4, 2019

Hi, I'm trying to install this ext on MacOs

brew install vips
pecl install vips

But have following error:
configure: error: you need at least libvips 8.2 for this module

vips -v reports: vips-8.8.0-Sat May 11 11:55:18 UTC 2019

MacOs: 10.14.5 (18F132)
PHP 7.3.6
Homebrew 2.1.6

Probably I'm missing something?

@jcupitt
Copy link
Member

jcupitt commented Jul 4, 2019

Hello, you need to set PKG_CONFIG_PATH so that pecl can find the brew libvips binary.

I think there's a php-vips-ext formula in homebrew which does this for you (I think).

@vedmant
Copy link
Author

vedmant commented Jul 4, 2019

Not sure what exactly to set to PKG_CONFIG_PATH,
I checked config.m4 file, it uses pkg-config vips --atleast-version 8.2 command to check version, here is some output from that command:

Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libffi', required by 'gobject-2.0', not found

brew info libffi shows following:

brew info libffi
libffi: stable 3.2.1 (bottled), HEAD [keg-only]
Portable Foreign Function Interface library
https://sourceware.org/libffi/
/usr/local/Cellar/libffi/3.2.1 (16 files, 296.9KB)
  Poured from bottle on 2017-04-03 at 21:39:53
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libffi.rb
==> Options
--HEAD
	Install HEAD version
==> Caveats
libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

For compilers to find libffi you may need to set:
  export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

==> Analytics
install: 122,179 (30 days), 368,163 (90 days), 1,232,414 (365 days)
install_on_request: 3,635 (30 days), 10,899 (90 days), 38,893 (365 days)
build_error: 0 (30 days)

I run:

PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" pecl install vips

And actually it worked. Posted here solution for in case.

@apcro
Copy link

apcro commented Sep 5, 2019

For those working on Linux (Ubuntu) who are also seeing this error, you will need to also install libvips-dev, find the vips.pc file and use that path instead.

For example: PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig" pecl install vips

You may also need libvips-tools

@apcro
Copy link

apcro commented Sep 9, 2019

I've also created a gist for installing libvips from source on Ubuntu 18.04 Bionic:

https://gist.github.com/apcro/99ced7c8a5b20fd77622e7394c2049ac

@jcupitt
Copy link
Member

jcupitt commented Sep 9, 2019

Nice! I keep a selection of Dockerfiles here:

https://github.com/jcupitt/docker-builds

Eg. might be relevant:

https://github.com/jcupitt/docker-builds/tree/master/ruby-vips-libvips-ubuntu18.04

@jcupitt
Copy link
Member

jcupitt commented Sep 9, 2019

@alemorcuq
Copy link

alemorcuq commented Sep 23, 2019

Hi,

I'm getting this error too on Debian 9. I have installed libvips42, libvips-dev and libvips-tools from the stable repository, which has version 8.4.5. I'm also using the PKG_CONFIG_PATH environment variable as suggested. Here's some output you may find interesting:

# vips --version
vips-8.4.5-Fri Jan 18 18:15:36 UTC 2019
# find /usr/lib -name vips.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/vips.pc
# PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig pkg-config vips --modversion
8.4.5

This one looks weird: isn't 8.4.5 at least 8.2?

# PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig pkg-config vips --atleast-version=8.2
# echo $?
1
# PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig pecl install vips
downloading vips-1.0.9.tgz ...
Starting to download vips-1.0.9.tgz (558,066 bytes)
.................................................................................................................done: 558,066 bytes
4 source files, building
running: phpize
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
enable vips [yes] : yes
building in /tmp/pear/temp/pear-build-rootWdbZxQ/vips-1.0.9
running: /tmp/pear/temp/vips/configure --with-php-config=/opt/bitnami/php/bin/php-config --with-vips
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /opt/bitnami/php
checking for PHP includes... -I/opt/bitnami/php/include/php -I/opt/bitnami/php/include/php/main -I/opt/bitnami/php/include/php/TSRM -I/opt/bitnami/php/include/php/Zend -I/opt/bitnami/php/include/php/ext -I/opt/bitnami/php/include/php/ext/date/lib
checking for PHP extension directory... /opt/bitnami/php/lib/php/extensions
checking for PHP installed headers prefix... /opt/bitnami/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for vips support... yes, shared
configure: error: you need at least libvips 8.2 for this module
ERROR: `/tmp/pear/temp/vips/configure --with-php-config=/opt/bitnami/php/bin/php-config --with-vips' failed

I've also tried to install the extension manually:

# cd $(mktemp -d)
# curl -sLO https://pecl.php.net/get/vips-1.0.9.tgz
# tar xzf vips-1.0.9.tgz
# cd vips-1.0.9
# phpize
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
# PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig ./configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /opt/bitnami/php
checking for PHP includes... -I/opt/bitnami/php/include/php -I/opt/bitnami/php/include/php/main -I/opt/bitnami/php/include/php/TSRM -I/opt/bitnami/php/include/php/Zend -I/opt/bitnami/php/include/php/ext -I/opt/bitnami/php/include/php/ext/date/lib
checking for PHP extension directory... /opt/bitnami/php/lib/php/extensions
checking for PHP installed headers prefix... /opt/bitnami/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for vips support... yes, shared
configure: error: you need at least libvips 8.2 for this module

Let me know if you need me to provide more information.

Thank you.

@jcupitt
Copy link
Member

jcupitt commented Sep 23, 2019

That is very weird.

You shouldn't need to set PKG_CONFIG_PATH if you are using the standard libvips packages -- you only need to set it if you want pkg-config to pick up a libvips you've built to a non-standard prefix.

I see:

john@yingna ~ $ pkg-config vips --modversion
8.9.0
john@yingna ~ $ pkg-config vips --atleast-version=8.2
john@yingna ~ $ echo $?
0
john@yingna ~ $ pkg-config vips --atleast-version=8.10
john@yingna ~ $ echo $?
1

I'll try debian9 in docker.

@jcupitt
Copy link
Member

jcupitt commented Sep 23, 2019

Yes, this works:

FROM debian:9.11

RUN apt-get update \
    && apt-get install -y \
        php-dev \
        libvips-dev

RUN pecl install vips

I guess there's something funny about your system. Do you have an older libvips somewhere?

I would install the latest libvips from source, myself, but perhaps get the packaged one working first.

@jcupitt
Copy link
Member

jcupitt commented Sep 23, 2019

Here's a dockerfile for libvips latest on debian9.

https://github.com/jcupitt/docker-builds/blob/master/php-vips-debian9/Dockerfile

@alemorcuq
Copy link

Thanks for your input, @jcupitt. I will continue to investigate the issue on my side.

@alemorcuq
Copy link

Hi again, @jcupitt.

I made some advances: in fact, I was able to install the extension using the system packages and compiling the extension. Using pecl did not work.

# PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig pkg-config vips --atleast-version=8.2 --debug --print-errors
...
Searching for 'xau' requirement 'xproto'
Looking for package 'xproto'
Looking for package 'xproto-uninstalled'
Package xproto was not found in the pkg-config search path.
Perhaps you should add the directory containing `xproto.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xproto', required by 'xau', not found

Adding another directory to the PKG_CONFIG_PATH worked:

# PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig pkg-config vips --atleast-version=8.2
# echo $?
0

However, pecl install vips yields the same error:

# PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig pecl install vips
...
configure: error: you need at least libvips 8.2 for this module
ERROR: `/tmp/pear/temp/vips/configure --with-php-config=/opt/bitnami/php/bin/php-config --with-vips' failed

As I mentioned earlier, I was able to make it work compiling the extension from source, so it looks like pecl isn't getting the directories from the PKG_CONFIG_PATH. Anyways, thank you very much for your help.

@the-hotmann
Copy link

the-hotmann commented Dec 23, 2019

Deleted

@peterlozano
Copy link

Anyone got this solved? I'm experiencing the same issue.

I compiled libvips 8.10.2 from source and it is installed at /usr/local (make install), but when I try to do pecl install vips I get configure: error: you need at least libvips 8.2 for this module

@peterlozano
Copy link

Ok, I found the solution. It seems that for pecl install vips to work, you need to have installed all the -dev packages that were used to compile libvips itself.

@boris-glumpler
Copy link

boris-glumpler commented May 18, 2021

I'm trying to get the extension installed on macOS for PHP 8.0.3 via brew install vips. Here's the output of the various pkg-config commands:

pkg-config vips --modversion
8.10.6

pkg-config vips --atleast-version=8.2
echo $?
1

I use PHPBrew locally, so I first tried to install the extension using:

phpbrew ext install vips

This didn't work, so I switched to system PHP and tried regular old PECL:

pecl install vips

Both of these resulted in the same error message:

configure: error: you need at least libvips 8.2 for this module

Is there anything more I can try to figure out what is causing the issue? Or any pointers?

Cheers!

@boris-glumpler
Copy link

Ok, so solved it by following the output of pkg-config vips --cflags. Turns out there was a whole chain of packages that couldn't be found. In my case these were: openexr, imath, libxau, libxdmcp, libxrender, libx11, libxext. So I looked up the location of their pkgconfig directory, usually /usr/local/Cellar/{package}/{version}/lib/pkgconfig and added these paths to PKG_CONFIG_PATH. Installation worked flawlessly after that!

@djunny
Copy link

djunny commented Aug 2, 2021

for example:

PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/local/Cellar/openexr/3.0.4/lib/pkgconfig:/usr/local/Cellar/imath/3.0.5/lib/pkgconfig:/usr/local/Cellar/libxau/1.0.9/lib/pkgconfig/:/usr/local/Cellar/libxdmcp/1.1.3/lib/pkgconfig:/usr/local/Cellar/libxrender/0.9.10/lib/pkgconfig/:/usr/local/Cellar/libx11/1.7.2/lib/pkgconfig:/usr/local/Cellar/libxext/1.3.4/lib/pkgconfig/" pecl install vips

it's solved. thank you very much.

@xepozz
Copy link

xepozz commented Jun 22, 2022

Any ideas how to fix it in docker alpine + php 8.1?

@xepozz
Copy link

xepozz commented Jun 22, 2022

Did it with the following snippet:

RUN apk add libffi-dev \
    && docker-php-ext-configure ffi --with-ffi \
    && docker-php-ext-install ffi \
    \
    && apk add --repository http://dl-3.alpinelinux.org/alpine/edge/community  \
       vips vips-tools vips-dev \
    && pecl install vips-1.0.13 \
    && docker-php-ext-enable vips \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants