CMake not finding CMakeLists.txt - cmake

I am trying to install ants in Ubuntu 18 which requires a CMake step.
So far I have taken the following steps:
apt-get install ants
cd /tmp
git clone https://github.com/stnava/ANTs.git
mkdir /opt/ants
cd /opt/ants
cmake -c -g /tmp/ANTS
I keep getting the following error:
CMake Error: The source directory "/tmp/ANTS" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

You apparently have a typo in the path (S should be lower case), try this:
cmake -c -g /tmp/ANTs

Related

Where are nanomsg nng libraries installed

I am new to nanomsg and cmake. I installed the nanomsg using the documentation
$ mkdir build
$ cd build
$ cmake -G Ninja ..
$ ninja
$ ninja test
$ ninja install
I am not sure where are the packages installed. I see the headers in /usr/include and cmake directory in /usr/lib64 directory.
/usr/lib64/cmake/nng# ls
nng-config.cmake nng-config-noconfig.cmake
I am unable to compile my sample programs due to this confusion. Any help would be highly appreciated.

Cmake can't find CMAKE_ROOT

Cmake throws an 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.`
Tried everything I could find out there to fix (Creating environment variable to path of installation, reinstalling, installing from source code) but none of these worked, I also tried running it on bash (I usually use zsh) but still no results
I had to re-install my cmake to correct this same error.
sudo apt-get remove cmake cmake-data
sudo -E add-apt-repository -y ppa:george-edison55/cmake-3.x
sudo -E apt-get update
sudo apt-get install cmake
Try the following command:
hash -r
It is ok under Ubuntu.

Doxygen - Could NOT find FLEX (missing: FLEX_EXECUTABLE)

I know there are very similar worded questions on here, but I could not find an answer to my question there, so here we go:
I'm trying to see which of my C++ methods are called by others so I found Doxygen after googling.
On their page the installation seems pretty straightforward:
If you have the necessary build tools installed (i.e. g++, python,
cmake, flex, bison), you should do the following to get the initial
copy of the repository:
git clone https://github.com/doxygen/doxygen.git
cd doxygen
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
Until cmake -G "Unix Makefiles" .. everything goes well, then on that command following error occurs:
test#test-VirtualBox:~/doxygen/build$ cmake -G "Unix Makefiles" ..
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find FLEX (missing: FLEX_EXECUTABLE)
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.5/Modules/FindFLEX.cmake:230 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:84 (find_package)
I thought: No big deal, why should anything work out of the box...seems I have to install flex.
So I do:
sudo apt-get update
sudo apt-get install flex
sudo apt autoremove (because after installation the command line recommended me to do this)
Now it seems to me that flex has been installed, I try cmake -G "Unix Makefiles" .. again...same error. I close the command line, start it up again, try it again - same error...
So now I'm slowly gettin' pissed and turn to Stack Overflow for help :D
What am I doing wrong???
And because I saw someone asking this in the other question's comment, here's the output of flex:
test#test-VirtualBox:~/doxygen/build$ flex
The program 'flex' can be found in the following packages:
* flex
* flex-old
Try: sudo apt install <selected package>
It seems like apt autoremove really removed the package I just installed in the previous step.
So what worked for me was:
git clone https://github.com/doxygen/doxygen.git
cd doxygen
mkdir build
cd build
These are new:
sudo apt-get install flex
sudo apt-get install bison
cmake -G "Unix Makefiles" ..
make
...but of course the horror wouldn't end there, see my next question :D

Why is Travis not recognising installed CMake in script?

I'm trying to put together a Travis CI script for my application, which requires CMake 3.5 or greater. The entire Travis script can be found here. Following advice I found elsewhere, I use the following to install CMake:
install:
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz";
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake;
export PATH=${DEPS_DIR}/cmake/bin:${PATH};
else
brew outdated cmake || brew upgrade cmake;
fi
- cmake --version
Then I fill out the build matrix with various OS/compiler combinations, and finally I run a Python installation script (see here):
before_script:
- cd "${TRAVIS_BUILD_DIR}"
script:
- ./install.py --compiler=$COMPILER
The Python script essentially just calls cmake and make, the first CMakeLists.txt can be found here.
The OSX builds which install CMake using Homebrew works perfectly. However, all of the Linux builds fail at the script stage due to CMake not meeting the minimum requirement:
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.5 or higher is required. You are running version 3.2.2
Even though CMake 3.7 was successfully installed during install:
$ cmake --version
cmake version 3.7.2
What am I doing wrong?
This is strange, the preinstalled version of CMake (= v3.2 on Travis) is used instead of the newer one – but only when called from Python.
You can try these:
Solution 1: Remove the CMake shipped by Travis
This will prevent the usage of the older version. If this doesn't work (eg. maybe because "Cmake isn't found"), this will show the actual reason of the problem.
You can add this to your linux branch of the install step:
sudo apt-get purge cmake
Or:
sudo apt-get remove cmake
(Possible you need to add -y for confirmation, so it becomes remove -y).
Solution 2: Use the CMake installer
Installation through the CMake Installer is a much cleaner way. It turned out the be the faster one on Travis btw.
...
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
CMAKE_INSTALLER=install-cmake.sh
curl -sSL https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh -o ${CMAKE_INSTALLER}
chmod +x ${CMAKE_INSTALLER}
sudo ./${CMAKE_INSTALLER} --prefix=/usr/local --skip-license
else
...
I'm using curl instead of wget + travis_retry, but this doesn't matter. You can still use them as before.
If both don't work, you should check where the Python script looks for executables.

install mlpy 3.5.0 on mac 10.9 error.Please help me

The following is the error which I am getting. Please help me to fix it.
apple:mlpy-3.5.0 apple$ python setup.py install
running install
running build
running build_py
running build_ext
building 'mlpy.gsl' extension
cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c mlpy/gsl/gsl.c -o build/temp.macosx-10.9-intel-2.7/mlpy/gsl/gsl.o
mlpy/gsl/gsl.c:223:10: fatal error: 'gsl/gsl_sf.h' file not found
#include "gsl/gsl_sf.h"
^
1 error generated.
MLPy depends on GNU Scientific Library (GSL), which you need to install first.
You can install it either with brew install gsl or manually from source.
For manual installation, instructions can be found here. The relevant steps are as follows:
go to: http://www.gnu.org/prep/ftp.html
click on an ftp link close to your location
find the gsl/ directory and click on it
find the gsl-VERSION.tar.gz file, where version is 1.14 or greater. Click on that file to download it.
In a terminal window extract the tar.gz file using tar -xzf gsl-VERSION.tar.gz and then cd to the ./gsl-VERSION directory
Look at the INSTALL file. It will probably tell you to run ./configure, then make, and then make install (and you might have to
login as the superuser (sudo)
I am actually getting the same issue today while installing mlpy. Based on the mlpy documentation. Here is the method to solve this issue.
According to the installation section in the mlpy documentation:
If the GSL header files or shared library are in non-standard locations on your system, use the --include-dirs
and --rpath options to build_ext:
$ python setup.py build_ext --include-dirs=/path/to/header --rpath=/path/to/lib
$ python setup.py install
We have to assign the header and lib. Based on How to obtain and install GSL,
Under Search Paths/Header Search Paths type /opt/local/include
Under Search Paths/Library Search Paths type /opt/local/lib
The quick answer is running the below command:
sudo python setup.py build_ext --include-dirs=/opt/local/include --rpath=/opt/local/lib
sudo python setup.py install
Hope this will be helpful.