There is probably nothing special in what I am going to write here, but I think it may make sense to share it with you.
Since quite a while I wanted to be able to debug FreeCAD with a debug version of OpenCascade, so that I could investigate OpenCascade bugs. Finally today I have gone for it.
Opencascade GIT
It is possible to publicly clone the Opencascade git like this:
Code: Select all
git clone https://git.dev.opencascade.org/repos/occt.git
https://www.opencascade.com/doc/occt-6. ... cmake.html
The advise of using 3 directories, one for sources, one for build and a third one for installation is very useful. This allows to have the installation on a local folder and to not interfere with system libraries.
I have used ccmake as they recommend to configure the build options. I used Kurt's balsa settings as reference:
https://salsa.debian.org/science-team/o ... bian/rules
But setting the build type to Debug and my INSTALL_DIR to /mylocalfolder/usr.
After make and make install, you are set to configure FreeCAD to use this library.
Building FreeCAD
I build FreeCAD out of tree, so I use this:
Code: Select all
cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Debug -DOCC_INCLUDE_DIR=/mylocalfolder/usr/include/opencascade ../free-cad-code
N.B: Make sure you use a current version of master, as OCCT has introduced a change to a function in current master and Werner just pushed a fix for this today (I could have avoided having to do it myself if I waited just some hours...)
Running FreeCAD
Now you have a locally built FreeCAD compiled against your locally built OCCT, but when you run it, it will take your system OCCT library (and it will eventually crash). To avoid this, you can use:
Code: Select all
env LD_LIBRARY_PATH=/mylocalfolder/usr/lib ./FreeCAD
Now you can start debugging FreeCAD and it will jump to OCCT code, which you could fix, recompile OCCT, recompile FreeCAD,...
Example
Today I was looking at this:
https://tracker.freecadweb.org/view.php?id=4129
And I ended up filing a report and a possible patch with them to solve a crash:
https://tracker.dev.opencascade.org/view.php?id=31585
As I was saying, nothing special, just trying to show it is actually easier than it looks.