Re: wxPython Phoenix build fail ("Could not build python extensions"?) in pyenv 3.5.1 on Linux

Robin Dunn <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
I've just set up a new Ubuntu 16.04 VM and tried my recipe below using a
Python 3.5 venv (just to make sure it's clear, that is not the same
thing as the pyenv tool you are using) and it was successful.  The build
automatically will look in the base (system in this case) Python for
headers and libs and things that are not in the venv, because it is
using python itself to give the location of those things.

There was one unexepected error on the first try, but it turned out that
I hadn't installed one of the python -dev packages.  I had installed
libpython3.5-dev but not python3.5-dev.  You'll also need python3.5-venv.

On the other hand, a bit of googling turned up some similar issues with
pyenv that you are having.  Apparently it does not default to building
Python with the --enable-shared configure flag, and so it static links
everything into the python executable instead of creating the library
that waf is looking for.  The following link is about OSX, but other
pages about the problem on Linux pointed to this page too.

https://github.com/yyuu/pyenv/wiki/Home/_compare/45570ea%5E...45570ea

HTH,
Robin


Michael Freeman wrote:
> Thanks. Same error. BTW, if you don't know already, "pyenv" installs a
> fully built installation of Python just as if I had downloaded the
> source code it myself from the Python site and built then installed.
>
> There's things like /"err: /usr/bin/ld: cannot find -lpython3.5"/ in
> http://files.djbarney.org/config.log.txt
>
> Look at around line 102 ...
> /"-L/home/michaelzfreeman/.pyenv/versions/3.5.1/lib', '-lpython3.5']
> not found".
>
> /If I'm correct, it's like the build script is looking for what should
> be the system libraries ("libpython3.5-dev") in the virtual
> environment and not finding them. I'll try setting some system
> variables to point the build to the correct python libraries.
>
> So where are all the Linux experts in this forum ? I really need to
> get this build working.
>
> MichaelZFreeman
>
> On Friday, September 2, 2016 at 12:44:24 AM UTC+1, Robin Dunn wrote:
>
>     I don't know anything about pyenv, but is there any reason to not
>     use Python 3.5's built-in virtual environment tool?  Make sure
>     that Ubuntu's Python 3.5 package and the corresponding -dev
>     package are installed, download a Phoenix source tar file, and
>     then try something like this:
>
>     mkdir ~/tmp-phoenix-build
>     cd ~/tmp-phoenix-build
>     pyvenv-3.5 my-py35
>     source my-py35/bin/activate
>     pip install -U pip setuptools six wheel
>     pip wheel wxPython_Phoenix-3.0.3.dev2472+78ae39a.tar.gz
>
>     You should end up with a .whl file in ~/tmp-phoenix-build which
>     you can install in this or other compatible Python 3.5
>     environments (real or virtual) on your machine.
>
>     Robin
>
>
>     Michael Freeman wrote:
>>     OK. I looked at this again.
>>
>>     First I don't know how to confirm that my Linux (Ubuntu Xenial)
>>     Python waf build system (in a "pyenv") is actually fully
>>     functional. This should be done first as I've only ever installed
>>     pure Python modules that need no compiling. It could be A. a
>>     problem with my Python install. B. Problem with system gcc
>>     compiler ... and any number of other system problems. So is there
>>     a waf test file, or at least a known good compile on Linux of
>>     some other Python module ?
>>
>>     But meanwhile here's a little sleuthing. The**"Checking for
>>     header Python.h: :-(" I thought might be a massive clue. Thought
>>     I'd missed the obvious ! But Python system "dev" package is
>>     installed. But ...
>>
>>     "python-config --includes
>>     -I/home/michaelzfreeman/.pyenv/versions/3.5.1/include/python3.5m
>>     -I/home/michaelzfreeman/.pyenv/versions/3.5.1/include/python3.5m"
>>
>>     Correct path to "Python.h".
>>
>>     Then it gives the "Getting pyext flags from python-config: Could
>>     not build python extensions" ... but ...
>>
>>     "python-config --ldflags
>>     -L/home/michaelzfreeman/.pyenv/versions/3.5.1/lib/python3.5/config-3.5m
>>     -L/home/michaelzfreeman/.pyenv/versions/3.5.1/lib -lpython3.5m
>>     -lpthread -ldl  -lutil -lm  -Xlinker -export-dynamic"
>>
>>     "pyext" is installed and I can see it.
>>
>>     But looking at "waf" config.log:
>>     http://files.djbarney.org/config.log
>>     <http://files.djbarney.org/config.log>
>>
>>     ... (that I did not see before, don't why this it not reported to
>>     console) shows the real meat of the errors starting at line 418 ...
>>     *
>>     *"['/usr/bin/g++', '-shared', '-pthread', 'test.cpp.1.o', '-o',
>>     '/tmp/pip-build-k2pgcq1x/wxPython-Phoenix/build/waf/3.5/.conf_check_9814a9ffc41959a7044afc7703702a3d/testbuild/testprog.cpython-35m-x86_64-linux-gnu.so
>>     <http://testprog.cpython-35m-x86_64-linux-gnu.so>',
>>     '-Wl,-Bstatic', '-Wl,-Bdynamic',
>>     '-L/home/michaelzfreeman/.pyenv/versions/3.5.1/lib',
>>     '-L/home/michaelzfreeman/.pyenv/versions/3.5.1/lib/python3.5/config-3.5m',
>>     '-lpython3.5m', '-lpthread', '-ldl', '-lutil', '-lm']
>>     err: /usr/bin/ld:
>>     /home/michaelzfreeman/.pyenv/versions/3.5.1/lib/libpython3.5m.a(pylifecycle.o):
>>     relocation R_X86_64_32 against `.rodata.str1.1' can not be used
>>     when making a shared object; recompile with -fPIC
>>     /home/michaelzfreeman/.pyenv/versions/3.5.1/lib/libpython3.5m.a:
>>     error adding symbols: Bad value
>>     collect2: error: ld returned 1 exit status"
>>
>>     Could be some kind of 64 bit/32bit mismatch ? But I'm wildly
>>     guessing here.
>>
>>     So I need to find a way of testing my build environment first
>>     before proceeding (see top).
>>
>>     Michael Z Freeman
>>

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.