You are not logged in.

#1 2022-05-31 12:52:14

frankplow
Member
Registered: 2016-10-12
Posts: 10

[Solved] CMake using wrong path for *Config.cmake files

Recently, CMake has started locating *Config.cmake files under /lib64, instead of /usr/lib64.

This has been drawn to my attention because glm's supplied glmConfig.cmake is not very robust and depends on the absolute path (see here), giving the error

CMake Error at /lib64/cmake/glm/glmConfig.cmake:10 (message):
    File or directory //include referenced by variable GLM_INCLUDE_DIRS does not exist!

Bit of an aside, but I tried changing the get_filename_component call to use REALPATH instead of ABSOLUTE in order to follow the symlinks, but CMake seems to handle upwards traversal of symlinks differently to linux - not sure if this is a bug or intended to improve portability?

The response to this bug report suggested that the issue could be due my PATH variable. See the CMake documentation for a full description but, after various CMake-specific cache variables and environment variables, which are all unset, each path from PATH is used to search for the config files. If the path ends in /bin or /sbin, then it searches under ../{lib64,lib32,lib}, otherwise it searches under /{lib64,lib32,lib}

My PATH variable is

~ % echo $PATH | sed -e 's/:/\n/g'
/sbin
/bin
/usr/local/sbin
/usr/local/bin
/usr/bin
/usr/sbin
/home/frank/fun/soft/go/bin
/home/frank/scripts
/home/frank/.dotnet/tools
/home/frank/.local/bin
/home/frank/fun/soft/go/bin
/home/frank/scripts
/home/frank/.dotnet/tools
/home/frank/.local/bin
/usr/lib/jvm/default/bin
/opt/intelFPGA/20.1/modelsim_ase/bin
/usr/bin/site_perl
/usr/bin/vendor_perl
/usr/bin/core_perl
/opt/intelFPGA/21.1/quartus/bin
/opt/intelFPGA/21.1/quartus/sopc_builder/bin

/bin and /sbin lead to /lib64 being added the the CMake search path, which explains why the config file is being found there, but I'm not sure what's adding them to PATH. They're not in any environment.d files or any shell startup scripts.

Should /bin and /sbin be in PATH? Even if I remove these from PATH however, the config file is still found at the same location and I still get the same error:

% PATH=/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin cmake -S . -B build
CMake Error at /lib64/cmake/glm/glmConfig.cmake:10 (message):
    File or directory //include referenced by variable GLM_INCLUDE_DIRS does not exist!

Thanks in advance.

Last edited by frankplow (2022-05-31 13:50:42)

Offline

#2 2022-05-31 13:21:34

frankplow
Member
Registered: 2016-10-12
Posts: 10

Re: [Solved] CMake using wrong path for *Config.cmake files

I've found where /bin and /sbin were added to the path and removed them as I'm fairly certain they shouldn't be there, however the issue persists. My PATH is now:

% echo $PATH | sed -e 's/:/\n/g'
/usr/local/sbin
/usr/local/bin
/usr/bin
/usr/sbin
/home/frank/fun/soft/go/bin
/home/frank/scripts
/home/frank/.dotnet/tools
/home/frank/.local/bin
/home/frank/fun/soft/go/bin
/home/frank/scripts
/home/frank/.dotnet/tools
/home/frank/.local/bin
/usr/lib/jvm/default/bin
/opt/intelFPGA/20.1/modelsim_ase/bin
/usr/bin/site_perl
/usr/bin/vendor_perl
/usr/bin/core_perl
/opt/intelFPGA/21.1/quartus/bin
/opt/intelFPGA/21.1/quartus/sopc_builder/bin

I have to admit this leaves me a little more lost, as now I can't see how CMake would find the file at the location it does according to its documentation.

Offline

#3 2022-05-31 13:52:33

frankplow
Member
Registered: 2016-10-12
Posts: 10

Re: [Solved] CMake using wrong path for *Config.cmake files

Managed to fix this - I'd sorted it by removing /bin and /sbin from PATH but forgot to clear the CMake build directory, where it had cached the old PATH so the the change was not taking effect.

Offline

Board footer

Powered by FluxBB