failure to build Cmake to / against non-standard directory under Linux

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

failure to build Cmake to / against non-standard directory under Linux

Ben Sferrazza
I have a completely insulated boostrapped toolchain+binaries setup (located under /home/tools), following much of the Linux From Scratch book, that has been able to build everything that I throw at it. Most things just work with a simple --prefix option, as I have also edited the GCC specs file to include my /home/tools/include directory (using -isystem) and link against my /home/tools/lib directory (also with an rpath set, so that all binaries I build are complete insulated from the host libraries). The lone exception to this is Cmake. It appears to have a lot of hardcoded paths in its build environment to standard /usr/* directories.

I first got wind that something was awry when Cmake 3.10.2 claimed my compiler, GCC 7.3.0, isn't C++11 compliant. Clearly this isn't the case, given that it's the latest release. So I then tried building Cmake 3.9.6, which doesn't require C++11, and it was finding zlib and other libraries under /usr/lib as opposed to my /home/tools/lib. I don't even have LD_LIBRARY_PATH set, as I use rpath in the specs file like I mentioned. Can anyone provide any help into how I can get Cmake to build against non-standard include and library locations?

Thank you,
Ben

--

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:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: failure to build Cmake to / against non-standard directory under Linux

Ben Sferrazza
I was able to get 3.9.6 to compile setting CMAKE_PREFIX_PATH to the same path that I pass .bootstrap with --prefix. I also had to patch the Modules/Compiler/GNU.cmake file to use -idirafter rather than -isystem as the latter leads to issues with #include_next.

I'm still perplexed why 3.10.2 thinks doesn't think my compiler, GCC 7.3.0, is C++11 compliant. The only thing I can think of is that I am using a somewhat older version of Glibc, 2.19, as that is the newest version compatible with the host's kernel of 2.6.18. However, that glibc was released in 2014, so I would think that wouldn't be the case.

On Fri, Mar 2, 2018 at 10:04 AM, Ben Sferrazza <[hidden email]> wrote:
I have a completely insulated boostrapped toolchain+binaries setup (located under /home/tools), following much of the Linux From Scratch book, that has been able to build everything that I throw at it. Most things just work with a simple --prefix option, as I have also edited the GCC specs file to include my /home/tools/include directory (using -isystem) and link against my /home/tools/lib directory (also with an rpath set, so that all binaries I build are complete insulated from the host libraries). The lone exception to this is Cmake. It appears to have a lot of hardcoded paths in its build environment to standard /usr/* directories.

I first got wind that something was awry when Cmake 3.10.2 claimed my compiler, GCC 7.3.0, isn't C++11 compliant. Clearly this isn't the case, given that it's the latest release. So I then tried building Cmake 3.9.6, which doesn't require C++11, and it was finding zlib and other libraries under /usr/lib as opposed to my /home/tools/lib. I don't even have LD_LIBRARY_PATH set, as I use rpath in the specs file like I mentioned. Can anyone provide any help into how I can get Cmake to build against non-standard include and library locations?

Thank you,
Ben


--

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:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: failure to build Cmake to / against non-standard directory under Linux

Chuck Atkins
In reply to this post by Ben Sferrazza
CMAKE_PREFIX_PATH just adds a set of search paths.  To instead have it shift it's entire search infrastructure, you can use the CMAKE_FIND_ROOT_PATH CMake variable and a few associated with it, which will cause the entire set of search heuristics to be re-rooted in the specified path.  First run the bootstrap step:

mkdir build
cd build
../bootstrap

Then use the bootstrapped CMake with the find root path settings:

./Bootstrap.mk/cmake \
  -DCMAKE_FIND_ROOT_PATH=/home/tools \
  -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
  -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
  -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \
  -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=ONLY \
  -DCMAKE_USE_SYSTEM_LIBRARIES=ON \
  -DCMAKE_INSTALL_PREFIX=/home/tools \
  ..

make -j8

make install


- Chuck


--

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:
https://cmake.org/mailman/listinfo/cmake