Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis: generalize matrix to cover python versions as well as gcc versions #122

Open
davidmalcolm opened this issue May 4, 2018 · 3 comments

Comments

@davidmalcolm
Copy link
Owner

Ideally we'd test for the matrix of all supported gcc versions vs all supported Python versions.

(Help with this would be appreciated!)

@davidmalcolm davidmalcolm changed the title Travis; generalize matrix to cover python versions as well as gcc versions Travis: generalize matrix to cover python versions as well as gcc versions May 4, 2018
@vries
Copy link
Contributor

vries commented Oct 3, 2018

I've looked into this, and got as far as #147.

I managed to specify a 2 by 2 matrix using dimensions env and python:

os:
- linux

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - g++-4.8 gcc-4.8-plugin-dev g++-8 gcc-8-plugin-dev

env:
  - MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
  - MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"

language: python
python:
  - "2.7"
  - "3.6"

before_install:
  - eval "${MATRIX_EVAL}"

install:
  - pip install six pygments graphviz lxml

script: make CC=$CC CXX=$CXX

So, there are 4 builds, and I run into two errors:

  • 4.8/8 and 2.7: Runs into "ImportError: cannot import name _remove_dead_weakref"
  • 4.8/8 and 3.6: Runs into "/usr/bin/ld: cannot find -lpython3.6m" when linking python.so

Both seem be problems with the virtualenv that is setup for python, but I don't know how to fix these.

@vries
Copy link
Contributor

vries commented Oct 3, 2018

So, there are 4 builds, and I run into two errors:

* 4.8/8 and 2.7: Runs into "ImportError: cannot import name _remove_dead_weakref"

* 4.8/8 and 3.6: Runs into "/usr/bin/ld: cannot find -lpython3.6m" when linking python.so

Both seem be problems with the virtualenv that is setup for python, but I don't know how to fix these.

I think I managed to fix/workaround this.

On my opensuse leap laptop, we have:

$ python-config --ldflags
-lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic
$ python2-config --ldflags
-lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic
$ python3-config --ldflags
 -L/usr/lib64 -lpython3.6m -lpthread -ldl  -lutil -lm  -Xlinker -export-dynamic

but if I start up an virtualenv with python3, I get:

$ virtualenv -p python3 tmp
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/vries/tmp/bin/python3
Also creating executable in /home/vries/tmp/bin/python
Installing setuptools, pip, wheel...done.
$ . ./tmp/bin/activate
(tmp) $ python-config --ldflags
-lpython3.6m -lpthread -ldl -lutil -lm -Xlinker -export-dynamic

So, it seems the virtualenv drops the " -L/usr/lib64" for some reason.

The patch below adds it back, and allows us have a reasonable testrun:

diff --git a/Makefile b/Makefile
index daa7419..d83404a 100644
--- a/Makefile
+++ b/Makefile
@@ -98,7 +98,8 @@ PYTHON_CONFIG=python-config
 #PYTHON_CONFIG=python3.3dm-config
 
 PYTHON_INCLUDES=$(shell $(PYTHON_CONFIG) --includes)
-PYTHON_LIBS=$(shell $(PYTHON_CONFIG) --libs)
+PYTHON_LIBPL=$(shell $(PYTHON) -c "import sysconfig; print(sysconfig.get_config_var('LIBPL'))")
+PYTHON_LIBS=$(shell $(PYTHON_CONFIG) --ldflags; $(PYTHON_CONFIG) --libs; echo "-L$(PYTHON_LIBPL)"; )
 
 # Support having multiple named plugins
 # e.g. "python2.7" "python3.2mu" "python 3.2dmu" etc:

@vries
Copy link
Contributor

vries commented Oct 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants