I am using travis.ci to do automated test builds of my git repositories.
For linux they use: Ubuntu 12.04
With clang 3.4
According to the clang page all C++ 14 language features are supported by Clang 3.4 (as long as you use the -std=c++1y flag).
So far so good:
I also need to use std::index_sequence<t0,...,tn> which is library feature N3658 not a language feature. But I can not find any specific documentation on updating the C++ standard library for clang to make sure this feature is supported (it is not supported out of the box).
TestCode:
#include <utility>
int main() {
std::index_sequence<1,2,3,4> seq;
}
TestBuild:
> clang++ -std=c++1y pl.cpp
pl.cpp:3:10: error: no member named 'index_sequence' in namespace 'std'
std::index_sequence<1,2,3,4> seq;
~~~~~^
pl.cpp:3:37: error: use of undeclared identifier 'seq'
std::index_sequence<1,2,3,4> seq;
^
2 errors generated.
Update:
Based on the suggestion below I tried to use libc++.
Pretty sure I did something wrong but I have never tried to use an alternative standard library so am not sure what is going wrong here. Will digg in tonight. But if you have a suggestion then please leave a comment.
> sudo apt-get install -qq libc++1 libc6 libc++-dev
> clang++ -stdlib=libc++ pl.cpp
pl.cpp:1:10: fatal error: 'utility' file not found
#include <utility>
^
1 error generated.
Well the answer seems to be to install g++-4.9
This will update the standard libraries already installed to a point where clang will be able to compile the code.
sudo apt-get install python-software-properties
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9
## Because I also use llvm-cov from my makefile
## I have to make sure it is in the path.
a=$(sudo find / -name llvm-cov | head -1)
sudo ln -s ${a} /usr/bin/llvm-cov
So this is what I added to travis.yml file
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "clang++" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "clang++" ]; then sudo apt-get update;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "clang++" ]; then sudo apt-get install g++-4.9;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "clang++" ]; then a=$(sudo find / -name llvm-cov | head -1);sudo ln -s ${a} /usr/bin/llvm-cov;fi
After I consolidate my g++ and clang++ pre-build code:
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux"]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y;fi
- if [ "$TRAVIS_OS_NAME" == "linux"]; then sudo apt-get update;fi
- if [ "$TRAVIS_OS_NAME" == "linux"]; then sudo apt-get install -qq g++-4.9;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "g++" ]; then sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 90;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "g++" ]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 90;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "g++" ]; then sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.9 90;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "clang++" ]; then a=$(sudo find / -name llvm-cov | head -1);sudo ln -s ${a} /usr/bin/llvm-cov;fi
According to https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html, libstdc++ supports this at least given the most recent version. Ubuntu 12.04 contains GCC 4.4, where this is obviously not supported. precise-backports does not contain a newer version of libstdc++.
However, via https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test, newer versions of GCC and with it, libstdc++, can be obtained. I don't know whether Travis supports installing from other repositories, or not, though.
Related
I am trying to install openpose in Ubuntu 20.04 using CMAKE and I get the following error:
Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
I am following the instructions here (unfortunately, the screenshots are not available but I just followed the textual commands):
https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation/README.md
I made a build folder in openpose folder and then ran the cmake-gui .. command.
A GUI opens with all these checked (I don't change anything):
and the error is:
GCC detected, adding compile flags
GCC detected, adding compile flags
Building with CUDA.
CUDA detected: 10.1
Added CUDA NVCC flags for: sm_75
cuDNN not found
Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
CMake Warning at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:499 (message):
Protobuf compiler version 3.13.0 doesn't match library version 3.6.1
Call Stack (most recent call first):
CMakeLists.txt:429 (find_package)
Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1")
Found OpenCV: /usr (found version "4.2.0")
cuDNN not found.
#!/bin/bash
echo "This script assumes Ubuntu 16 or 14 and Nvidia Graphics card up to 10XX. Otherwise, it will fail."
# Install cuDNN 5.1
if [[ $UBUNTU_VERSION == *"14."* ]] || [[ $UBUNTU_VERSION == *"15."* ]] || [[ $UBUNTU_VERSION == *"16."* ]]; then
CUDNN_URL="http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-8.0-linux-x64-v5.1.tgz"
wget -c ${CUDNN_URL}
sudo tar -xzf cudnn-8.0-linux-x64-v5.1.tgz -C /usr/local
rm cudnn-8.0-linux-x64-v5.1.tgz && sudo ldconfig
else
echo "cuDNN NOT INSTALLED! Ubuntu 16 or 14 not found. Install cuDNN manually from 'https://developer.nvidia.com/cudnn'."
fi
CMake Error at CMakeLists.txt:520 (message):
Install cuDNN using the above commands. or turn off cuDNN by setting
USE_CUDNN to OFF.
Configuring incomplete, errors occurred!
See also "/home/mona/research/code/openpose/build/CMakeFiles/CMakeOutput.log".
See also "/home/mona/research/code/openpose/build/CMakeFiles/CMakeError.log".
Then, I installed gflags using sudo apt-get install libgflags-dev command but I still get the same error. How could I fix this problem?
This is the git log to see which version of repo I am at for reproducing the error:
$ git log
commit a255747af22116ad76004437456bb531dc5d0b23 (HEAD -> master, origin/master, origin/HEAD)
Author: Wlad Meixner <9556979+gosticks#users.noreply.github.com>
Date: Mon Dec 21 22:01:10 2020 +0100
Fix possible typo (#1802)
The CMakeOutput.log and CMakeError.log can be found here https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/1814
$ sudo apt install libgoogle-glog-dev
Also,
$ sudo apt-get install libgflags-dev
$ sudo apt install libgoogle-glog-dev
$ sudo apt-get install protobuf-compiler libprotobuf-dev
since initially I didn't have any of them installed.
If you have run it from the command line you should have see them...
if (NOT GLOG_FOUND)
message(FATAL_ERROR "Glog not found. Install Glog from the command line using the command(s) -\
sudo apt-get install libgoogle-glog-dev")
endif (NOT GLOG_FOUND)
if (NOT GFLAGS_FOUND)
message(FATAL_ERROR "GFlags not found. Install GFlags from the command line using the command(s) --\
sudo apt-get install libgflags-dev")
endif (NOT GFLAGS_FOUND)
if (NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV not found. Install OpenCV from the command line using the command(s) --\
sudo apt-get install libopencv-dev")
endif (NOT OpenCV_FOUND)
ref: https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/5a9acc730915f2171badcf10076aef9213f38e01/CMakeLists.txt#L523-L537
note: A better way, would be to use FetchContent() when third parties are missing (since they provide a CMake based build), also the command provided is ubuntu only...
I am wondering what is the right/easy way to install a binary libc++ on Ubuntu, in my case Trusty aka 14.04?
On the LLVM web site there are apt packages http://apt.llvm.org/ and I have used these to install 3.9. However these packages don't seem to include libc++. I install the libc++-dev package but that seems to be a really old version. There are also binaries that can be downloaded http://llvm.org/releases/download.html#3.9.0. These do seem to contain libc++ but I'm not sure if I can just copy bits of this into places like /usr/include/c++/v1, in fact I'm not really sure what bits I would need to copy. I am aware I can use libc++ from an alternate location as documented here http://libcxx.llvm.org/docs/UsingLibcxx.html which I have tried. However I can't modify the build system of the large code base I work on to do this.
So is three any reason the apt packages don't include libc++ and any pointers to installing a binary would be gratefully recieved.
How to build libc++ on Ubuntu 16.04
I had a similar issue as you do. While testing clang with libstdc++ worked fine with C++11 and C++14 there still might be licensing issues with libstdc++. So I ended up installing Clang toolchain from their repos and compiling libc++ on Ubuntu 16.04.
Disclaimer: This post is summary of long search on how to build the libc++ on Ubuntu Linux. Many of the posts I found in 2017 were either outdated or described a partial solution on other systems e.g. CentOS. Links to these posts are:
Hacking with Clang llvm abi and llvm libc
Building Clang and libc++ on Ubuntu Linux
How to Build libcxx and libcxxabi by clang on CentOS 7
Here are the steps to build LLVM + Clang + libc++ from the 4.0 release branch:
Install the key of LLVM Repositories
# apt-get update && apt-get dist-upgrade -y && apt-get install -y vim curl && \
curl -q https://apt.llvm.org/llvm-snapshot.gpg.key |apt-key add -
Create a new new APT Repository File (you can also exclude 2 lines referring to v3.9 repos)
# cat > /etc/apt/sources.list.d/llvm-repos.list <<EOF
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main
EOF
Install Clang and all Packages needed to build libc++ from LLVM repos
# apt-get update && apt-get install -y clang-4.0 clang-4.0-doc \
libclang-common-4.0-dev libclang-4.0-dev libclang1-4.0 libclang1-4.0-dbg \
libllvm4.0 libllvm4.0-dbg lldb-4.0 llvm-4.0 llvm-4.0-dev llvm-4.0-runtime \
clang-format-4.0 python-clang-4.0 liblldb-4.0-dev lld-4.0 libfuzzer-4.0-dev \
subversion cmake
Create an alternative for C++ compiler and linker. This is not a must, but lets you switch compilers or linkers if needed. Also some build files needed cc or c++ or clang++ as far as I remember. Keep in mind, that we switch to LLD linker as default:
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-4.0 100 \
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-4.0 100 \
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-4.0 100 \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-4.0 100 \
&& update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-4.0 10 \
&& update-alternatives --install /usr/bin/ld ld /usr/bin/ld.gold 20 \
&& update-alternatives --install /usr/bin/ld ld /usr/bin/ld.bfd 30 \
&& ld --version && echo 3 | update-alternatives --config ld && ld --version
Checkout sources of libc++ and libc++abi:
$ cd /tmp
$ svn co http://llvm.org/svn/llvm-project/libcxx/branches/release_40/ libcxx
$ svn co http://llvm.org/svn/llvm-project/libcxxabi/branches/release_40/ libcxxabi
$ mkdir -p libcxx/build libcxxabi/build
To run libc++ on Linux one needs ABI compatibility to the standard library, e.g. libstdc++. This is where libc++abi comes into game. The only problem is that it needs libc++ to be on the system for which it is build. Thus libc++ is built in 2 steps. First: without any ABI compatibility. But it will be used for bootstrapping of ABI lib and than the second step is to recompile libc++ with the proper ABI present on system:
Bootstraping => build libc++ without proper ABI:
cd /tmp/libcxx/build
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_CONFIG_PATH=/usr/bin/llvm-config-4.0\
-DCMAKE_INSTALL_PREFIX=/usr .. \
&& make install
Building libc++abi with libstdc++ compatible ABI:
cd /tmp/libcxxabi/build
CPP_INCLUDE_PATHS=echo | c++ -Wp,-v -x c++ - -fsyntax-only 2>&1 \
|grep ' /usr'|tr '\n' ' '|tr -s ' ' |tr ' ' ';'
CPP_INCLUDE_PATHS="/usr/include/c++/v1/;$CPP_INCLUDE_PATHS"
cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libstdc++ \
-DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="$CPP_INCLUDE_PATHS" \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DLLVM_CONFIG_PATH=/usr/bin/llvm-config-4.0 \
-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include ..
make install
Rebuild libc++ with proper ABI lib deployed on system:
cd /tmp/libcxx/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DLIBCXX_CXX_ABI=libcxxabi -DLLVM_CONFIG_PATH=/usr/bin/llvm-config-4.0\
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=../../libcxxabi/include .. \
&& make install
Create a test file to check whether everything works fine. IMO you should also test cerr stream, as previously it was not supported with the libc++abi and there were some segfaults. Please refer to this question.
create a test.cpp file:
#include <iostream>
int main()
{
using namespace std;
cout << "[OK] Hello world to cout!" << endl;
cerr << "[OK] Hello world to cerr!" << endl;
clog << "[OK] Hello world to clog!" << endl;
return 0;
}
And compile it and run it using this command line:
clang++ -std=c++11 -stdlib=libc++ -lc++abi test.cpp && ./a.out
Reason there is no package
I found libc++ packages for Ubuntu but they are a bit behind recent version: https://packages.ubuntu.com/xenial/libc++-dev
Why they are not current, I can't answer, but my guess is that LLVM+Clang can work with mostly any Standard Library, whereas libc++ as you see must be linked to particular runtime ABI and might heavily depend on available C runtime library. I agree there should be a package which covers 90% of the cases. May be this is just the lack of resources. Searching the mailing archive did not bring up anything special.
sudo apt-get update
sudo apt-get install libc++-dev
The accepted answer gave me some errors (it is Nov 2021 currently). Also, sudo apt install libc++-dev libc++abi-dev did not provide the latest libc++. Here is an alternate solution.
Use the LLVM apt package maintainer's script:
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
This automatically sets up the apt repositories and gives you the latest LLVM toolchain.
clang-13 --version
Since you now have the latest LLVM packages available from http://apt.llvm.org you can install the latest libc++. First determine the latest version:
apt search libc++ | grep libc++
Then:
sudo apt install libc++-13-dev libc++abi-13-dev
Optionally, you can use update-alternatives to make your system use clang-13 instead of the default. There is a gist for that:
wget https://gist.githubusercontent.com/junkdog/70231d6953592cd6f27def59fe19e50d/raw/update-alternatives-clang.sh
chmod +x update-alternatives-clang.sh
sudo ./update-alternatives-clang.sh 13 1000
Now:
clang --version
Debian clang version 13.0.1-++20211110062941+9dc7d6d5e326-1~exp1~20211110183517.26
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
The easiest way to get a working libc++ is to install the entire 3.9.0 toolchain under /usr/local. This will allow /usr/local/bin/clang++ to find the headers correctly and also allow the linker to find /usr/local/lib/libc++.so.
check my shell-script automation version:
https://github.com/sailfish009/llvm_all
$ sudo apt-get install libffi-dev libedit-dev swig git
$ git clone https://github.com/sailfish009/llvm_all
$ git clone https://github.com/llvm/llvm-project
$ cd llvm_all
$ cp *.sh ../llvm-project/
$ cd ../llvm-project/
$ ./set.sh
$ ./install.sh
$ clang++ --version
clang version 11.0.0 (https://github.com/llvm/llvm-project 032251e34d17c1cbf21e7571514bb775ed5cdf30)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Just build it yourself, as explained here. I added -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_C_COMPILER=clang to use clang as the compiler:
$ git clone https://github.com/llvm/llvm-project.git
$ cd llvm-project
$ mkdir build
$ cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_C_COMPILER=clang # Configure for clang++
$ ninja -C build cxx cxxabi unwind # Build
$ ninja -C build check-cxx check-cxxabi check-unwind # Test
$ ninja -C build install-cxx install-cxxabi install-unwind # Install
I am trying to install caffe by building it from source
After issuing the following command from the caffe root directory
$ make all -j4
I am getting an error
...
CXX src/caffe/layer_factory.cpp
CXX src/caffe/blob.cpp
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/x86_64-linux-gnu-ld: cannot find -lpython3.6
collect2: error: ld returned 1 exit status
Makefile:582: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
Dependencies installed
$ sudo apt install python3-opencv
$ sudo apt-get install libatlas-base-dev
$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
$ sudo apt-get install --no-install-recommends libboost-all-dev
$ sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
$ sudo apt-get install the python3-dev
CUDA: CUDA 9 CuDnn 7.4
Ubuntu: Ubuntu 18.04
Makefile.config
I have looked at all the issues in the source Github repository but couldn't find anything useful.
Therefore that your error states cannot find -lpython3.6 you are missing the libpython3.6.so on your system.
Try to:
sudo apt-get install libpython3.6-dev
The issue is resolved, I had to make the following changes in Makefile.config file
From
PYTHON_LIBRARIES := boost_python3 python3.6
PYTHON_INCLUDE := /usr/include/python3.6 \
/usr/lib/python3.6/dist-packages/numpy/core/include
To
PYTHON_LIBRARIES := boost_python3 python3.6m
PYTHON_INCLUDE := /usr/include/python3.6m \
/usr/lib/python3.6/dist-packages/numpy/core/include
Question: When I run make px4fmu-v2_default, I get this:
rootroot:~/Firmware$ make px4fmu-v2_default
Makefile:44: Not a valid CMake version or CMake not installed.
Makefile:45: On Ubuntu, install or upgrade via:
Makefile:46:
Makefile:47: 3rd party PPA:
Makefile:48: sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
Makefile:49: sudo apt-get update
Makefile:50: sudo apt-get install cmake
Makefile:51:
Makefile:52: Official website:
Makefile:53: wget https://cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.sh
Makefile:54: chmod +x cmake-3.3.2-Linux-x86_64.sh
Makefile:55: sudo mkdir /opt/cmake-3.3.2
Makefile:56: sudo ./cmake-3.3.2-Linux-x86_64.sh --prefix=/opt/cmake-3.3.2 --exclude-subdir
Makefile:57: export PATH=/opt/cmake-3.3.2/bin:$PATH
Makefile:58:
Makefile:59: *** Fatal。 停止。
My CMAKE version
root#root:~/Firmware$ cmake --version
cmake version 3.0.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Why?
https://github.com/PX4/Firmware/blob/master/Tools/check_cmake.sh:
if [[ $cmake_ver == *" 2.8"* ]] || [[ $cmake_ver == *" 2.9"* ]] || [[ $cmake_ver == *" 3.0"* ]] || [[ $cmake_ver == *" 3.1"* ]]
then
exit 1;
fi
The code explicitly rejects cmake versions 2.8, 2.9, 3.0 (including your 3.0.2), 3.1.
You need to upgrade your cmake to at least version 3.2.
I use Travis-CI for continuous integration for my simple Qt app. My .travis.yml file looks like this (based on this gist):
language: cpp
before_install:
- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
- sudo apt-get update -qq
- sudo apt-get install -qq g++ qt4-qmake libqt4-dev qt5-qmake qtbase5-dev
script:
- qmake -qt=qt4 -v
- qmake -qt=qt4
- make
- make -k check
- make clean
- qmake -qt=qt5 -v
- qmake -qt=qt5
- make
- make -k check
This configuration allows me to build my app (and run tests) with default Qt libraries in Ubuntu (Qt 4.8.1 and Qt 5.0.2).
Is there any way to build app with other Qt versions (4.7.x, 4.8.x, 5.1.x and so on)?
Inspired by AlexandreP answer and .travis.yml file of Twofold-Qt project with many thanks to Stephan Binner.
language: cpp
matrix:
include:
- os: linux
dist: trusty
sudo: required
compiler: gcc
env:
- QT_BASE=48
- os: linux
dist: trusty
sudo: required
compiler: gcc
env:
- QT_BASE=51
- os: linux
dist: trusty
sudo: required
compiler: gcc
env:
- QT_BASE=52
- os: linux
dist: trusty
sudo: required
compiler: gcc
env:
- QT_BASE=53
- os: linux
dist: trusty
sudo: required
compiler: gcc
env:
- QT_BASE=54
- os: linux
dist: trusty
sudo: required
compiler: gcc
env:
- QT_BASE=55
- os: osx
compiler: clang
env:
- QT_BASE=55
- os: linux
dist: trusty
sudo: required
compiler: gcc
env:
- QT_BASE=56
- os: linux
dist: trusty
sudo: required
compiler: gcc
env:
- QT_BASE=57
- os: osx
compiler: clang
env:
- QT_BASE=57
before_install:
- if [ "$QT_BASE" = "48" ]; then sudo add-apt-repository ppa:beineri/opt-qt487-trusty -y; fi
- if [ "$QT_BASE" = "51" ]; then sudo add-apt-repository ppa:beineri/opt-qt511-trusty -y; fi
- if [ "$QT_BASE" = "52" ]; then sudo add-apt-repository ppa:beineri/opt-qt521-trusty -y; fi
- if [ "$QT_BASE" = "53" ]; then sudo add-apt-repository ppa:beineri/opt-qt532-trusty -y; fi
- if [ "$QT_BASE" = "54" ]; then sudo add-apt-repository ppa:beineri/opt-qt542-trusty -y; fi
- if [[ "$QT_BASE" = "55" && "$TRAVIS_OS_NAME" = "linux" ]]; then sudo add-apt-repository ppa:beineri/opt-qt551-trusty -y; fi
- if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt562-trusty -y; fi
- if [[ "$QT_BASE" = "57" && "$TRAVIS_OS_NAME" = "linux" ]]; then sudo add-apt-repository ppa:beineri/opt-qt571-trusty -y; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
sudo apt-get update -qq;
else
brew update;
fi
install:
- if [ "$QT_BASE" = "48" ]; then sudo apt-get install -qq opt-qt4-qmake opt-qt4-dev-tools; source /opt/qt-4.8/bin/qt-4.8-env.sh; fi
- if [ "$QT_BASE" = "51" ]; then sudo apt-get install -qq qt51base; source /opt/qt51/bin/qt51-env.sh; fi
- if [ "$QT_BASE" = "52" ]; then sudo apt-get install -qq qt52base; source /opt/qt52/bin/qt52-env.sh; fi
- if [ "$QT_BASE" = "53" ]; then sudo apt-get install -qq qt53base; source /opt/qt53/bin/qt53-env.sh; fi
- if [ "$QT_BASE" = "54" ]; then sudo apt-get install -qq qt54base; source /opt/qt54/bin/qt54-env.sh; fi
- if [ "$QT_BASE" = "55" ]; then
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
sudo apt-get install -qq qt55base; source /opt/qt55/bin/qt55-env.sh;
else
brew install qt55;
brew link --force qt55;
fi
fi
- if [ "$QT_BASE" = "56" ]; then sudo apt-get install -qq qt56base; source /opt/qt56/bin/qt56-env.sh; fi
- if [ "$QT_BASE" = "57" ]; then
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
sudo apt-get install -qq qt57base; source /opt/qt57/bin/qt57-env.sh;
else
brew install qt5;
brew link --force qt5;
fi
fi
script:
- qmake -v
- qmake -r
- make
notifications:
email: false
With this .travis.yml you will get 10 separate build jobs - number of elements in matrix section. Each build job will install specified Qt version and use it for app building in Ubuntu with Qt 4.8 - 5.7 and OS X with Qt 5.5 and 5.7 (or latest version).
If you want to build your app for Windows, you can try AppVeyor CI service. Example config (Qt 5.3 - 5.7):
version: '{build}'
init:
- git config --global core.autocrlf input
environment:
matrix:
- QT5: C:\Qt\5.3\mingw482_32
MINGW: C:\Qt\Tools\mingw482_32
- QT5: C:\Qt\5.4\mingw491_32
MINGW: C:\Qt\Tools\mingw491_32
- QT5: C:\Qt\5.5\mingw492_32
MINGW: C:\Qt\Tools\mingw492_32
- QT5: C:\Qt\5.6\mingw49_32
MINGW: C:\Qt\Tools\mingw492_32
- QT5: C:\Qt\5.7\mingw53_32
MINGW: C:\Qt\Tools\mingw530_32
matrix:
fast_finish: true
before_build:
- set PATH=%MINGW%\bin;%QT5%\bin;%PATH%
build_script:
- qmake -v
- qmake -r
- mingw32-make
I use these configs in my project - qtcsv. See it for updates and build logs.
You can find more version of Qt by adding this beineri's ppa.
For example, version 5.4 can be added:
before_install:
- sudo add-apt-repository ppa:beineri/opt-qt541 -y
install:
- sudo apt-get install qt54base qt54websockets
script:
- source /opt/qt54/bin/qt54-env.sh