[CMake] trouble finding libraries on 64 bit

Bill Hoffman bill.hoffman at kitware.com
Fri Jan 5 14:37:14 EST 2007


Wojciech Jarosz wrote:
> 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
What version of cmake are you using?  CMake should automatically change 
all of the lib to lib64 and search in those directories on 64 bit 
builds.  Are you sure the compiler is set to 64 bit?  Look at the size 
of void* test result in your CMakeCache.txt.

-Bill



More information about the CMake mailing list