[CMake] trouble finding libraries on 64 bit

Wojciech Jarosz wjarosz at ucsd.edu
Fri Jan 5 12:16:08 EST 2007


Hi all,
I've been using cmake for a while now on my c++ code. Yesterday I
tried compiling my code for the first time on a 64 bit machine

My main CMakeLists.txt file tries to find libtiff and libpng (among
other image libraries). The problem is that FIND_PACKAGE(TIFF) returns
/usr/lib/libtiff.so as ${TIFF_LIBRARIES}, even though this file does
not exist. The same thing is true for OpenEXR, libPNG, etc.

Looking at the rpm libtiff:
/usr/lib/libtiff.so.3
/usr/lib/libtiff.so.3.8.2
/usr/lib/libtiffxx.so.3
/usr/lib/libtiffxx.so.3.8.2
/usr/lib64/libtiff.so.3
/usr/lib64/libtiff.so.3.8.2
/usr/lib64/libtiffxx.so.3
/usr/lib64/libtiffxx.so.3.8.2
...

and libtiff-devel includes:
/usr/lib64/libtiff.so
/usr/lib64/libtiffxx.so
...

On this machine libtiff.so is installed in /usr/lib64 and libtiff.so.3
is installed in /usr/lib. I could manually symlink the so files, but
that doesn't seem like a very elegant or scalable solution (I have
several libraries I need to link against that exhibit this problem).
Any idea how I can fix this?

I am running on a run-of-the-mill fedora core 5 machine:

uname -a
Linux grid 2.6.18-1.2257.fc5 #1 SMP Fri Dec 15 16:07:14 EST 2006
x86_64 x86_64 x86_64 GNU/Linux


The relevent portion of my CMakeLists.txt file:

FIND_PACKAGE(TIFF)
IF(TIFF_FOUND)
    SET(HAVE_LIBTIFF 1)
    SET(IMG_LIBRARIES ${IMG_LIBRARIES} ${TIFF_LIBRARIES})
    SET(IMG_INCLUDE_DIR ${IMG_INCLUDE_DIR} ${TIFF_INCLUDE_DIR})
ENDIF(TIFF_FOUND)

Then at the end of the CMakeLists.txt file I print out some of the
info for debug purposes:

MESSAGE("
---------------------------------------------
Summary for features:

  IMG_LIBRARIES.............: ${IMG_LIBRARIES}
  IMG_INCLUDE_DIR...........: ${IMG_INCLUDE_DIR}
  TIFF_LIBRARIES............: ${TIFF_LIBRARIES}
")

This outputs:

---------------------------------------------
Summary for features:
 IMG_LIBRARIES.............:
/usr/lib/libpng.so;/usr/lib/libz.so;/usr/lib/libtiff.so;/usr/lib/libjpeg.so;/usr/lib/libImath.so;/usr/lib/libIlmImf.so;/usr/lib/libIex.so;/usr/lib/libHalf.so
  IMG_INCLUDE_DIR...........:
/usr/include;/usr/include;/usr/include;/usr/include;/usr/include/OpenEXR
  TIFF_LIBRARIES............: /usr/lib/libtiff.so


Thanks!
-wojciech jarosz


More information about the CMake mailing list