Hi,
I downloaded root source code from the root git repository with git tag v6-28-06
. I initially build it with gcc version 9.4.0 (that’s the default compiler for ubuntu 20.04). When first configuring cmake against the root source code, initially it complained about not finding LZ4 and X11. Once I installed both LZ4 and X11, the configuration passed (having no problems finding LZ4 and X11) and the build was successful. I initially wanted to at least build root with the default compiler I had on my ubuntu, before attempting to build it against the desired toolchain (a newer gcc compiler (10.0.2) with a tailored sysroot).
So when I finally tried to build it with a specified cmake toolchain file (e.g. cmake -DCMAKE_TOOLCHAIN_FILE=<my-toolchain.cmake> <root-src-dir>
), I get an error during its cmake configuration:
-- Looking for LZ4
-- Could NOT find LZ4 (missing: LZ4_LIBRARY) (found version "1.9.2")
-- LZ4 not found. Switching on builtin_lz4 option
-- Looking for X11
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find X11 (missing: X11_X11_LIB)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindX11.cmake:366 (find_package_handle_standard_args)
cmake/modules/SearchInstalledSoftware.cmake:18 (_find_package)
cmake/modules/SearchInstalledSoftware.cmake:366 (find_package)
CMakeLists.txt:254 (include)
In my cmake toolchain file, I specified the location of the desired C/C++ compiler via CMAKE_C_COMPILER
and CMAKE_CXX_COMPILER
and the desired sysroot directory via CMAKE_SYSROOT
. I did also set the root path to look at both the targeted and host directories:
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
SET(CMAKE_SYSTEM_PROCESSOR x86_64)
The goal here is, to use the specified C/C++ compliler and compiling/linking against the std libs found at the specified sysroot directory. But I want it to pick up packages like LZ4 and X11 at the host directories, where it had no problem finding it earlier, when I did not configure cmake with the CMAKE_TOOLCHAIN_FILE option. There are other libraries in the sysroot directory other than the std libs but LZ4 and X11 libraries are not among them.
So why is it failing to find LZ4 and X11 only when specifying a cmake toolchain file? The only difference here is a newer gcc compiler and specified sysroot, which shouldn’t impact its ability to find those packages.
Please read tips for efficient and successful posting and posting code
Please fill also the fields below. Note that root -b -q
will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug
from the ROOT prompt to pre-populate a topic.
_ROOT Version:v6-28-06
_Platform:linux, ubuntu 20.04
_Compiler:GCC 10.0.2