libvips / libvips

A fast image processing library with low memory needs.
https://libvips.github.io/libvips/
GNU Lesser General Public License v2.1
9.66k stars 669 forks source link

vips make error #353

Closed ken0nek closed 8 years ago

ken0nek commented 8 years ago

Hi I want to use dzsave and tried to install vips 8.1.2 Then ./configure says

* build options
native win32:               no
native OS X:                no
open files in binary mode:      no
enable debug:               no
build deprecated components:        yes
build docs with gtkdoc:         no
gobject introspection:          no
build vips7 Python binding:     yes
install vips8 Python overrides:     no
  (requires pygobject-3.12.0 or later)

* optional dependencies
use fftw3 for FFT:          yes
Magick package:             MagickWand
file import with libMagick:         yes
accelerate loops with orc:      yes
  (requires orc-0.4.11 or later)
ICC profile support with lcms:      yes (lcms1)
file import with OpenEXR:       no
file import with OpenSlide:     yes
  (requires openslide-3.3.0 or later)
file import with matio:         no
file import with cfitsio:       no
file import/export with libwebp:    no
text rendering with pangoft2:       yes
file import/export with libpng:     yes (pkg-config libpng >= 1.2.9)
  (requires libpng-1.2.9 or later)
file import/export with libtiff:    yes (found by search)
file import/export with libjpeg:    yes
image pyramid export:           yes
  (requires libgsf-1 1.14.27 or later)
use libexif to load/save JPEG metadata: yes

then make gets errors below

/bin/sh ../libtool  --tag=CC   --mode=link gcc -std=gnu99  -g -O2   -o vips vips.o -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -pthread -fopenmp -I/usr/lib64/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/orc-0.4 -I/usr/include/openslide -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libgsf-1 -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/ImageMagick ../libvips/libvips.la -lMagickWand -lMagickCore   -lpng12   -ltiff -lz -ljpeg -pthread -lgthread-2.0 -lrt -lglib-2.0   -Wl,--export-dynamic -pthread -lgmodule-2.0 -lxml2 -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0   -pthread -lpangoft2-1.0 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0   -pthread -lgsf-1 -lgobject-2.0 -lxml2 -lgthread-2.0 -lrt -lglib-2.0   -lfftw3 -lm   -lorc-0.4   -llcms    -lopenslide      -lexif   -lm
libtool: link: gcc -std=gnu99 -g -O2 -o .libs/vips vips.o -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -pthread -fopenmp -I/usr/lib64/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/orc-0.4 -I/usr/include/openslide -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libgsf-1 -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/ImageMagick -pthread -Wl,--export-dynamic -pthread -pthread -pthread  ../libvips/.libs/libvips.so -lMagickWand -lMagickCore -lpng12 -ltiff -lz -ljpeg -lpangoft2-1.0 -lpango-1.0 -lfreetype -lfontconfig -lgmodule-2.0 -lgsf-1 -lgobject-2.0 -lxml2 -lgthread-2.0 -lrt -lglib-2.0 -lfftw3 -lorc-0.4 -llcms -lopenslide -lexif -lm -fopenmp -pthread
../libvips/.libs/libvips.so: undefined reference to `openslide_detect_vendor'
../libvips/.libs/libvips.so: undefined reference to `openslide_get_level_downsample'
../libvips/.libs/libvips.so: undefined reference to `openslide_get_level_dimensions'
../libvips/.libs/libvips.so: undefined reference to `openslide_get_level_count'
collect2: ld returned 1 exit status
make[2]: *** [vips] Error 1
make[2]: Leaving directory `/home/ken0nek/vips-8.1.2/tools'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ken0nek/vips-8.1.2'
make: *** [all] Error 2

./configure detects openslide correctly but it makes error :(

same error occurs even vips 7.40.11

jcupitt commented 8 years ago

Hi @ken0nek, it looks like an openslide install issue to me. Perhaps openslide.pc is being found, but the actual libraries are not?

Try:

$ pkg-config openslide --libs
-L/usr/local/Cellar/openslide/3.4.1_1/lib -lopenslide

Then verify that there are libraries in that directory:

$ ls /usr/local/Cellar/openslide/3.4.1_1/lib
libopenslide.0.dylib libopenslide.dylib   pkgconfig

And that your linker has been configured to search there. You may need to set LD_LIBRARY_PATH, edit ld.so.conf, or something else, depending on your platform.

If this is linux, your platform libvips should have dzsave. It's worth checking there too.

bgilbert commented 8 years ago

VIPS is trying to link against a version of OpenSlide older than 3.3.0. That's strange, because configure should prevent that from happening. Are you on Ubuntu 12.04, by any chance? Is it possible that you have multiple copies of OpenSlide installed on your system?

jcupitt commented 8 years ago

Oh, I thought of another possibility. I think you have a openslide.pc file and headers for 3.4.0 or later, but at link time you are picking up a very old openslide lib.

I would either remove the ancient openslide, or configure your linker to use the new one in preference, by setting LD_LIBRARY_PATH or editing ld.so.conf.

ken0nek commented 8 years ago

Thank you for your great comments I really appreciate it :)

I did this in Cent OS 6.7 and I compiled openslide3.4.0 from source.

$ pkg-config openslide --libs
-lopenslide
echo $LD_LIBRARY_PATH
/usr/local/lib:/usr/lib:/usr/local/cuda/lib64:/usr/local/lib64/perl5/Alien/wxWidgets/gtk_2_8_12_uni/lib/:/usr/local/bamtools/lib/bamtools:/usr/local/arb/LIBLINK:/usr/local/gridscheduler/lib/linux-x64:/usr/local/lib:/usr/lib:/usr/local/cuda/lib64:/usr/local/lib64/perl5/Alien/wxWidgets/gtk_2_8_12_uni/lib/:/usr/local/bamtools/lib/bamtools:/usr/local/arb/LIBLINK:/usr/local/gridscheduler/lib/linux-x64:/usr/local/lib:/usr/lib:/usr/local/cuda/lib64:/usr/local/lib64/perl5/Alien/wxWidgets/gtk_2_8_12_uni/lib/:/usr/local/bamtools/lib/bamtools:/usr/local/arb/LIBLINK:/usr/local/gridscheduler/lib/linux-x64:/usr/local/cuda/lib64:/usr/local/gridscheduler/lib/linux-x64

and I check pkg-config

$ pwd
/usr/local/lib/pkgconfig
$ cat openslide.pc
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: openslide
Description: A library for reading whole slide images.

Version: 3.4.0
Libs: -L${libdir} -lopenslide
Cflags: -I${includedir}/openslide
$ pwd
/usr/lib/pkgconfig
$ cat openslide.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: openslide
Description: A library for reading whole slide images.

Version: 3.4.0
Libs: -L${libdir} -lopenslide
Cflags: -I${includedir}/openslide
/usr/lib

libopenslide.la, libopenslide.so, libopenslide.so.0, libopenslide.so.0.4.0
/usr/local/lib

libopenslide.la, libopenslide.so, libopenslide.so.0, libopenslide.so.0.4.0

any suggestions?

jcupitt commented 8 years ago

I think your linker is not using /usr/local/lib, it's linking to the old libraries in /usr/lib. You can either set the LD_LIBRARY_PATH environment variable, or edit ld.so.conf.

It looks like you've maybe partially installed openslide to /usr as well, since that .pc file seems to be 3.4.0. That's probably not a good idea, your package manager should be running the files in that area. Do you have an old openslide installed via yum as well? It might be a good idea to remove that, if you're not using it elsewhere.

ken0nek commented 8 years ago

Finally it worked!!

I change LD_LIBRARY_PATH, execute yum remove openslide as you said. and add export PKG_CONFIG_PATH=/usr/lib/pkgconfig/

Thank you all (@bgilbert, @jcupitt) for helping me.