kicad-developers team mailing list archive
Mailing list archive
Re: CMake doesn't find the right PythonLibs on recent Ubuntus, workaround included
In order to get a "legal" Debian/Ubuntu package, you have to do a
bunch of trickery anyway, so I'm not concerned about this at all from
a packaging point of view. (For example, you need to run pyversions
to find out which python versions are around, and then iterate over
that, creating a variety of binary extensions, and then tell the
package about them in a special way. Then, when you install it, it'll
put the files in pyshared, and symlink the right things into the
dist-packages for your python version.) I'm mostly concerned with
helping out someone else who runs into this on their system when
building from source. I don't think it's just my machine.
On the system that I found this issue on, python -V returns python
2.7.3, and I dont have a custom PYTHONPATH. I think CMake is finding
the proper PythonInterp, but not the proper PythonLibs.
When I override the PythonLibs location, like in my previous email,
the built kicad's scripting works fine, without doing any mangling of
any paths. I just type kicad in a terminal, and it works, and I can
cd into build/pcbnew and do a python, import pcbnew, and it works.
I'm 99% sure this isn't a regression on CMake's part, just that Ubuntu
is now doing something that CMake doesn't expect with symlinks and
other tomfoolery with its Python. We'll see how my afternoon goes.
If I investigate this anymore, I have a feeling I'll just return with
a CMake patch. :)
Wayne and Layne, LLC
On Fri, Apr 12, 2013 at 1:46 PM, Wayne Stambaugh <stambaughw@xxxxxxxxxxx> wrote:
> On 4/12/2013 8:28 AM, Adam Wolf wrote:
>> As part of setting up the build server, I've been taking a harder look
>> at the Ubuntu packages.
>> CMake isn't detecting the right Python libs on some systems, including
>> Ubuntu 12.10. I'm not sure if the issue is in CMake, or Ubuntu, or
>> Python, or whatever else, but there's a simple enough workaround...
>> If you get something like this when you cmake for kicad:
>> -- Found PythonInterp: /usr/bin/python (found version "2.7.3")
>> -- Check for installed Python Interpreter -- found
>> -- Python module install path: /usr/lib/python2.7/dist-packages
>> -- Found PythonLibs: /usr/lib/python3.2/config/libpython3.2.so (found
>> version "2.7.3")
>> Your build will probably die when it reaches anything SWIGgy, due to
>> CMake detecting /usr/lib/python3.2/config/libpython3.2.so as matching
>> the version of your interpreter, which is 2.7.3. You can point cmake
>> to the appropriate PythonLibs, like the following:
>> cmake ../ -DKICAD_TESTING_VERSION=ON -DKICAD_SCRIPTING=ON
>> -DKICAD_SCRIPTING_MODULES=ON -DKICAD_SCRIPTING_WXPYTHON=ON
>> This appears to fix it. I can make builds and use the Python library.
>> This has been documented by some other folks, with a different
>> workaround as well. If you add a minimum version number requirement,
>> like find_package(PythonLibs 2.6) it seems to work on Ubuntu as well.
>> With all the cmake balls we're juggling, it's probably safest to just
>> override it on the command line until it gets fixed upstream.
>> Adam Wolf
>> Wayne and Layne, LLC
> The CMake FindPythonInter used to do the correct thing. It looked for the
> default version of Python by first looking at the PYTHON_PATH environment
> variable then for /usr/bin/python which typically is just a sym-link to find
> the default version of Python. If either of these is pointing to python 3
> on you build system then that is what the Python scripting will be built
> against unless you specify the python interpreter at build time. If you
> override this by specifying it on the command like you've shown above, then
> the KiCad python scripting will not be recognized in your system's default
> python version because it's being build against and installed in python 2.7
> not python 3. I guess from our standpoint since wxWidgets does not build
> against python 3 so we need to set the python version to < 3 until wxWidgets
> can be built against Python 3. I'm not sure if FindPythonInterp is
> sophisticated enough to do this.
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp