First build - failed

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: First build - failed

Post by wmayer »

[External Code]
Part_d.pyd!Part::Tools::getPointNormals(const TopoDS_Face & theFace, opencascade::handle<Poly_Triangulation> aPolyTri, NCollection_Array1<gp_Dir> & theNormals) Line 579 C++
This rings a bell. I remember having the exact same problem a few years ago with one of the official libpacks. I think that for one of the OCC dlls a release build is used instead of a debug build.

Which of the libpacks on GH have you downloaded?
User avatar
NewJoker
Veteran
Posts: 3089
Joined: Sun Oct 11, 2020 7:49 pm

Re: First build - failed

Post by NewJoker »

wmayer wrote: Sun Nov 06, 2022 6:53 pm Which of the libpacks on GH have you downloaded?
I downloaded LibPack-OCC76-V2-7 from here: https://github.com/FreeCAD/FreeCAD-LibP ... es/tag/2.7
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: First build - failed

Post by wmayer »

NewJoker wrote: Sun Nov 06, 2022 6:56 pm I downloaded LibPack-OCC76-V2-7 from here: https://github.com/FreeCAD/FreeCAD-LibP ... es/tag/2.7
I have tested this libpack and I can confirm the problem with the debug build. The good thing is that the OCC debug dlls are all OK but the unfortunate property of this libpack is that the OCC release and debug dlls have the same name and thus it's impossible to put both into the same directory.

Now the problem is that for a debug build the linker correctly links the OCC debug libs but at runtime the release dlls are used. So, to workaround this issue all what you can do is to create separate directories for a release and debug build of FreeCAD. Then for the FreeCAD debug build first copy over the dlls of the libpack's bin directory to FreeCAD's bin directory and afterwards replace the OCC dlls with the files of the libpack's bind directory.
User avatar
NewJoker
Veteran
Posts: 3089
Joined: Sun Oct 11, 2020 7:49 pm

Re: First build - failed

Post by NewJoker »

@wmayer I got back to this and I still get the same error when starting FreeCAD 0.22 built from the source using the new LibPack (2.9):

compiled error.png
compiled error.png (44.82 KiB) Viewed 804 times

It happens whenever I try to add any geometry in any of the modules (I can pretty much only create a sketch) in the compiled FreeCAD. Some modules (like Mesh) cause a crash when I open them, others (like Path or Curved Shapes) trigger something like this:

wb failure.png
wb failure.png (85.55 KiB) Viewed 804 times

Code: Select all

OS: Windows 10 build 19045
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.33853 (Git)
Build type: Debug
Branch: master
Hash: f57627aa10801288001fa43a249dc09003f7962b
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: Polish/Poland (pl_PL)
Installed mods: 
  * A2plus 0.4.60n
  * CfdOF 1.24.3
  * CurvedShapes 1.0.4
  * Curves 0.6.13
  * Defeaturing 1.2.0
  * dodo 1.0.0
  * fasteners 0.4.59
  * freecad.gears 1.0.0
  * Manipulator 1.5.0
  * sheetmetal 0.2.63
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: First build - failed

Post by wmayer »

It happens whenever I try to add any geometry in any of the modules (I can pretty much only create a sketch) in the compiled FreeCAD.
It's because the release build of OCC is used for a debug of FreeCAD. There is an issue with an array inside the class Poly_Connect. You should try to use the debug build of OCC.
Some modules (like Mesh) cause a crash when I open them
This is because boost-python is linked against the release build of Python but FreeCAD used the debug build. To circumvent this issue you should set the build option FREECAD_USE_PYBIND11 to true.
others (like Path or Curved Shapes) trigger something like this:
Seems like there are missing the debug builds of some Python modules needed by numpy.
User avatar
NewJoker
Veteran
Posts: 3089
Joined: Sun Oct 11, 2020 7:49 pm

Re: First build - failed

Post by NewJoker »

wmayer wrote: Fri Aug 18, 2023 2:11 pm You should try to use the debug build of OCC.
Thanks for the reply. So I would have to build OCC too ? viewtopic.php?t=47017
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: First build - failed

Post by wmayer »

So I would have to build OCC too ?
No, the LibPack already includes a debug version of OCC. Unfortunately, the file names are equal to that of the release build which makes it impossible to have them in a common directory. As advised last time you should make a debug build of FreeCAD in a separate directory, copy the dlls of the bin directory of the LibPack to the bin sub-directory of the build directory and then copy over the OCC debug dlls of the bind directory.
User avatar
NewJoker
Veteran
Posts: 3089
Joined: Sun Oct 11, 2020 7:49 pm

Re: First build - failed

Post by NewJoker »

wmayer wrote: Fri Aug 18, 2023 6:04 pm As advised last time you should make a debug build of FreeCAD in a separate directory, copy the dlls of the bin directory of the LibPack to the bin sub-directory of the build directory and then copy over the OCC debug dlls of the bind directory.
So, assuming that I want to start from scratch, I have to:

1. Download (clone) the source code to FreeCAD_compiled\FreeCAD
2. Set that directory as "Where is the source code" in CMake, then set "Where to build the binaries" to FreeCAD_compiled\build
3. Run Configure, set the Libpack path as FREECAD_LIBPACK_DIR and set the install directory (CMAKE_INSTALL_PREFIX) to FreeCAD_compiled\install, run Configure again, run Generate
4. Open project in Visual Studio, set Debug here:

debug.png
debug.png (3.93 KiB) Viewed 677 times

5. Build ALL_BUILD
6. Copy all files from LibPack-0.21-V2.9\bin (or just the ones from LibPack-0.21-V2.9\bin\DLLs ?) to FreeCAD_compiled\build\bin
7. Copy all files from LibPack-0.21-V2.9\bind to FreeCAD_compiled\build\bin
8. Build INSTALL
9. Run FreeCAD from FreeCAD_compiled\install\bin\FreeCAD_d.exe

Is that correct or are there some steps missing here ? Do I also need a separate release build if I just want to test the newly merged features ?

Sorry if I messed it all up, I'm not familiar with this stuff and I just want to find the easiest reliable way to build FreeCAD from the source code (official or someone's fork).
Last edited by NewJoker on Sun Aug 20, 2023 7:17 pm, edited 1 time in total.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: First build - failed

Post by wmayer »

6. Copy all files from LibPack-0.21-V2.9\bin (or just the ones from LibPack-0.21-V2.9\bin\DLLs ?)
Copy all of them because under bin/DLLs there are only the Python 3rd party libs or extension modules.
Is that correct or are there some steps missing here ?
Yes, that should be correct.
Do I also need a separate release build if I just want to test the newly merged features ?
Very likely yes. But you could test if using the debug dlls of OCC works with a release build of FreeCAD.

At some point it's best to fix the LibPack issue by setting the appropriate CMake option of the OCC build to add the "d" suffix to the debug dlls and libs.
Post Reply