question about the BUILD_FEM_NETGEN CMake option

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Post Reply
User avatar
uwestoehr
Veteran
Posts: 4318
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

question about the BUILD_FEM_NETGEN CMake option

Post by uwestoehr »

Is there a way to build FC without Netgen? Of course this is no option for the release but I wanted to perform some tests.
To do so I unchecked the CMake option
BUILD_FEM_NETGEN

But The resultg FC fails then to load any major Workbench. E.g. on switching to the Part WB I get this info:

Code: Select all

18:52:21  DLL load failed while importing PartGui: Das angegebene Modul wurde nicht gefunden.
18:52:21  Traceback (most recent call last):
  File "<string>", line 43, in Initialize
  File "D:\FreeCAD-build\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
Unfortunately I get no info what DLL is missing. I can only assume it is the missing NetGen.

I want to document this and I am unsure what is correct. Toe me just unchecking BUILD_FEM_NETGEN does not work. So is the intention of the BUILD_FEM_NETGEN option to first compile it with the option, then, when you have the NetgenPlugin DLL to uncheck to get a build where only the FEM WB has no NetGen support?
adrianinsaval
Veteran
Posts: 3179
Joined: Thu Apr 05, 2018 5:15 pm

Re: question about the BUILD_FEM_NETGEN CMake option

Post by adrianinsaval »

AFAIK the archlinux packages don't have netgen support, there isn't even a netgen package in arch, stable package compilation script doesn't pass any build flags, I assume it's skipped when netgen isn't found? The AUR package passes the -D BUILD_FEM_NETGEN=OFF flag and seems to work without issues. How do i check if I have netgen functionality?

Edit: ok in the appimage I see a FEM_MeshNetgenFromShape command and that command isn't present in the AUR package, just the gmsh one so I think the build flag works. Could be a windows issue or something specific to your setup or something not related to netgen at all.

PS: were can I find build instructions for netgen? I'm interested in adding it to the AUR
User avatar
uwestoehr
Veteran
Posts: 4318
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: question about the BUILD_FEM_NETGEN CMake option

Post by uwestoehr »

adrianinsaval wrote: Mon May 23, 2022 1:03 am PS: were can I find build instructions for netgen? I'm interested in adding it to the AUR
here they are: https://wiki.freecadweb.org/Compile_on_ ... ing_Netgen

Note however, that I am still struggling to get a debug build- Therefore I might have to change the description.
wmayer
Founder
Posts: 18817
Joined: Thu Feb 19, 2009 10:32 am

Re: question about the BUILD_FEM_NETGEN CMake option

Post by wmayer »

18:52:21 DLL load failed while importing PartGui: Das angegebene Modul wurde nicht gefunden.
PartGui doesn't depend on whether Netgen is used for the build or not. So, the reason must be something else. Are you sure you have copied all 3rd party DLLs into the bin folder of the build directory?
User avatar
uwestoehr
Veteran
Posts: 4318
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: question about the BUILD_FEM_NETGEN CMake option

Post by uwestoehr »

wmayer wrote: Mon May 23, 2022 10:06 am
18:52:21 DLL load failed while importing PartGui: Das angegebene Modul wurde nicht gefunden.
PartGui doesn't depend on whether Netgen is used for the build or not. So, the reason must be something else. Are you sure you have copied all 3rd party DLLs into the bin folder of the build directory?
Yes, I assured this. The point is that the Netgen plugin fails to build since we first need o adapt our code for the new Netgen version. I thought I could make FC run also without the Netgen plugin and thought this can be achieved with the BUILD_FEM_NETGEN CMake.

To see what I mean, take a ready LibPack with which the Netgen plugin compiled. Then purposely change our code that the Netgen plugin won't compile, then unset the BUILD_FEM_NETGEN CMake option and build FC.
wmayer
Founder
Posts: 18817
Joined: Thu Feb 19, 2009 10:32 am

Re: question about the BUILD_FEM_NETGEN CMake option

Post by wmayer »

FC run also without the Netgen plugin and thought this can be achieved with the BUILD_FEM_NETGEN CMake.
Yes, this is how it supposed to work. But the state of BUILD_FEM_NETGEN has no impact on PartGui.
To see what I mean, take a ready LibPack with which the Netgen plugin compiled. Then purposely change our code that the Netgen plugin won't compile, then unset the BUILD_FEM_NETGEN CMake option and build FC.
Will try that...
User avatar
uwestoehr
Veteran
Posts: 4318
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: question about the BUILD_FEM_NETGEN CMake option

Post by uwestoehr »

OK, the issue is not the BUILD_FEM_NETGEN CMake option but the missing DLLs from the new LibPack test release:
https://github.com/FreeCAD/FreeCAD-LibP ... es/tag/2.3

The problem is that the OCC files are no longer in the subfolder /bin bit under the subfolder /win64 and when compiling the INSTALL target, they are not copied to the appropriate folder - they are not copied at all.
wmayer
Founder
Posts: 18817
Joined: Thu Feb 19, 2009 10:32 am

Re: question about the BUILD_FEM_NETGEN CMake option

Post by wmayer »

uwestoehr wrote: Tue May 24, 2022 2:59 am The problem is that the OCC files are no longer in the subfolder /bin bit under the subfolder /win64 and when compiling the INSTALL target, they are not copied to the appropriate folder - they are not copied at all.
Either you have to copy all these DLLs into the top bin directory or if you want to avoid this extra copy then move the files but adjust the OCC .cmake files to find the required DLLs in the new directory.

On my Windows builds I actually never copy the DLLs of the LibPack to the FreeCAD build directory but instead set the PATH environment variable. Now with Py3.8 the interpreter doesn't consider the PATH environment any more but search paths must be explicitly added with os.add_dll_directory. In order to keep this workflow the environment variable FREECAD_LIBPACK_BIN must be set but I can only add one directory and having the OCC DLLs in the win64 sub-folder the Python interpreter will fail to load them.
User avatar
uwestoehr
Veteran
Posts: 4318
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: question about the BUILD_FEM_NETGEN CMake option

Post by uwestoehr »

wmayer wrote: Tue May 24, 2022 6:16 am Either you have to copy all these DLLs into the top bin directory or if you want to avoid this extra copy then move the files but adjust the OCC .cmake files to find the required DLLs in the new directory.
Just to understand:
In the my Libpack the .cmake files contain already the path to the DLLs. Therefore configuring CMake for FC works.
When I change now the .cmake files of FC the result will be that when I compile the INSTALL target, the DLLs are copied to the INSTALL folder, but:
- won't this affect all build systems, I mean also builds for Conda and the like?
- will the Python interpreter find them in these folders?
wmayer wrote: Tue May 24, 2022 6:16 am the environment variable FREECAD_LIBPACK_BIN must be set but I can only add one directory and having the OCC DLLs in the win64 sub-folder the Python interpreter will fail to load them.
My aim is to have a clean INSTALL folder that is automatically filled with all necessary DLLs, PYDs etc. Then I set this path as input for the NSIS installer script and have an installer I can publish.
Post Reply