# 'Could not find CMAKE\_ROOT' error from AppImage

**URL:** https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604
**Category:** Usage
**Created:** [December 6, 2021, 3:10pm UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604 "2021-12-06T15:10:57Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![abuzila](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abuzila/32/2011_2.png) [@abuzila](https://discourse.cmake.org/u/abuzila)
#### Post date: [December 6, 2021, 3:10pm UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604/1 "2021-12-06T15:10:57Z")

</div>

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:

```auto
 % 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!

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [December 11, 2021, 7:13pm UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604/2 "2021-12-11T19:13:23Z")

</div>

It seems that whatever CMake packaging you have is busted. Can you use [the official binaries](https://cmake.org/download/)?

---

<div class="post-metadata">

### Author: ![abuzila](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abuzila/32/2011_2.png) [@abuzila](https://discourse.cmake.org/u/abuzila)
#### Post date: [December 20, 2021, 5:34pm UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604/3 "2021-12-20T17:34:02Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [December 21, 2021, 2:08pm UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604/4 "2021-12-21T14:08:47Z")

</div>

> [@abuzila](#):
>
> The version I have installed is an official one.

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

> [@abuzila](#):
>
> However, the PATH appears to be set up correctly and I could find no obvious reasons as to why the error is occurring.

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

---

<div class="post-metadata">

### Author: ![abuzila](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abuzila/32/2011_2.png) [@abuzila](https://discourse.cmake.org/u/abuzila)
#### Post date: [December 22, 2021, 5:44pm UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604/5 "2021-12-22T17:44:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)
#### Post date: [December 23, 2021, 8:17am UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604/6 "2021-12-23T08:17:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![abuzila](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abuzila/32/2011_2.png) [@abuzila](https://discourse.cmake.org/u/abuzila)
#### Post date: [January 10, 2022, 8:18am UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604/7 "2022-01-10T08:18:55Z")

</div>

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:

```auto
% 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:

```auto
% 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).

```

---

<div class="post-metadata">

### Author: ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)
#### Post date: [January 10, 2022, 5:50pm UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604/8 "2022-01-10T17:50:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Marco\_Speziali](https://discourse.cmake.org/user_avatar/discourse.cmake.org/marco_speziali/32/3021_2.png) [@Marco\_Speziali](https://discourse.cmake.org/u/Marco_Speziali)
#### Post date: [December 19, 2022, 9:45pm UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604/9 "2022-12-19T21:45:18Z")

</div>

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`

---

<div class="post-metadata">

### Author: ![abuzila](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abuzila/32/2011_2.png) [@abuzila](https://discourse.cmake.org/u/abuzila)
#### Post date: [December 20, 2022, 2:34pm UTC](https://discourse.cmake.org/t/could-not-find-cmake-root-error-from-appimage/4604/10 "2022-12-20T14:34:21Z")

</div>

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