Compile w/Py3 & Qt5 for Dummies

Having trouble installing or compiling FreeCAD? Get help here.
triplus
Posts: 8415
Joined: Mon Dec 12, 2011 4:45 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby triplus » Mon Nov 26, 2018 12:07 pm

I still use Pivy package provided from here:

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

P.S. Thanks @looo. ;)
wandererfan
Posts: 2770
Joined: Tue Nov 06, 2012 5:42 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby wandererfan » Thu Nov 29, 2018 7:32 pm

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
Site Admin
Posts: 14420
Joined: Thu Feb 19, 2009 10:32 am

Re: Compile w/Py3 & Qt5 for Dummies

Postby wmayer » 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.
User avatar
Kunda1
Posts: 4755
Joined: Thu Jan 05, 2017 9:03 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby Kunda1 » Fri Nov 30, 2018 9:51 am

@wandererfan why not OCC 7.3.0?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
wandererfan
Posts: 2770
Joined: Tue Nov 06, 2012 5:42 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby wandererfan » Fri Nov 30, 2018 1:06 pm

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.
wandererfan
Posts: 2770
Joined: Tue Nov 06, 2012 5:42 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby wandererfan » Fri Nov 30, 2018 1:17 pm

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
Site Admin
Posts: 14420
Joined: Thu Feb 19, 2009 10:32 am

Re: Compile w/Py3 & Qt5 for Dummies

Postby wmayer » Fri Nov 30, 2018 1:24 pm

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
Posts: 5201
Joined: Wed Oct 22, 2014 5:02 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby sgrogan » Fri Nov 30, 2018 1:24 pm

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.
wandererfan
Posts: 2770
Joined: Tue Nov 06, 2012 5:42 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby wandererfan » 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?
User avatar
kkremitzki
Posts: 1638
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: Compile w/Py3 & Qt5 for Dummies

Postby kkremitzki » Sat Dec 01, 2018 4:25 am

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.