compile FreeCAD with nglib on debian jessie

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

compile FreeCAD with nglib on debian jessie

Post by bernd »

Just installed a virgin Debian Jessie on one off my machines. I tried to compile FreeCAD with nglig to be able to make FEM meshes inside FreeCAD. I used the commands provided by vejmarie here: https://gist.github.com/vejmarie/817f77 ... 3c24cf17be

vtk, occt, netgen all compiled and installed. But FreeCAD has problems to find nglibs. I had to specify them manually. I tried:

Code: Select all

-DNGLIB_LIBRARIES=/opt/netgen/lib/
but got a warning:

Code: Select all

- Configuring done
WARNING: Target "Driver" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "DriverDAT" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "DriverDAT" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "SMDS" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "DriverSTL" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "DriverSTL" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "DriverUNV" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "DriverUNV" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "SMESHDS" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "SMESHDS" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "MEFISTO2" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "NETGENPlugin" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "NETGENPlugin" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "SMESH" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "SMESH" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "StdMeshers" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "StdMeshers" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "MeshPart" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "MeshPartGui" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "Fem" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "FemGui" requests linking to directory "/opt/netgen/lib".  Targets may link only to libraries.  CMake is dropping the item.
-- Generating done
running make gives errors in linking. In that direcktory I have a couple of libs and do not know which one I should take?

Code: Select all

$ pwd
/opt/netgen/lib
$ ls
libcsg.la        libcsgvis.la        libgeom2d.la        libgeom2dvis.la        libinterface.la        libmesh.la        libnglib.la  libocc.so.0      liboccvis.so.0      libstl.so.0      libstlvis.so.0
libcsg.so        libcsgvis.so        libgeom2d.so        libgeom2dvis.so        libinterface.so        libmesh.so        libnglib.so  libocc.so.0.0.0  liboccvis.so.0.0.0  libstl.so.0.0.0  libstlvis.so.0.0.0
libcsg.so.0      libcsgvis.so.0      libgeom2d.so.0      libgeom2dvis.so.0      libinterface.so.0      libmesh.so.0      libocc.la    liboccvis.la     libstl.la           libstlvis.la
libcsg.so.0.0.0  libcsgvis.so.0.0.0  libgeom2d.so.0.0.0  libgeom2dvis.so.0.0.0  libinterface.so.0.0.0  libmesh.so.0.0.0  libocc.so    liboccvis.so     libstl.so           libstlvis.so
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: compile FreeCAD with nglib on debian jessie

Post by wmayer »

When looking at the FindNETGEN.cmake file I think it doesn't handle this correctly. On (older) Ubuntus the used netgen package only offers a single lib libnglib.so and for Linux the cmake file only expects this one. For OSX it already handles the split libraries. So, you could try to adjust the cmake file by copying over the part from the OSX check.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: compile FreeCAD with nglib on debian jessie

Post by bernd »

great, thanks werner for the hints. :D

On both debian jessie my new machine with the virgin one and the old one machine with the 4 years old jessie with thousands of packages it worked ...

Here are all the changes including some hacks with absolute path ... https://github.com/berndhahnebach/FreeC ... f9b37fd471
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: compile FreeCAD with nglib on debian jessie

Post by bernd »

FreeCAD works great here so far with nglib on Debian Jessie. A problem I stumbled today is make install. After make install I get the following error ...

in FreeCAD python console

Code: Select all

>>> import Fem
Traceback (most recent call last):
  File "<input>", line 1, in <module>
ImportError: libnglib.so: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden
>>> 

Code: Select all

$ locate libnglib.so
/home/hugo/Documents/dev/netgen/netgen-vejmarie/Netgen/netgen-5.3.1/nglib/.libs/libnglib.so
/home/hugo/Documents/dev/netgen/netgen-vejmarie/Netgen/netgen-5.3.1/nglib/.libs/libnglib.soT
/opt/netgen/lib/libnglib.so
/usr/share/netgen/netgen-5.3.1/nglib/.libs/libnglib.so
/usr/share/netgen/netgen-5.3.1/nglib/.libs/libnglib.soT
/usr/share/netgen/nglib/.libs/libnglib.so
/usr/share/netgen/nglib/.libs/libnglib.soT
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: compile FreeCAD with nglib on debian jessie

Post by wmayer »

As a workaround for now it should work to define LD_LIBRARY_PATH:

Code: Select all

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/netgen/lib
/home/hugo/Documents/dev/netgen/netgen-vejmarie/Netgen/netgen-5.3.1/nglib/.libs/libnglib.so
Who is hugo? .)
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: compile FreeCAD with nglib on debian jessie

Post by bernd »

wmayer wrote:As a workaround for now it should work to define LD_LIBRARY_PATH:

Code: Select all

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/netgen/lib
:D
wmayer wrote:
/home/hugo/Documents/dev/netgen/netgen-vejmarie/Netgen/netgen-5.3.1/nglib/.libs/libnglib.so
Who is hugo? .)
Me on my machine :D

Code: Select all

$ getent passwd hugo
hugo:x:1000:1000:Hugo Tuxobald,,,:/home/hugo:/bin/bash

Code: Select all

$ hostname
ahorn
I have a birke (it's a mac :lol: ), bonsai, weide, eiche, pappel (debian lenny and still runs as print server !), kirsche, esche, boa I can't remember them all at the moment ...

ahh:

Code: Select all

$ dnsdomainname
wald  
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: compile FreeCAD with nglib on debian jessie

Post by wmayer »

LOL. I see, you like botanic names.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: compile FreeCAD with nglib on debian jessie

Post by saso »

would this work also to get netgen back in to win builds? :|
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: compile FreeCAD with nglib on debian jessie

Post by wmayer »

Now the FindNetgen macro now supports if the library is split into several libraries. In order to let cmake find your library under /opt/netgen you must create inside cmake the key NETGEN_LIBDIR (of type PATH) and set its value to /opt/netgen.

When running the first time you have to check that it takes the libs of the same directory. If e.g. you have installed an older netgen version it may use the libnglib.so library under /usr/lib
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: compile FreeCAD with nglib on debian jessie

Post by bernd »

wow much better, cmake runs smooth but on make I get problems ... On FreeCAD master at commit 8390 I run cmake with:

Code: Select all

cmake ../freecad                        \
-DBUILD_FEM_NETGEN=1                    \
-DCMAKE_CXX_FLAGS="-DNETGEN_V5"         \
-DNETGEN_LIBDIR=/opt/netgen/lib         \
-DNETGEN_INCLUDEDIR=/opt/netgen/include
I get an error during make at:

Code: Select all

...
[ 76%] Generating ../../../../Mod/Fem/test_files/ccx/spine_thermomech.dat
[ 76%] Generating ../../../../Mod/Fem/test_files/ccx/spine_thermomech.frd
[ 76%] Generating ../../../../Mod/Fem/test_files/ccx/spine_thermomech_expected_values
Scanning dependencies of target Fem
[ 76%] Building CXX object src/Mod/Fem/App/CMakeFiles/Fem.dir/FemMeshObject.cpp.o
[ 76%] Building CXX object src/Mod/Fem/App/CMakeFiles/Fem.dir/FemMeshShapeObject.cpp.o
[ 76%] Building CXX object src/Mod/Fem/App/CMakeFiles/Fem.dir/FemMeshShapeNetgenObject.cpp.o
In file included from /home/hugo/Documents/dev/freecad/freecadbhb_master/freecad/src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp:45:0:
/home/hugo/Documents/dev/freecad/freecadbhb_master/freecad/src/3rdParty/salomesmesh/inc/NETGENPlugin_Mesher.hxx:40:19: fatal error: nglib.h: Datei oder Verzeichnis nicht gefunden
 #include <nglib.h>
                   ^
compilation terminated.
src/Mod/Fem/App/CMakeFiles/Fem.dir/build.make:493: recipe for target 'src/Mod/Fem/App/CMakeFiles/Fem.dir/FemMeshShapeNetgenObject.cpp.o' failed
make[2]: *** [src/Mod/Fem/App/CMakeFiles/Fem.dir/FemMeshShapeNetgenObject.cpp.o] Error 1
CMakeFiles/Makefile2:3567: recipe for target 'src/Mod/Fem/App/CMakeFiles/Fem.dir/all' failed
make[1]: *** [src/Mod/Fem/App/CMakeFiles/Fem.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
hugo@ahorn:~/Documents/dev/freecad/freecadbhb_master/build$ 
I can get around this by editing the file src/3rdParty/salomesmesh/inc/NETGENPlugin_Mesher.hxx https://github.com/berndhahnebach/FreeC ... ac23430cc9 but it should work without this ...
Post Reply