Compile w/Py3 & Qt5 for Dummies

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
kkremitzki
Posts: 1506
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: Compile w/Py3 & Qt5 for Dummies

Postby kkremitzki » Sun Jan 13, 2019 5:07 pm

reox wrote:
Sun Jan 13, 2019 5:02 pm
I got QT5 + Py3.7 working on debian sid using these changes: https://github.com/reox/FreeCAD_gitpack ... f4af524697
I'm not sure about all the cmake variables, maybe some of them are also autogenerated...
You shouldn't need to set all those flags, the only Python 3 flag required is -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.
reox
Posts: 536
Joined: Sat Aug 13, 2016 10:06 am

Re: Compile w/Py3 & Qt5 for Dummies

Postby reox » Sun Jan 13, 2019 5:47 pm

kkremitzki wrote:
Sun Jan 13, 2019 5:07 pm
reox wrote:
Sun Jan 13, 2019 5:02 pm
I got QT5 + Py3.7 working on debian sid using these changes: https://github.com/reox/FreeCAD_gitpack ... f4af524697
I'm not sure about all the cmake variables, maybe some of them are also autogenerated...
You shouldn't need to set all those flags, the only Python 3 flag required is -DPYTHON_EXECUTABLE="/usr/bin/python3".
good to know, thanks!

I basically copy/pasted from Moult and changed the SUFFIX :D
looo
Posts: 2463
Joined: Mon Nov 11, 2013 5:29 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby looo » Sat Feb 09, 2019 9:29 am

this is how it worked for me on ubuntu 18.04:

add ppa for pybind11:
https://launchpad.net/~nschloe/+archive ... -backports

install a lot of packages. Most are suggested by cmake errors:
- libocct*
- libboost*
- libcoin-dev
- python3-pyside2
- python3-pivy (freecad-ppa)
- libshiboke2-dev
- libeigen3-dev
- pybind11
- netgen
- netgen-headers
....

use some variables:

Code: Select all

cmake -D BUILD_QT5=ON \
      -D PYTHON_EXECUTABLE=/usr/bin/python3.6 \
      -D FREECAD_USE_PYBIND11:BOOL=ON \
      -D USE_BOOST_PYTHON:BOOL=OFF \
      -D BUILD_ENABLE_CXX11:BOOL=ON \
      -D BUILD_PLOT:BOOL=OFF \
      -D BUILD_SHIP:BOOL=OFF \
      -D FREECAD_USE_OCC_VARIANT="Official Version" \
      -D BUILD_FLAT_MESH:BOOL=ON \
      -D BUILD_FEM_NETGEN:BOOL=ON \
      -D ENABLE_MED:BOOL=OFF \
      ..
looo
Posts: 2463
Joined: Mon Nov 11, 2013 5:29 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby looo » Sat Feb 09, 2019 10:25 am

Somehow I am missing /usr/lib/python3.6/site-packages/shiboken2.<cpython....>.so

for conda it's installed here:

Code: Select all

locate shiboken2 |grep conda |grep python3.7/site-packages
/home/k/conda/envs/freecad-gcc7/lib/python3.7/site-packages/shiboken2.cpython-37m-x86_64-linux-gnu.so
/home/k/conda/pkgs/pyside2-5.6.0a1-py37h4a9562c_1004/lib/python3.7/site-packages/shiboken2.cpython-37m-x86_64-linux-gnu.so
but it seems there is no equivalent for ubuntu 18.04:

Code: Select all

dpkg -S shiboken2 |grep python |grep .so
libshiboken2-dev: /usr/lib/x86_64-linux-gnu/libshiboken2-python2.7.x86_64-linux-gnu.so
libshiboken2-py3-5.11: /usr/lib/x86_64-linux-gnu/libshiboken2.cpython-36m-x86_64-linux-gnu.so.5.11
libshiboken2-py3-5.11: /usr/lib/x86_64-linux-gnu/libshiboken2.cpython-36m-x86_64-linux-gnu.so.5.11.2
libshiboken2-dev: /usr/lib/x86_64-linux-gnu/libshiboken2.cpython-36m-x86_64-linux-gnu.so
libshiboken2-5.11: /usr/lib/x86_64-linux-gnu/libshiboken2-python2.7.x86_64-linux-gnu.so.5.11
libshiboken2-5.11: /usr/lib/x86_64-linux-gnu/libshiboken2-python2.7.x86_64-linux-gnu.so.5.11.2

edit: next problem is fem-netgen meshing which doesn't work very well. I guess the internal smesh needs some modifications to work with latest netgen package.

Maybe someone can provide a smesh package for external smesh? https://github.com/LaughlinResearch/SMESH which works with netgen6.2 (at least for conda-packages)
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Compile w/Py3 & Qt5 for Dummies

Postby NormandC » Sat Feb 09, 2019 7:25 pm

I'm not the most knowledgeable in these matters, and it's possible I don't understand your question, but wouldn't shiboken2.cpython-37m-x86_64-linux-gnu.so be the same as libshiboken2.cpython-37m-x86_64-linux-gnu.so for a debian package-installed shiboken2?

You already show it listed, and it's what I use for my local compilation of FreeCAD on Ubuntu 18.04. To be clear: my /usr/lib/python3.6/site-packages/ is empty except for a shortcut for vtk. Scratch that, that's the python2.7 folder, I don't even have a python3.6 folder. Remember, on Debian/Ubuntu, site-packages is not used. ;)

Code: Select all

Shiboken2Config: Using default python: -python2.7.x86_64-linux-gnu
libshiboken built for Release
PYTHON_CONFIG_SUFFIX: .cpython-36m-x86_64-linux-gnu
libshiboken built for Release
Nevermind the -python2.7.x86_64-linux-gnu above, I believe wmayer explained that it's disregarded.

For me, Shiboken2_DIR is /usr/lib/x86_64-linux-gnu/cmake/Shiboken2-5.11.2
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Compile w/Py3 & Qt5 for Dummies

Postby NormandC » Sat Feb 09, 2019 7:43 pm

looo wrote:
Sat Feb 09, 2019 10:25 am
Maybe someone can provide a smesh package for external smesh?
Kurt did it already on the freecad-community PPA https://launchpad.net/~freecad-communit ... ubuntu/ppa

There's a salome-smesh_8.3.0.2 package, and the LaughlinResearch repo was used. From his blog:

https://kkremitzki.github.io/blog/free- ... mber-2018/
kkremitzki wrote: smesh
GitHub

A stand-alone library of the mesh framework from the Salome Platform

I've gotten this standalone version of SMESH packaged and awaiting sponsorship at https://salsa.debian.org/kkremitzki-guest/salome-smesh. Eventually, I want to package the entire Salome Platform, but it's extremely large and really several source packages. Packaging this as an intermediate step allows us to remove SMESH from FreeCAD's included sources.

It's also available on the FreeCAD Community Extras PPA.
I haven't tried it... It built only on amd64, but failed on i386.
looo
Posts: 2463
Joined: Mon Nov 11, 2013 5:29 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby looo » Sun Feb 10, 2019 11:14 am

Thanks for the reply @NormanC.
I'm not the most knowledgeable in these matters, and it's possible I don't understand your question, but wouldn't shiboken2.cpython-37m-x86_64-linux-gnu.so be the same as libshiboken2.cpython-37m-x86_64-linux-gnu.so for a debian package-installed shiboken2?
Hmm I do think there have to be two different shiboken libraries:
1. libshiboken2.cpython-.....so in /usr/lib
2. shiboken2.cpython-.....so in /usr/lib/pythonx.y/site-packages

The second one is necesarry if shiboken is used from python (which is done in pivy and some freecad-modules. This trace-backs lead to the assumption there is missing the second library:

Code: Select all

During initialization the error Cannot load shiboken2 module occurred in /home/k/projects/FreeCAD/build/Mod/Tux/InitGui.py
Please look into the log file for further information


I wonder why you guys don't have this problem.

NormandC wrote:
Sat Feb 09, 2019 7:43 pm
Kurt did it already on the freecad-community PPA https://launchpad.net/~freecad-communit ... ubuntu/ppa
Hmmm, somehow I am not able to install this package:

Code: Select all

sudo apt-get install salome-smesh
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.       
Statusinformationen werden eingelesen.... Fertig
Paket salome-smesh ist nicht verfügbar, wird aber von einem anderen Paket
referenziert. Das kann heißen, dass das Paket fehlt, dass es abgelöst
wurde oder nur aus einer anderen Quelle verfügbar ist.

E: Für Paket »salome-smesh« existiert kein Installationskandidat.
This is german and means that there is no salome-smesh but there is a package which refers to salome-smesh. Any ideas?
reox
Posts: 536
Joined: Sat Aug 13, 2016 10:06 am

Re: Compile w/Py3 & Qt5 for Dummies

Postby reox » Sun Feb 10, 2019 10:37 pm

looo wrote:
Sun Feb 10, 2019 11:14 am
Hmmm, somehow I am not able to install this package:

try

Code: Select all

apt-cache policy salome-smesh
this will show you a priority for the package and what versions are available.

It looks like that it is only build for bionic. do you have the right sources.list entry?
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Compile w/Py3 & Qt5 for Dummies

Postby NormandC » Sun Feb 10, 2019 11:39 pm

looo wrote:
Sun Feb 10, 2019 11:14 am
Hmm I do think there have to be two different shiboken libraries:
1. libshiboken2.cpython-.....so in /usr/lib
2. shiboken2.cpython-.....so in /usr/lib/pythonx.y/site-packages

The second one is necesarry if shiboken is used from python (which is done in pivy and some freecad-modules. This trace-backs lead to the assumption there is missing the second library:
There is a shiboken2 package that is installed on my system, but it only contains the changelog, copyright and man page. Kurt ported it to the PPA from Debian (it is currently in experimental and testing).

https://packages.debian.org/buster/amd6 ... 2/filelist

As I said: I'm pretty sure it is Debian policy to have libraries installed in /usr/lib/, nothing is installed in /usb/lib/pythonx.y/site-packages. And shared library files always have a "lib" suffix. Kurt did it for the upcoming FreeCAD package in Debian. https://packages.debian.org/sid/libfreecad-python3-0.18

looo wrote:
Sun Feb 10, 2019 11:14 am
I wonder why you guys don't have this problem.
I can't say, my Py3/Qt5 build runs fine. I remember seeing this error early on, but not anymore. It may be a CMake configuration issue on your end.

looo wrote:
Sun Feb 10, 2019 11:14 am
Hmmm, somehow I am not able to install this package:
Sorry, I didn't look into the package details. salome-smesh is the same of the source package, the binary packages are actually libsalome-smesh and libsalome-smesh-dev. Is the dev package necessary? I guess so.

Code: Select all

sudo apt install libsalome-smesh-dev
will automatically install both packages.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Compile w/Py3 & Qt5 for Dummies

Postby NormandC » Mon Feb 11, 2019 4:13 am

I tried to build with the freecad-community salome-smesh package but it failed.

Code: Select all

[ 67%] Building CXX object src/Mod/MeshPart/App/CMakeFiles/MeshPart.dir/Mesher.cpp.o
/home/normand2/compilation/FreeCAD/freecad-code/src/Mod/MeshPart/App/Mesher.cpp:44:10: fatal error: SMESH_Gen.hxx: No file or folder of this type
 #include <SMESH_Gen.hxx>
          ^~~~~~~~~~~~~~~
compilation terminated.
src/Mod/MeshPart/App/CMakeFiles/MeshPart.dir/build.make:162: recipe for target 'src/Mod/MeshPart/App/CMakeFiles/MeshPart.dir/Mesher.cpp.o' failed
make[2]: *** [src/Mod/MeshPart/App/CMakeFiles/MeshPart.dir/Mesher.cpp.o] Error 1
CMakeFiles/Makefile2:2836: recipe for target 'src/Mod/MeshPart/App/CMakeFiles/MeshPart.dir/all' failed
make[1]: *** [src/Mod/MeshPart/App/CMakeFiles/MeshPart.dir/all] Error 2
kkremitzki wrote:ping
Any idea? That file is on my system, in /usr/include/smesh/SMESH_Gen.hxx

There is only one single variable in CMake for smesh, SMESH_DIR and I set it to /usr/lib/cmake/salome-smesh. Of course, I enabled FREECAD_USE_EXTERNAL_SMESH.

I also tried to build with flatmesh and netgen and failed, and after a search found that both require pybind11 2.2, while Ubuntu 18.04 provides 2.0. Goody, I didn't remember that. :roll: