CMAKE_ROOT variable not set after building AppImage

Hi everyone, I’m currently building an IDE based on theia@1.31.1. Prior to packaging the IDE using electron-builder everything works fine. To be more specific the command cmake .. correctly configures the build folder. Running the IDE using the generated AppImage the configure command fails with the following error:

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

CMake Error: Error executing cmake::LoadCache(). Aborting.

The same error pops out after running cmake --version in the integrated terminal:

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

cmake version 3.25.1

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

Seems like the environment variable CMAKE_ROOT is set to "" after packaging.
Any idea on how to solve this issue?

Thanks,
Marco

Hey @MarcoSpeziali,

I’m wondering whether this might be an error in the way we propagate env variables to the terminal inside of Theia. Can you print all env variables in the Theia terminal compared to a normal shell? Are there any other differences aside from the CMAKE_ROOT?

Thanks @msujew for the reply. And sorry for the long delay.
Here’s the diff between printenv executed in the terminal and executed in the integrated terminal:

$ diff terminal.printenv theia.printenv
< COLORFGBG=15;0
---
> SHELL=/usr/bin/zsh
> LSCOLORS=Gxfxcxdxbxegedabagacad
> SESSION_MANAGER=local/marco-manjaro:@/tmp/.ICE-unix/1798,unix/marco-manjaro:/tmp/.ICE-unix/1798
> WINDOWID=58720266
> QT_SCREEN_SCALE_FACTORS=DVI-D-0=1;HDMI-0=1;DP-0=1;DP-1=1;DP-2=1;DP-3=1;DP-4=1;DP-5=1;
3,4c7,18
< DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
< DEBUGINFOD_URLS=https://debuginfod.archlinux.org
---
> REDIRECT_APPIMAGE=/home/marco/Documents/Development/Arox/tools/theia-ride/electron-app/dist/AroxStudio-0.0.1.AppImage
> XDG_CONFIG_DIRS=/home/marco/.config/kdedefaults:/etc/xdg
> LESS=-R
> XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
> NVM_INC=/home/marco/.nvm/versions/node/v14.17.0/include/node
> DESKTOPINTEGRATION=AppImageLauncher
> _P9K_TTY=/dev/pts/3
> SSH_KEY_PATH=~/.ssh/rsa_id
> LC_ADDRESS=it_IT.UTF-8
> LC_NAME=it_IT.UTF-8
> P9K_TTY=old
> SHELL_SESSION_ID=a63bc86f3dff4ddda11e2a825b4e6dcc
6,9c20,21
< DISPLAY=:0
< GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/marco/.gtkrc-2.0:/home/marco/.config/gtkrc-2.0
< GTK3_MODULES=xapp-gtk3-module
< GTK_MODULES=canberra-gtk-module
---
> LC_MONETARY=it_IT.UTF-8
> arox=/home/marco/Documents/Development/Arox
10a23,37
> XCURSOR_SIZE=24
> EDITOR=vim
> GTK_MODULES=canberra-gtk-module
> XDG_SEAT=seat0
> dev=/home/marco/Documents/Development
> PWD=/home/marco/AroxStudioProjects/NewProject13
> GSETTINGS_SCHEMA_DIR=/tmp/.mount_AroxStcsvW9S/usr/share/glib-2.0/schemas:
> XDG_SESSION_DESKTOP=KDE
> LOGNAME=marco
> XDG_SESSION_TYPE=x11
> SYSTEMD_EXEC_PID=1964
> CXX=/bin/clang++
> XAUTHORITY=/home/marco/.Xauthority
> MOTD_SHOWN=pam
> GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/marco/.gtkrc-2.0:/home/marco/.config/gtkrc-2.0
12,17c39,42
< INVOCATION_ID=548ea965871a482dbe3e4e46b6204028
< JOURNAL_STREAM=8:34881
< KDE_APPLICATIONS_AS_SCOPE=1
< KDE_FULL_SESSION=true
< KDE_SESSION_UID=1000
< KDE_SESSION_VERSION=5
---
> LC_PAPER=it_IT.UTF-8
> LANG=en_US.UTF-8
> LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:
> XDG_CURRENT_DESKTOP=KDE
19c44,47
< KONSOLE_DBUS_SESSION=/Sessions/2
---
> KONSOLE_DBUS_SESSION=/Sessions/1
> VIRTUAL_ENV_DISABLE_PROMPT=1
> XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
> INVOCATION_ID=548ea965871a482dbe3e4e46b6204028
21,23c49,54
< LANG=en_US.UTF-8
< LANGUAGE=
< LC_ADDRESS=it_IT.UTF-8
---
> MANAGERPID=1723
> APPDIR=/tmp/.mount_AroxStcsvW9S
> KDE_SESSION_UID=1000
> NVM_DIR=/home/marco/.nvm
> XDG_SESSION_CLASS=user
> TERM=xterm-256color
25,29c56,65
< LC_MEASUREMENT=it_IT.UTF-8
< LC_MONETARY=it_IT.UTF-8
< LC_NAME=it_IT.UTF-8
< LC_NUMERIC=it_IT.UTF-8
< LC_PAPER=it_IT.UTF-8
---
> ZSH=/home/marco/.oh-my-zsh
> USER=marco
> COLORFGBG=15;0
> OWD=/home/marco/Documents/Development/Arox/tools/theia-ride
> KDE_SESSION_VERSION=5
> PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket
> DISPLAY=:0
> SHLVL=2
> NVM_CD_FLAGS=-q
> PAGER=less
30a67,74
> LC_MEASUREMENT=it_IT.UTF-8
> XDG_VTNR=1
> XDG_SESSION_ID=2
> QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
> LD_LIBRARY_PATH=/tmp/.mount_AroxStcsvW9S/usr/lib:
> APPIMAGE=/home/marco/Documents/Development/Arox/tools/theia-ride/electron-app/dist/AroxStudio-0.0.1.AppImage
> XDG_RUNTIME_DIR=/run/user/1000
> DEBUGINFOD_URLS=https://debuginfod.archlinux.org
32,40c76,77
< LOGNAME=marco
< MAIL=/var/spool/mail/marco
< MANAGERPID=1723
< MOTD_SHOWN=pam
< OLDPWD=/home/marco
< PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket
< PATH=/home/marco/.nvm/versions/node/v14.17.0/bin:/home/marco/.local/bin:/home/marco/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/home/marco/Documents/Development/Arox/isa/arox-llvm/llvm/build/bin:/home/marco/.spicetify/:/home/marco/.sw/bin:/home/marco/.spicetify
< PROFILEHOME=
< PWD=/home/marco/Downloads
---
> P9K_SSH=0
> ELECTRON_TRASH=gio
42,53c79
< QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
< QT_SCREEN_SCALE_FACTORS=DVI-D-0=1;HDMI-0=1;DP-0=1;DP-1=1;DP-2=1;DP-3=1;DP-4=1;DP-5=1;
< SESSION_MANAGER=local/marco-manjaro:@/tmp/.ICE-unix/1798,unix/marco-manjaro:/tmp/.ICE-unix/1798
< SHELL=/usr/bin/zsh
< SHELL_SESSION_ID=7dc928f07c6b486aafe58f19ad174f2a
< SHLVL=1
< SYSTEMD_EXEC_PID=1964
< TERM=xterm-256color
< USER=marco
< WINDOWID=0
< XAUTHORITY=/home/marco/.Xauthority
< XCURSOR_SIZE=24
---
> JOURNAL_STREAM=8:34881
55,70c81,84
< XDG_CONFIG_DIRS=/home/marco/.config/kdedefaults:/etc/xdg
< XDG_CURRENT_DESKTOP=KDE
< XDG_DATA_DIRS=/home/marco/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop
< XDG_RUNTIME_DIR=/run/user/1000
< XDG_SEAT=seat0
< XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
< XDG_SESSION_CLASS=user
< XDG_SESSION_DESKTOP=KDE
< XDG_SESSION_ID=2
< XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
< XDG_SESSION_TYPE=x11
< XDG_VTNR=1
< _=/usr/bin/printenv
< arox=/home/marco/Documents/Development/Arox
< dev=/home/marco/Documents/Development
< EDITOR=vim
---
> GTK3_MODULES=xapp-gtk3-module
> XDG_DATA_DIRS=/tmp/.mount_AroxStcsvW9S/usr/share/:./share/:/usr/share/gnome:/usr/local/share/:/usr/share/:/home/marco/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/usr/share/gnome/:/usr/local/share/:/usr/share/
> KDE_FULL_SESSION=true
> PATH=/tmp/.mount_AroxStcsvW9S:/tmp/.mount_AroxStcsvW9S/usr/sbin:/home/marco/.nvm/versions/node/v14.17.0/bin:/home/marco/.local/bin:/home/marco/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/home/marco/Documents/Development/Arox/isa/arox-llvm/llvm/build/bin:/home/marco/.spicetify/:/home/marco/.sw/bin:/home/marco/.spicetify:/home/marco/Documents/Development/Arox/isa/arox-llvm/llvm/build/bin:/home/marco/.spicetify/:/home/marco/.sw/bin:/home/marco/.spicetify
72,75c86,87
< CXX=/bin/clang++
< ELECTRON_TRASH=gio
< NVM_DIR=/home/marco/.nvm
< NVM_CD_FLAGS=-q
---
> DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
> KDE_APPLICATIONS_AS_SCOPE=1
77,87c89,102
< NVM_INC=/home/marco/.nvm/versions/node/v14.17.0/include/node
< P9K_TTY=old
< _P9K_TTY=/dev/pts/2
< ZSH=/home/marco/.oh-my-zsh
< PAGER=less
< LESS=-R
< LSCOLORS=Gxfxcxdxbxegedabagacad
< LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:
< VIRTUAL_ENV_DISABLE_PROMPT=1
< P9K_SSH=0
< SSH_KEY_PATH=~/.ssh/rsa_id
---
> MAIL=/var/spool/mail/marco
> LC_NUMERIC=C
> OLDPWD=/home/marco/AroxStudioProjects/NewProject13
> CHROME_DESKTOP=arox-studio.desktop
> ORIGINAL_XDG_CURRENT_DESKTOP=KDE
> THEIA_DEFAULT_PLUGINS=local-dir:/tmp/.mount_AroxStcsvW9S/resources/app/plugins
> THEIA_PLUGINS=local-dir:/home/marco/.theia/plugins
> THEIA_APP_PROJECT_PATH=/tmp/.mount_AroxStcsvW9S/resources/app.asar
> THEIA_ELECTRON_VERSION=15.3.5
> THEIA_ELECTRON_TOKEN={"value":"2535904e-b7d9-4fff-90d0-dad1dc13d25d"}
> VSCODE_API_VERSION=1.53.2
> LOCAL_GIT_DIRECTORY=/usr
> GIT_EXEC_PATH=/usr/lib/git-core
> _=/usr/bin/printenv

Strangely enough CMAKE_ROOT is not present in any of the two. Even echo $CMAKE_ROOT prints nothing in both the terminal and the integrated in theia.
I’ve found a thread in the cmake community with the same problem, but no solution were found

If useful:

"@theia/cli": "1.31.1" // same for any other @theia/*
"electron": "15.3.5"
"electron-builder": "^23.6.0"

@MarcoSpeziali you may be interested in taking a look at theia-blueprint if you haven’t already. The repository also uses electron-builder to package, and from what I tested the .AppImage builds and starts correctly (ref: electron-builder.yml).

The README says: “Eclipse Theia Blueprint is not a production-ready product”. I’d rather stick with electron-builder for now. The .AppImage builds and runs correctly also for me, but when I try to execute a task using cmake:

{
  label: 'CMake: Configure',
  type: 'shell',
  cwd: '${workspaceFolder}',
  command: 'cmake',
  args,
  _scope: TaskScope.Workspace,
}

The execution fails with:

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

CMake Error: Error executing cmake::LoadCache(). Aborting.

This happens only after creating the .AppImage. The task executes correctly in development mode

I can reproduce this issue with the CDT Cloud Blueprint. CMake also doesn’t work there in the built .AppImage, however it works in the .deb.

When I open another shell within the Theia Terminal (e.g. bash), then cmake becomes available, it just doesn’t work in the initial terminal or when executed via tasks.