This might be interesting to people, so I posted it anyway. This was going to be my first post, I registered specially and everything. But between the start of the post and the end, I logged out of my server and back in, and now it works. Isn't it always the way?
---
Hello! It's my first post because I can't find this particular problem anywhere on the forums, although lots of similar problems with CMake seem to give the same error.
Here is the short version before I get bogged down in detail:
Running cmake from the full path seems to work:
Code:
> /path/to/cmake --version
cmake version 2.8.12.2
This path is in my $PATH variable and works for other binaries, but for cmake I get an error:
Code:
> which cmake
/path/to/cmake
> cmake --version
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found
Segmentation fault
That's the simple version. It's complicated because I'm trying to do a number of things that are probably very silly! I primarily use Macs, and I don't really think I've got much understanding of Linux in my head!
The first silly thing I'm doing is trying to install a second version of cmake on a server that already has version 2.6 installed. It's a university server so I can't and don't want to change the programs installed for all users, but I want to make use of cmake 2.8. So I'm trying to install it in a custom directory using --prefix.
The second silly thing is the number of symlinks that are involved in this process. I think this is probably what's causing the problem, so my next step is probably to try and install it without using these links. I'd like to keep them if possible, though!
So here goes:
- My home directory is on a drive that doesn't have enough space for the software I want to install, so $HOME/Software is a symlink to /bigdrive/mattachu/Software.
- I'm trying to keep software contained separately using a sandboxing system (which I don't think is very Linux-y) so cmake is installed using --prefix=$HOME/Software/sandbox/cmake
- The contents of the bin folder are symlinked, e.g. ln -s ~/Software/sandbox/cmake/bin/* ~/Software/bin/
- The contents of the other folders in the sandbox are also symlinked, although I've tried copying them instead, with no success.
- My path contains $HOME/Software/bin as the first entry
I've tried running cmake --version from all the possible locations:
- ~/Software/bin/cmake --version
- ~/Software/sandbox/cmake/bin/cmake --version
- /bigdrive/mattachu/Software/sandbox/cmake/bin/cmake --version
- ./cmake --version (while in each of the above locations)
All of these work.
The path variable seems to be working:
Code:
[mattachu ~]$ which cmake
~/Software/bin/cmake
[mattachu ~]$ type cmake
cmake is /home/mattachu/Software/bin/cmake
But running cmake without a path doesn't work:
Code:
> cmake --version
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in /bigdrive/mattachu/Software/sandbox/cmake/bin
Segmentation fault
... It was at this point that I tried running it again and it worked. Typical. Maybe something in my .bashrc fixed the problem? I guess I'll never know.