Travis CI与Clang 3.4和C ++ 11 [英] Travis CI with Clang 3.4 and C++11
问题描述
有可能让Travis CI与Clang能够使用C ++ 11? (我想Clang,不是GCC,我已经有GCC 4.8在Travis CI工作。)看来,预安装的版本不是C ++ 11能力。我安装任何更新版本的所有尝试最终都会因此而失败:
Is it possible to get Travis CI working with Clang that is capable of C++11? (I want Clang, not GCC, I already have GCC 4.8 working in Travis CI.) It appears that the version that is there pre-installed is not C++11 capable. All my attempts at installing any newer version end up failing because of this:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:57:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/type_traits:269:39: error:
use of undeclared identifier '__float128'
struct __is_floating_point_helper<__float128>
我看到了 -D__STRICT_ANSI __
骗子,但与我的其他东西发生冲突。
I have seen the -D__STRICT_ANSI__
trick but that clashes with other things for me.
让它工作?另请参阅我的 .travis.yml 。
Is it possible to get it working? See also my .travis.yml.
推荐答案
这是我的.travis.yml文件的一部分(主要来自此文件)。
Here is a part of my .travis.yml files (mostly taken from this file).
language: cpp
compiler:
- clang
- gcc
before_install:
# g++4.8.1
- if [ "$CXX" == "g++" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
# clang 3.4
- if [ "$CXX" == "clang++" ]; then sudo add-apt-repository -y ppa:h-rayflood/llvm; fi
- sudo apt-get update -qq
install:
# g++4.8.1
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8"; fi
# clang 3.4
- if [ "$CXX" == "clang++" ]; then sudo apt-get install --allow-unauthenticated -qq clang-3.4; fi
- if [ "$CXX" == "clang++" ]; then export CXX="clang++-3.4"; fi
script:
- $CXX --version
EDIT ,因为为travis添加libc ++非常有用。据我所知,没有libc ++的Linux包,所以一个人必须手工编译。在编译clang时,不要忘记CXXFLAGS中的 -stdlib = libc ++ 。
EDIT because it can be very useful to add libc++ for travis. Up to my knowledge, there is no Linux package for libc++, so one has to compile it "by hand". Do not forget -stdlib=libc++ in CXXFLAGS while compiling with clang.
install:
# clang 3.4
- if [ "$CXX" == "clang++" ]; then sudo apt-get install --allow-unauthenticated -qq clang-3.4; fi
- if [ "$CXX" == "clang++" ]; then export CXXFLAGS="-std=c++0x -stdlib=libc++"; fi
- if [ "$CXX" == "clang++" ]; then svn co --quiet http://llvm.org/svn/llvm-project/libcxx/trunk libcxx; fi
- if [ "$CXX" == "clang++" ]; then cd libcxx/lib && bash buildit; fi
- if [ "$CXX" == "clang++" ]; then sudo cp ./libc++.so.1.0 /usr/lib/; fi
- if [ "$CXX" == "clang++" ]; then sudo mkdir /usr/include/c++/v1; fi
- if [ "$CXX" == "clang++" ]; then cd .. && sudo cp -r include/* /usr/include/c++/v1/; fi
- if [ "$CXX" == "clang++" ]; then cd /usr/lib && sudo ln -sf libc++.so.1.0 libc++.so; fi
- if [ "$CXX" == "clang++" ]; then sudo ln -sf libc++.so.1.0 libc++.so.1 && cd $cwd; fi
- if [ "$CXX" == "clang++" ]; then export CXX="clang++-3.4"; fi
这篇关于Travis CI与Clang 3.4和C ++ 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!