find_package() locating 32bit libs incorrectly

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

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:


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

  find_package(LibXml2 2.5.3 QUIET)

There are 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.

  //Path to a library.

The latter should be finding usr/lib64/ 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

Powered by

Please keep messages on-topic and check the CMake FAQ at:

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

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: