MantisBT - CMake
View Issue Details
0013910CMakeCMakepublic2013-02-13 08:192013-02-16 04:07
Evgeniy Stepanov 
Peter Kuemmel 
normalminoralways
closednot fixable 
x86_64LinuxUbuntu 12.04
CMake 2.8.10.2 
CMake 2.8.10.2 
0013910: Ninja generator initialization fails if /usr/bin/ninja is not world-readable
CMake tests availability or Ninja by access(, R_OK). This does not make any sense - it's not going to read /usr/bin/ninja, it's going to execute it!

"--x" ninja binary results in a cryptic failure message, as shown below.
$ ls -la /usr/bin/ninja
-rwxr-x--x 1 root root 2746829 Feb 13 16:36 /usr/bin/ninja

$ cmake -GNinja ..
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.


strace shows:
access("ninja", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/bin/ninja", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/sbin/ninja", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/bin/ninja", R_OK) = -1 EACCES (Permission denied)
access("/sbin/ninja", R_OK) = -1 ENOENT (No such file or directory)
access("/bin/ninja", R_OK) = -1 ENOENT (No such file or directory)
No tags attached.
Issue History
2013-02-13 08:19Evgeniy StepanovNew Issue
2013-02-13 09:02Brad KingAssigned To => Peter Kuemmel
2013-02-13 09:02Brad KingStatusnew => assigned
2013-02-16 04:06Peter KuemmelNote Added: 0032307
2013-02-16 04:07Peter KuemmelStatusassigned => closed
2013-02-16 04:07Peter KuemmelResolutionopen => not fixable
2013-02-16 04:07Peter KuemmelFixed in Version => CMake 2.8.10.2

Notes
(0032307)
Peter Kuemmel   
2013-02-16 04:06   
Call ls /usr/bin -l , and you will see that all tools are readable by "others".
Or is it not the case on you system?

sudo chmod o+r /usr/bin/ninja fixes the issue.


This is not ninja specific. It is how SystemTools::FindProgram() works.