find_package() locating 32bit libs incorrectly

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

find_package() locating 32bit libs incorrectly

Paul Smith
Hi all.

I'm trying to build LLVM/Clang locally on my Linux system, but I'm using
a separate set of system headers and libraries.  These appear in a
separate sysroot directory, like this:

  /sysroot/tools/usr/lib64/...
  /sysroot/tools/usr/lib/...
  /sysroot/tools/usr/include/...

This is basically an extracted set of Red Hat 6 system libraries, so the
content in usr/lib are 32bit libraries and the content in usr/lib64 are
64bit libraries.

I'm building LLVM/Clang 4.0 and in the Clang CMakeLists.txt file we have
simply:

  find_package(LibXml2 2.5.3 QUIET)

There are libxml2.so files in both the 64bit and 32bit lib directories
above as well as the usr/include directory.

I run cmake with -DCMAKE_PREFIX_PATH=/sysroot/tools/usr, and CMake finds
things in my sysroot.  However, it uses the *32bit* libraries instead of
the 64bit ones; CMakeCache.txt says:

  //Path to a file.
  LIBXML2_INCLUDE_DIR:PATH=/sysroot/tools/usr/include/libxml2

  //Path to a library.
  LIBXML2_LIBRARIES:FILEPATH=/sysroot/tools/usr/lib/libxml2.so

The latter should be finding usr/lib64/libxml2.so instead.  Because of
this incorrect behavior the link of Clang fails (because it's a 64bit
executable trying to link a 32bit library).

I'm using a slightly older CMake (3.5.2) but I'd assume find_package()
understands the standard directory structure used by Red Hat.

Is there a way to convince CMake find_package() to look in the right
directory?
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...