Compile w/Py3 & Qt5 for Dummies

Having trouble installing or compiling FreeCAD? Get help here.
wandererfan
Posts: 2988
Joined: Tue Nov 06, 2012 5:42 pm

Compile w/Py3 & Qt5 for Dummies

Postby wandererfan » Fri Nov 23, 2018 2:32 pm

Are there simple instructions available for building a) with py3 and b) with Qt5? My search results offer clues and hints, but no real step by step help. I'm using CMakeGui, currently trying to build Qt4/py3 version and getting stuck here:

Code: Select all

Using default python: -python2.7  <<<<<< where is this switch???
libshiboken built for Release
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/PySide-1.2.2/PySideConfig.cmake:5 (include):
  include could not find load file:

    /usr/lib/x86_64-linux-gnu/cmake/PySide-1.2.2/PySideConfig-python3.5.cmake  <<<<<  file search can't find this
Call Stack (most recent call first):
  CMakeLists.txt:1032 (find_package)


CMake Error at CMakeLists.txt:1034 (MESSAGE):
  =================

  PySide not found.

  =================
Can anybody help a point & click developer?
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby abdullah » Fri Nov 23, 2018 3:52 pm

wandererfan wrote:
Fri Nov 23, 2018 2:32 pm
Are there simple instructions available for building a) with py3 and b) with Qt5? My search results offer clues and hints, but no real step by step help. I'm using CMakeGui, currently trying to build Qt4/py3 version and getting stuck here:
I cannot quite help with py3, as I have not done it, but I may help with the second, as I have just done it. No step by step instructions though... sorry

python2.7 is the switch for building of python2.7 and you will find this in the cmake options:
Screenshot_20181123_164653.png
Screenshot_20181123_164653.png (37.82 KiB) Viewed 1328 times
There is one thing I have learnt the hard way: Start with an empty build folder AND set the QT5 flag on the first execution of cmake:

Code: Select all

cmake ../folderwithyourfreecadcode/ -DBUILD_QT5=ON
Otherwise you will get qt4 dependencies that will be impossible to remove. I ended up doing:

Code: Select all

grep -i qt4 *
in the build directory to make sure no qt4 was linked.

Another think for AFTER compiling is that some 3rd party workbenches may try to load qt4 dependencies, which crashed FC, a possibly outdated version of Animation WB was the culprit in my case.

EDIT: This is what Kurt uses for py3+qt5:
https://salsa.debian.org/science-team/f ... bian/rules

EDIT 2: I think you need pyside2 for qt5, I have pyside2 installed.
qurn
Posts: 22
Joined: Wed Oct 10, 2018 4:49 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby qurn » Fri Nov 23, 2018 11:40 pm

b) QT5
The arch-user-repository has a PKGBUILD installation skrip. Have a look at depends and build. In addition i turn of every workbench i am not using, as it speeds up the compilation time a lot.

My workflow is like this:
git clone to FreeCAD_fresh folder. Update only this folder with git pull.

Copy FreeCAD_fresh to eg. FreeCAD_qt5 and then start experimenting.

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release \
      -DFREECAD_USE_OCC_VARIANT="Official Version" \
      -DBUILD_ARCH=OFF \
      -DBUILD_FEM=OFF \
      -DBUILD_FEM_NETGEN=OFF \
      -DBUILD_INSPECTION=OFF \
      -DBUILD_MATERIAL=OFF \
      -DBUILD_MESH=OFF \
      -DBUILD_MESH_PART=OFF \
      -DBUILD_OPENSCAD=OFF \
      -DBUILD_PATH=OFF \
      -DBUILD_QT5=ON \
      -DBUILD_RAYTRACING=OFF \
      -DBUILD_REVERSEENGINEERING=OFF \
      -DBUILD_ROBOT=OFF \
      -DBUILD_SHIP=OFF \
      -DBUILD_START=OFF \
      -DBUILD_WEB=OFF\
      -DFREECAD_USE_EXTERNAL_PIVY=ON \
      -DPYTHON_EXECUTABLE=/usr/bin/python2

make -j2 &> make_log
qurn
Posts: 22
Joined: Wed Oct 10, 2018 4:49 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby qurn » Sat Nov 24, 2018 1:08 am

For a) python 3 there is also a FreeCAD build-skrip in the aur. I was able to build FreeCAD with python 3 like this. The aur has some different versions of FreeCAD.
Note for my post above:
"-j2" means 3 processors will be used for compilation.
" &> make_log" writes the output in make_log file instead of the terminal.
wandererfan
Posts: 2988
Joined: Tue Nov 06, 2012 5:42 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby wandererfan » Sat Nov 24, 2018 8:58 pm

After much fiddling I have a py3/qt5 build that works for C++ workbenches.

Draft and add-ons are not happy at all. The Pyside2 I installed has syntax differences vs PySide.

Code: Select all

During initialization the error module 'PySide2.QtGui' has no attribute 'QWidget'
During initialization the error 'PySide2.QtCore.QCoreApplication.translate' called with wrong argument types
type object 'PySide2.QtWidgets.QApplication' has no attribute 'UnicodeUTF8'
etc
Is this to be expected? Looks like a big editing effort for Arch,Draft, and add-ons before they are fit for release.

Setting BuildQt5 True didn't seem to work. I had to clean out the build directory and edit the cmake cache to pick up Qt5 (Thanks, Abdullah!). The CMake settings I used are attached.

I used ppas for pivy(deb http://ppa.launchpad.net/sppedflyer/mytestppa1/ubuntu xenial main)
and pyside2 (deb http://ppa.launchpad.net/thopiekar/pyside-git/ubuntu xenial main).

Since I started this exercise to test some changes to Draft with Py3, I'm no farther ahead than when I started. Maybe somebody else can learn from my mistakes.

Hats off to the people who wrestle with this dreck everyday.
Attachments
Py3Qt5CMakeSetting.txt
(5.35 KiB) Downloaded 44 times
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 Nov 24, 2018 9:02 pm

Sorry, but I don't see how this provides info exclusive to developers. I think this topic should be moved to Install / Compile where it would benefit end users and developers alike who want to compile FC with Py3/Qt5.
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Compile w/Py3 & Qt5 for Dummies

Postby ian.rees » Sun Nov 25, 2018 12:37 am

NormandC wrote:
Sat Nov 24, 2018 9:02 pm
I think this topic should be moved to Install / Compile where it would benefit end users and developers alike who want to compile FC with Py3/Qt5.
Done!
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby abdullah » Sun Nov 25, 2018 5:45 am

wandererfan wrote:
Sat Nov 24, 2018 8:58 pm
I used ppas for pivy(deb http://ppa.launchpad.net/sppedflyer/mytestppa1/ubuntu xenial main)
and pyside2 (deb http://ppa.launchpad.net/thopiekar/pyside-git/ubuntu xenial main).
In my py2 version, I have used everything stock of Ubuntu 18.04. However, now that you pointed out Draft issues, I have tried to switch to Draft WB:

Code: Select all

Error: Initializing one or more of the Draft modules failed, Draft will not work as expected.
CommandManager::addTo() try to add an unknown command (Draft_Line) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Wire) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Circle) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Arc) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Ellipse) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Polygon) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Rectangle) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Text) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Dimension) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_BSpline) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Point) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_ShapeString) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Facebinder) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_BezCurve) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Label) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Move) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Rotate) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Offset) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Trimex) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Upgrade) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Downgrade) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Scale) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Edit) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_WireToBSpline) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_AddPoint) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_DelPoint) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Shape2DView) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Draft2Sketch) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Array) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_PathArray) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_PointArray) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Clone) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Drawing) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Mirror) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Stretch) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Line) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Wire) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Circle) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Arc) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Ellipse) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Polygon) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Rectangle) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Text) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Dimension) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_BSpline) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Point) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_ShapeString) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Facebinder) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_BezCurve) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Label) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Move) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Rotate) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Offset) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Trimex) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Upgrade) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Downgrade) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Scale) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Edit) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_WireToBSpline) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_AddPoint) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_DelPoint) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Shape2DView) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Draft2Sketch) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Array) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_PathArray) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_PointArray) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Clone) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Drawing) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Mirror) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Stretch) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_VisGroup) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Heal) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_FlipDimension) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_ToggleConstructionMode) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_ToggleContinueMode) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Edit) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Slope) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_SetWorkingPlaneProxy) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_AddConstruction) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_ApplyStyle) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_ToggleDisplayMode) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_AddToGroup) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_SelectGroup) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_SelectPlane) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_ShowSnapBar) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_ToggleGrid) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_AutoGroup) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_UndoLine) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_FinishLine) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_CloseLine) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Lock) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Midpoint) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Perpendicular) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Grid) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Intersection) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Parallel) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Endpoint) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Angle) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Center) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Extension) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Near) to a widget!
CommandManager::addTo() try to add an unknown command (Draft_Snap_Ortho) to a widget!
EDIT: Arch WB does not load at all.
User avatar
bernd
Posts: 8351
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Compile w/Py3 & Qt5 for Dummies

Postby bernd » Sun Nov 25, 2018 8:26 am

same problem here on debian buster ... see topic https://forum.freecadweb.org/viewtopic.php?f=4&t=32286 at the moment I stuck with pivy for Python3 I am not able to neither comile or make a deb out of kurts pivy for Python3 repo.
looo
Posts: 2824
Joined: Mon Nov 11, 2013 5:29 pm

Re: Compile w/Py3 & Qt5 for Dummies

Postby looo » Sun Nov 25, 2018 8:33 am

bernd wrote:
Sun Nov 25, 2018 8:26 am
same problem here on debian buster ... see topic https://forum.freecadweb.org/viewtopic.php?f=4&t=32286 at the moment I stuck with pivy for Python3 I am not able to neither comile or make a deb out of kurts pivy for Python3 repo.
How is your coin-package build? If it is build with cmake you should be able to build pivy with:

Code: Select all

git clone https://github.com/FreeCAD/pivy
cd pivy
python3 setup.py build
sudo python3 setup.py install
if it is an older build configured with autotools try this:

Code: Select all

git clone https://github.com/FreeCAD/pivy
cd pivy
python3 setup_old.py build
sudo python3 setup_old.py install