Compile w/Py3 & Qt5 for Dummies

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Compile w/Py3 & Qt5 for Dummies

Post by triplus »

I still use Pivy package provided from here:

https://forum.freecadweb.org/viewtopic. ... 60#p178315

P.S. Thanks @looo. ;)
User avatar
wandererfan
Veteran
Posts: 6315
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Compile w/Py3 & Qt5 for Dummies

Post by wandererfan »

I finally built master with Py3 and Qt5...

You shouldn't need the first 3 steps, but I didn't succeed without them.

Make a build dir, then in cmakeGui:
  • source = your FreeCAD source dir
  • target = your FreeCAD build dir
  • run cmake "configure" - expect lots of errors. don't worry.
  • tick BuildQt5
  • untick all unneeded modules
  • -- BuildWeb causes compile errors
  • -- I used a bare minimum of Workbenches - no Path, no Fem, no Ship, etc
  • select OCC version (official)
  • run cmake "generate" - more errors. don't worry.
  • update Qt5 dir variables (eg "/usr/lib/x86_64-linux-gnu/qt5.11/5.11.1/gcc_64/lib/cmake/Qt5Concurrent"
  • update Qt5WebkitWidgets and Qt5Webkit variables to system Qt5 (eg "/usr/lib/x86_64-linux-gnu/cmake/Qt5WebKitWidgets")
  • update PythonBaseName (eg ".cpython-36m-x86_64-linux-gnu")
  • update PythonConfigSuffix (eg ".cpython-36m-x86_64-linux-gnu")
  • update Boost_Python36_Library* (eg "/usr/lib/x86_64-linux-gnu/libboost_python3-py36.so")
  • update Boost_Python3_Library* (eg "/usr/lib/x86_64-linux-gnu/libboost_python3.so")
  • set build type (release or debug)
  • run "generate" - if there are errors here, check for typos (py35 instead of py36, etc)
  • switch to build directory
  • run "make - jX" where X is the number of cores to use
  • wait
  • run "./FreeCAD -l"

    FreeCAD will start.

    OS: Linux Mint 19
    Word size of OS: 64-bit
    Word size of FreeCAD: 64-bit
    Version: 0.18.15253 (Git)
    Build type: debug
    Branch: master
    Hash: 73df4e6fc0ed90a30e5958232dbc737d8a47e492
    Python version: 3.6.7
    Qt version: 5.11.1
    Coin version: 4.0.0a
    OCC version: 7.2.0
    Locale: English/Canada (en_CA)
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Compile w/Py3 & Qt5 for Dummies

Post by wmayer »

update PythonBaseName (eg ".cpython-36m-x86_64-linux-gnu")
It looks like this variable was used in the past with the old shiboken/PySide version. But with Qt5 + shiboken2 + PySide2 it seems to be not used any more.
update PythonConfigSuffix
With git commit 1dded002ca CMake is supposed to automatically set this value. Have a look at the CMake output.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Compile w/Py3 & Qt5 for Dummies

Post by Kunda1 »

@wandererfan why not OCC 7.3.0?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
wandererfan
Veteran
Posts: 6315
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Compile w/Py3 & Qt5 for Dummies

Post by wandererfan »

Kunda1 wrote: Fri Nov 30, 2018 9:51 am @wandererfan why not OCC 7.3.0?
I have both installed - locally compiled 7.2 and 7.3 from the FC PPA. cMake found 7.2 and that was good enough for determining if I could build Py3/Qt5.

I don't seem to have an OpenCASCADEConfig.cmake file for 7.3, just the libraries for FreeCAD-Python3.
User avatar
wandererfan
Veteran
Posts: 6315
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Compile w/Py3 & Qt5 for Dummies

Post by wandererfan »

wmayer wrote: Fri Nov 30, 2018 9:02 am
update PythonBaseName (eg ".cpython-36m-x86_64-linux-gnu")
It looks like this variable was used in the past with the old shiboken/PySide version. But with Qt5 + shiboken2 + PySide2 it seems to be not used any more.
update PythonConfigSuffix
With git commit 1dded002ca CMake is supposed to automatically set this value. Have a look at the CMake output.
If I blank out PythonBaseName and PythonConfigSuffix and run generate, I get this in the output:

Code: Select all

-- Found OCE/OpenCASCADE version: 7.2.0
-- OCE/OpenCASCADE include directory: /usr/local/include/opencascade
-- OCE/OpenCASCADE shared libraries directory: /usr/local/lib
Checking for module 'Coin'
  No package 'Coin' found
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
-- matplotlib-2.1.1 has been found.
but the result is using py3.6.

OS: Linux Mint 19
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15286 +3 (Git)
Build type: debug
Branch: DraftPy3
Hash: f19250b60d77c9812c811e19b6a66f7d23b3a8b5
Python version: 3.6.7
Qt version: 5.11.1
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/Canada (en_CA)
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Compile w/Py3 & Qt5 for Dummies

Post by wmayer »

Shiboken2Config: Using default python: -python2.7.x86_64-linux-gnu <<<<<<<<<<<<
This is expected because for the first run the variable is empty and Shiboken2Config.cmake sets a default value.
But starting from this CMake determines the matching value for PYTHON_CONFIG_SUFFIX.

See the output below:
PYTHON_CONFIG_SUFFIX: .cpython-36m-x86_64-linux-gnu
libshiboken built for Release
It would be good if there was a way to suppress the output of Shiboken2Config.cmake to avoid the confusion.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Compile w/Py3 & Qt5 for Dummies

Post by sgrogan »

wandererfan wrote: Fri Nov 30, 2018 1:06 pm I don't seem to have an OpenCASCADEConfig.cmake file for 7.3, just the libraries for FreeCAD-Python3.
You need to install the occt-dev packages from the PPA.
"fight the good fight"
User avatar
wandererfan
Veteran
Posts: 6315
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Compile w/Py3 & Qt5 for Dummies

Post by wandererfan »

sgrogan wrote: Fri Nov 30, 2018 1:24 pm You need to install the occt-dev packages from the PPA.
Had most of them. Was missing occt-misc.

There are 2 occt-misc packages when I look at the ppa. Is one supposed to be occt-misc-dev?
User avatar
kkremitzki
Veteran
Posts: 2515
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Compile w/Py3 & Qt5 for Dummies

Post by kkremitzki »

wandererfan wrote: Sat Dec 01, 2018 1:01 am
sgrogan wrote: Fri Nov 30, 2018 1:24 pm You need to install the occt-dev packages from the PPA.
Had most of them. Was missing occt-misc.

There are 2 occt-misc packages when I look at the ppa. Is one supposed to be occt-misc-dev?
Where do you see the second one?
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.
Post Reply