jeudi 21 mai 2015

I've got a CPython C++ module with C++11 code, but I can't seem to build on travis-ci

This project work fine on my local Ubuntu 12.04 and Mac OSX 10.10 (with fink python) machines. I can't seem to figure out how to configure the .travis.yml to get the .cpp files to build with g++-4.8 (4.9 or 5.x) would be fine too.

Project: http://ift.tt/1i8XvVb

My most recent failed attempt:

language: python

python:
  - "2.7"
  - "3.4"

before_install:
  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  - sudo apt-get update -qq
  - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi

install:
  - sudo apt-get install -qq gcc-4.8 g++-4.8
  - python setup.py install

script:
  - python setup.py test 

Gives:

gcc -pthread -fno-strict-aliasing -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/python/2.7.9/include/python2.7 -c src/libais/ais_py.cpp -o build/temp.linux-x86_64-2.7/src/libais/ais_py.o -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
cc1plus: error: unrecognized command line option ‘-std=c++11’

The key portion of my setup.py:

EXTRA_COMPILE_ARGS = []
if sys.platform in ('darwin', 'linux', 'linux2'):
    EXTRA_COMPILE_ARGS = ['-std=c++11']

AIS_MODULE = Extension(
    '_ais',
    extra_compile_args=EXTRA_COMPILE_ARGS,

Aucun commentaire:

Enregistrer un commentaire