Compiling on Ubuntu: Shiboken2 problems

Having trouble installing or compiling FreeCAD? Get help here.
Bayesian
Posts: 57
Joined: Thu Aug 08, 2019 1:49 pm

Compiling on Ubuntu: Shiboken2 problems

Postby Bayesian » Fri Nov 08, 2019 8:16 am

I have been trying to compile FreeCAD master and the Realthunder branch on an Ubuntu system. I can successfully build both with Python 3.6, but not 3.7.

For one thing, Cmake seems to recognize both the Python 3.7 installation I specify on the command line and a Python 2.7 one I didn't. I have installed the shiboken2 packages from Ubuntu.

Then I get errors that Shiboken2 wants to link to Python 2.7 symbols, which aren't there. Do I need to get shiboken2 for Python 3.7 somewhere?

Thank you!
User avatar
kkremitzki
Posts: 1795
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: Compiling on Ubuntu: Shiboken2 problems

Postby kkremitzki » Fri Nov 08, 2019 2:48 pm

You didn't specify which particular Ubuntu version you're on nor the CMake flags you used which would be helpful.

You have both Python 3.6 and 3.7 on the same system? Is one a custom installation? If so, everything in FreeCAD's dependency chain which is linked against Python needs to be rebuilt to link to your custom Python.

Regardless of whether newer Ubuntus have Python 3.6 or 3.7, both work, so it's not a problem with a particular Python version.

For those, if you're on Ubuntu 18.04 or newer, it should be sufficient to call CMake just with

Code: Select all

cmake ../freecad -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
Bayesian
Posts: 57
Joined: Thu Aug 08, 2019 1:49 pm

Re: Compiling on Ubuntu: Shiboken2 problems

Postby Bayesian » Fri Nov 08, 2019 4:19 pm

I'm using 18.04 and Python 3.5,3.6 and 3.7 from the official Ubuntu repositories.

I now that I have to have shiboken2 for python3.7 in some form ... I had hoped someone would tell me how. Also I don't know why cmake still wants to link Python 2.7...

Specifying python3 is not sufficient, because that's linked to 3.6.

Code: Select all

cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.7m -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m/ -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.7m.so    -DFREECAD_USE_EXTERNAL_SMESH=OFF ../freecad-source/

Code: Select all

==============
Summary report
==============

-- Build type:          
-- Python:              [/usr/bin/python3.7m] [-python2.7.x86_64-linux-gnu]
-- PCL:                 not enabled
-- pybind11:            not enabled
I've figured out by now that the pytho3.7 stuff doesn't have shiboken2 from the repositories, so I'm going to install that manually.
User avatar
kkremitzki
Posts: 1795
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: Compiling on Ubuntu: Shiboken2 problems

Postby kkremitzki » Fri Nov 08, 2019 4:22 pm

On Ubuntu 16.04 I also have to include PYTHON_BASENAME and PYTHON_SUFFIX flags, so maybe adding those in this format would help:

https://salsa.debian.org/science-team/f ... /rules#L33

(DEB_HOST_MULTIARCH is for example x86_64-linux-gnu)
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
User avatar
freman
Posts: 746
Joined: Tue Nov 27, 2018 10:30 pm

Re: Compiling on Ubuntu: Shiboken2 problems

Postby freman » Mon Nov 11, 2019 7:58 am

whenever I scan some output with that package name it always reads as shitbroken2 , rather unfortunate naming.

On Fedora30

Code: Select all

python3 -V
Python 3.7.5