'Could not find CMAKE_ROOT' error from AppImage

Hello,

I’m building an application based on Eclipse Theia and packaging it with the electron-builder in an AppImage file, on linux. Calling cmake from a terminal opened in this product shows an error, like in the example below:

 % cmake --version
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in

cmake version 3.16.3

If I open a new shell in the same terminal, e.g. by calling bash, the error is gone. This lead me to believe that cmake is somehow incorrectly initialized in the original shell, but I wasn’t able to identify the issue.

I only have one version of cmake installed (3.16.3) and I’m running on Ubuntu 20.04.3 LTS.

I would appreciate any hints at what cmake might be missing or what might not be correctly configured.

Thanks!

1 Like

It seems that whatever CMake packaging you have is busted. Can you use the official binaries?

Hi @ben.boeckel! Thank you for the reply.

The version I have installed is an official one.
Just to clarify, CMake works correctly on my machine. The error above occurs only when, on the same system, I try to access CMake from a terminal opened in Eclipse Theia, after starting the application from an AppImage file. CMake works correctly in Theia as well, when the application is started from the source code, so this led me to believe that something is not correctly set up when the app is packaged in an AppImage file.

However, the PATH appears to be set up correctly and I could find no obvious reasons as to why the error is occurring. I was hoping that somebody might have any pointers at what else could be wrong in the app environment.

I was not aware that we had official AppImage binaries. Where do you get it from?

I imagine that whatever is embedding CMake into whatever sandbox environment AppImage is using is not preserving the install layout CMake expects.

I was not aware that we had official AppImage binaries. Where do you get it from?

CMake was not installed from an AppImage. The application I was testing and trying to run CMake from (Eclipse Theia) was launched from an AppImage when the error occurred.

Sorry if I wasn’t clear in my explanation.

When CMake wasn’t installed from an app image then where does it come from, that is the question. Your system administrator should be able to help you with this issue.

CMake 3.16.3 is the version used in the official Ubuntu packages for 20.04.3 LTS. This means it was likely installed with the apt package manager.

Eclipse might have a bundled CMake, I don’t know if that is a possibility. You could have more CMake installations on your machine than you are aware of. In each shell, run the command which cmake and compare the paths. The version number could also be different. Please post the results here.

Hi @hex!

When CMake wasn’t installed from an app image then where does it come from, that is the question. Your system administrator should be able to help you with this issue.
CMake 3.16.3 is the version used in the official Ubuntu packages for 20.04.3 LTS. This means it was likely installed with the apt package manager.

Indeed, CMake was installed from the Ubuntu package repository.

Eclipse might have a bundled CMake, I don’t know if that is a possibility. You could have more CMake installations on your machine than you are aware of. In each shell, run the command which cmake and compare the paths. The version number could also be different. Please post the results here.

There’s only one version of CMake on my system, Eclipse doesn’t bundle one in this case.

This is what I see in a normal shell:

% which cmake
/usr/bin/cmake

% cmake -version
cmake version 3.16.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

And this is the output from a shell opened in Eclipse Theia:

% which cmake
/usr/bin/cmake

% cmake -version
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in

cmake version 3.16.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Ah, from what you’ve posted CMAKE_ROOT is set to empty. It should be CMAKE_ROOT="/usr/share/cmake-3.16" but somehow in your Eclipse environment it is CMAKE_ROOT="". I am not at all familiar with Eclipse so i cannot help further, unfortunately. Since CMake is working with the IDE i could think that the Eclipse terminal is manipulating this variable somehow.

1 Like

Hi @abuzila have you managed to find a solution? I’m facing the exact same problem with the AppImage generated by electron-builder packaging theia

Hi @Marco_Speziali,
no, unfortunately I did not find a fix for this.