Why is Travis not recognising installed CMake in script? - cmake

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.

Related

Installing janus-gateway error on CentOS7

I want to install janus-gateway on CentOS7.
I read the following document and tried installation.
https://github.com/meetecho/janus-gateway/blob/master/README.md
git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
sh autogen.sh
./configure --prefix=/opt/janus
However, configuring janus-gateway will cause an error. The error is as follows.
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for pkg-config... /bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for JANUS... no
configure: error: Package requirements (
glib-2.0 >= 2.34
libconfig
nice
jansson >= 2.5
libssl >= 1.0.1
libcrypto
) were not met:
No package 'nice' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables JANUS_CFLAGS
and JANUS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
I installed libnice(libnice-0.1.3-4.el7.x86_64) in the following way.
yum install libnice
How can I solve it?
Thank you.
try this and rebuild
echo "export PKG_CONFIG_PATH=/usr/lib/pkgconfig" >> ~/.bashrc
source ~/.bashrc
Disclaimer: I am using Ubuntu 18.04 when testing this.
If you are using Ubuntu system and trying to install Janus and running this code
./configure --prefix=/opt/janus
And then getting this error: No package 'nice' found
Make sure you have been installation of the nice from aptitude.
sudo install aptitude
aptitude install libmicrohttpd-dev libjansson-dev \
libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \
libopus-dev libogg-dev libcurl4-openssl-dev liblua5.3-dev \
libconfig-dev pkg-config gengetopt libtool automake
For some reason installation of nice using the answer from Frank, Ahmet or Zallfire doesn't work in Ubuntu. It has to be installed using aptitude.
You should download libnice source code to install.
https://gitlab.freedesktop.org/libnice/libnice
You need the development libnice.
yum install libnice-devel

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.

CMake not finding CMakeLists.txt

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

Running CMake on Amazon Linux

I am trying to build OpenJpeg on an AWS Amazon Linux EC2 instance. I installed cmake and gcc and had no issues during installation. When I try to cmake openjpeg I get the following error:
-- Check if the system is big endian
-- Searching 16 bit integer
CMake Error at /usr/share/cmake/Modules/TestBigEndian.cmake:44 (message):
no suitable type found
Call Stack (most recent call first):
CMakeLists.txt:164 (TEST_BIG_ENDIAN)
-- Configuring incomplete, errors occurred!
Checking the error logs it seems CMake is unable to determine the size of integers, shorts and longs. The full error log can be found in this gist
How can I work this out and make CMake work?
Amazon has a guide: Preparing to Compile Software, which proposes the following command to install a C compiler.
sudo yum groupinstall "Development Tools"
Next, you can download and build Cmake yourself: Install Cmake 3.
wget https://cmake.org/files/v3.18/cmake-3.18.0.tar.gz
tar -xvzf cmake-3.18.0.tar.gz
cd cmake-3.18.0
./bootstrap
make
sudo make install
Note: the last make actually needs sudo.
This works in the most recent Amazon Linux image (Nov 2021):
# Install sudo, wget and openssl, which is required for building CMake
yum install sudo wget openssl-devel -y
# Install development tools
sudo yum groupinstall "Development Tools" -y
# Download, build and install cmake
wget https://cmake.org/files/v3.18/cmake-3.18.0.tar.gz
tar -xvzf cmake-3.18.0.tar.gz
cd cmake-3.18.0
./bootstrap
make
sudo make install
Though this does not actually answer why the error was happening but I was able to build OpenJpeg by building CMake from source. So I just removed Cmake which was installed via yum and I believe was 2.8.12. Downloaded the latest CMake3 sources (v 3.10) built Cmake and openjpeg and all my other packages with no issues.
You could try to set up a Docker container to replicate correct environment. This way, you could form a container on your local machine, make sure it all builds on the container environment, and later use this environment on the EC2.
There is a project on Github that provides a Docker image which can be used to compile for Lambda and test stuff locally. Have a look: https://github.com/lambci/docker-lambda

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.