need a helping hand to setup fem on debian jessie

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
django013
Posts: 106
Joined: Tue Jan 13, 2015 7:51 am

Re: need a helping hand to setup fem on debian jessie

Post by django013 »

Hi Bernd,

thank you very much for your reply!
FreeCAD latest git from github compiled without netgen
Ok, I'll try again without netgen :O
I need to read all that stuff here since I do not have netgen inside FreeCAD but I'm interested to have ...
Well, to me it looks like netgen uses the most recent c++ standard, whereas fc does not ...
So we either need an older version of netgen, or fc has to advance c++ standard ?!?
OS: Linux Debian Jessie amd64 - FC: Git Master
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: need a helping hand to setup fem on debian jessie

Post by bernd »

PrzemoF wrote:
bernd wrote:[..]I need to read all that stuff here since I do not have netgen inside FreeCAD but I'm interested to have ...
That might give you a hint how I did it on fedora: viewtopic.php?f=17&t=11713
Yeah I allready saw that one, thanks. I need to find a minute to get this netgen working on my debian machine. It is comfortable just to use gmsh.

Since ubuntu ppa has calculix and netgen the epic thread for ubuntu ppa may give some informations too. viewtopic.php?f=18&t=10393&start=10#p83726
django013
Posts: 106
Joined: Tue Jan 13, 2015 7:51 am

Re: need a helping hand to setup fem on debian jessie

Post by django013 »

Hello,

little happy update :)

FC builds fine with netgen 6.1 from sf.net repo.
Only need to set CMAKE_CXX_FLAGS to -std=c++11
I did it with cmake-gui and CMAKE_CXX_FLAGS was empty before.

I changed FindNETGEN.cmake like this:

Code: Select all

# Try to find nglib/netgen
# Once done this will define
#
# NGLIB_INCLUDE_DIR   - where the nglib include directory can be found
# NGLIB_LIBRARIES     - Link this to use nglib
# NETGEN_INCLUDE_DIRS - where the netgen include directories can be found
#
# See also: http://git.salome-platform.org/gitweb/?p=NETGENPLUGIN_SRC.git;a=summary

if(NOT NETGENDATA)
    SET(NETGENDATA /usr/local/src/netgen-mesher)
endif()
if(NOT NETGEN_LS)
    SET(NETGEN_LS /usr/local/src/netgen-mesher/libsrc)
endif()

# nglib
FIND_PATH(NGLIB_INCLUDE_DIR nglib.h ${NETGENDATA}/nglib)
FIND_LIBRARY(NGLIB_LIBRARIES nglib  /opt/netgen/lib)

# netgen headers
SET(NETGEN_INCLUDE_DIRS ${NETGEN_LS}/include)
SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} -DNO_PARALLEL_THREADS -DOCCGEOMETRY)

add_definitions(-DNETGEN_V5)

FIND_PATH(NETGEN_DIR_csg csg.hpp PATHS ${NETGEN_LS}/csg)
FIND_PATH(NETGEN_DIR_gen array.hpp PATHS ${NETGEN_LS}/general)
FIND_PATH(NETGEN_DIR_geom2d geom2dmesh.hpp PATHS ${NETGEN_LS}/geom2d)
FIND_PATH(NETGEN_DIR_gprim gprim.hpp PATHS ${NETGEN_LS}/gprim)
FIND_PATH(NETGEN_DIR_la linalg.hpp PATHS ${NETGEN_LS}/linalg)
FIND_PATH(NETGEN_DIR_mesh meshing.hpp PATHS ${NETGEN_LS}/meshing)
FIND_PATH(NETGEN_DIR_occ occgeom.hpp PATHS ${NETGEN_LS}/occ)
FIND_PATH(NETGEN_DIR_stlgeom stlgeom.hpp PATHS ${NETGEN_LS}/stlgeom)

SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} ${NETGEN_DIR_csg})
SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} ${NETGEN_DIR_gen})
SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} ${NETGEN_DIR_geom2d})
SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} ${NETGEN_DIR_gprim})
SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} ${NETGEN_DIR_la})
SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} ${NETGEN_DIR_mesh})
SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} ${NETGEN_DIR_occ})
SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} ${NETGEN_DIR_stlgeom})
BUILD_FEM and BUILD_FEM_NETGEN have both been enabled.
NGLIB_LIBRARIES is set to /opt/netgen/lib/libnglib.so

but starting fc and switching to fem vomits the error: libnglib.so - can not open file :(

so I created a softlink

Code: Select all

ln -s /opt/netgen/lib/libnglib.so /usr/lib
and now at starting fc and switching to fem the errormessage is

Code: Select all

/usr/local/lib/libNETGENPlugin.so: undefined symbol: _ZN6netgen6mparamE
I'm trapped :(
OS: Linux Debian Jessie amd64 - FC: Git Master
midgetfc
Posts: 60
Joined: Fri May 15, 2009 2:50 pm

Re: need a helping hand to setup fem on debian jessie

Post by midgetfc »

Hello,
I'm also trying to compile FreeCAD with netgen 6.1 from sourceforge/git on Jessie.
The symbol _ZN6netgen6mparamE is not defined in libNETGENPlugin.so because it is not defined in libnglib.so
It is a global variable (netgen::mparam) defined in the netgen file libsrc/interface/nginterface.cpp, and the symbol is correctly defined in libinterface.so
libinterface.so should be a dependancy of libnglib.so. Unfortunately, netgen author changed the way he expressed libraries dependancies, from the cmake classical TARGET_LINK_LIBRARIES to experiments with cmake TARGET_OBJECTS, and this rework is still under way, as can be seen in nglib/CMakeLists.txt (see commented lines). It seems to be OK for windows, and not completely set-up for unix.
If I can get it solved, I'll let you know.
Hope this helps a little.
Cheers
Midgetfc
django013
Posts: 106
Joined: Tue Jan 13, 2015 7:51 am

Re: need a helping hand to setup fem on debian jessie

Post by django013 »

Hi,

thanks a lot for that hint.

I tried to toggle the comment of both statements (add_library and target_link_library) - don't know, whether the result is better.
Currently I try to mesh a step-flie with netgen-gui - after 3 hrs surface meshing is at 13% and the last single percent took about an hour :(

FC compiled with netgen support now throws this error (at switching to fem wb):

Code: Select all

The error message is: /usr/local/lib/libNETGENPlugin.so: undefined symbol: _ZN5nglib10Ng_NewMeshEv
When I drop an unv-file created by gmsh on FC fc crashes with these errors:

Code: Select all

Err: Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: /usr/local/lib/libNETGENPlugin.so: undefined symbol: _ZN5nglib10Ng_NewMeshEv
Log: The event type 63 was sent to QGLWidget
Object tree:
	QGLWidget is child of
	SIM::Coin3D::Quarter::QuarterWidget is child of
	QStackedWidget is child of
	Gui::View3DInventor is child of
	QMdiSubWindow is child of
	QWidget is child of
	QMdiArea is child of
	Gui::MainWindowLog: Active view is Unbenannt : 1[*] (at 0x407faf0)
Log: Sel : Clear selection
Err: *** Abort *** an exception was raised, but no catch was found.Err: 
Err: 	... The exception is:Err: SIGSEGV 'segmentation violation' detected. Address 192e36Err: 
so next I try to extend the target_link_libraries until no undefined symbols arise :O
OS: Linux Debian Jessie amd64 - FC: Git Master
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: need a helping hand to setup fem on debian jessie

Post by ulrich1a »

Building FreeCAD with netgen on Debian Jessie is doable.
You need to follow the Debian way and download the Debian-Source-Package for netgen_4.9.13.dfsg-8
You will get all the patches needed at Debian, to make it compiling. Read the debian documentation how to apply the patches.
Netgen itself does not work on debian Jessie, at least with graphic output. But this is not a problem, as FreeCAD only need the library from it.

I did not make a Debian-package from it, but compiled and installed it in /usr/local.
I compiled netgen with:

Code: Select all

./configure --disable-gui --prefix=/usr/local --enable-occ --with-occ=/usr/local
Adapt the configure line to your install paths.

configure FreeCAD with cmake-gui

Code: Select all

//Path to a file.
NETGEN_DIR_csg:PATH=/home/ulrich/Sourcen/netgen_debian/netgen-4.9.13.dfsg/libsrc/include

//Path to a file.
NETGEN_DIR_gen:PATH=/home/ulrich/Sourcen/netgen_debian/netgen-4.9.13.dfsg/libsrc/include

//Path to a file.
NETGEN_DIR_geom2d:PATH=/home/ulrich/Sourcen/netgen_debian/netgen-4.9.13.dfsg/libsrc/include

//Path to a file.
NETGEN_DIR_gprim:PATH=/home/ulrich/Sourcen/netgen_debian/netgen-4.9.13.dfsg/libsrc/include

//Path to a file.
NETGEN_DIR_la:PATH=/home/ulrich/Sourcen/netgen_debian/netgen-4.9.13.dfsg/libsrc/include

//Path to a file.
NETGEN_DIR_mesh:PATH=/home/ulrich/Sourcen/netgen_debian/netgen-4.9.13.dfsg/libsrc/include

//Path to a file.
NETGEN_DIR_occ:PATH=/home/ulrich/Sourcen/netgen_debian/netgen-4.9.13.dfsg/libsrc/include

//Path to a file.
NETGEN_DIR_stlgeom:PATH=/home/ulrich/Sourcen/netgen_debian/netgen-4.9.13.dfsg/libsrc/include

//Path to a file.
NGLIB_INCLUDE_DIR:PATH=/usr/local/include

Ulrich
django013
Posts: 106
Joined: Tue Jan 13, 2015 7:51 am

Re: need a helping hand to setup fem on debian jessie

Post by django013 »

Netgen itself does not work on debian Jessie, at least with graphic output.
Well, the executable from latest sf.net snapshot does work. Gui comes up and I can load a step-file and start meshing ...
Loading a stl-file will crash, but IGES and STEP seems to work.
OK, I did not wait for meshing to finish - I aborted after several hours of runtime.
May be the default settings of netgen are to costy - don't know.
... but hey - seems to work - after all :)
Building FreeCAD with netgen on Debian Jessie is doable.
You need to follow the Debian way
Ok, I'lll take a look at the patches. May be I understand, what needs to be done.

To mee, it looks, like the publishing of the namespace objects used in shared objects does not work, or at least is not consistent :O
OS: Linux Debian Jessie amd64 - FC: Git Master
gbrugnoni
Posts: 3
Joined: Mon Nov 30, 2015 8:13 am
Location: Italy
Contact:

Re: need a helping hand to setup fem on debian jessie

Post by gbrugnoni »

Hi,
I've followed this task trying to fix the mparam problem, that driven me crazy for days.
Finally I've found that the error doesn't depend on netgen version.
I've tried to fix the problem by using netgen-4.9.1, but mparam error was always present.
After some hours of troubles, I've found that freecad executable was completely ignoring the library module libnglib.so.
My mistake was in the NGLIB_LIBRARIES flag of freecad configuration. This flag must be used to indicate the library file, not the library path.


Those are the steps i've succesfully used to build FreeCAD with working FEM module in debian wheezy:

Opencascade configuration, version 6.5.5

Code: Select all

$ cd ros
$ ./build_configure
$ ./configure --prefix=/opt/occt-6.5.5 --with-tcl=/usr/lib --with-tk=/usr/lib --with-freetype=/usr --with-ftgl=/usr --with-gl2ps=/usr --with-freeimage=/usr/ --with-tbb-include=/usr/include/tbb --with-tbb-library=/usr/lib/
$ make -j 8
$ sudo make install
NETGEN Configuration, version 5.3.1

Code: Select all

$ ./configure --enable-nglib --disable-gui --enable-occ --with-occ=/opt/occt-6.5.5 --prefix=/opt/netgen-5.3.1
The file "libsrc/occ/Partition_Loop2d.cxx" must be patched with this little modification: at line 20, add the following line:

Code: Select all

#define PI  M_PI
After this modification the build procedure should run without problems:

Code: Select all

$ make -j 8
$ sudo make install
FreeCAD configuration:

Code: Select all

$ cmake -DFREECAD_USE_EXTERNAL_PIVY=1 \
-DCMAKE_BUILD_TYPE=Debug \
-DPYTHON_LIBRARY=/usr/lib/libpython2.7.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python2.7 \
-DBUILD_FEM_NETGEN=1 \
-DNGLIB_INCLUDE_DIR=/opt/netgen-5.3.1/include \
-DNGLIB_LIBRARIES:FILEPATH=/opt/netgen-5.3.1/lib/libnglib.so \
-DNETGENDATA=/home/user/local/build/netgen/netgen-5.3.1/libsrc \
-DCMAKE_CXX_FLAGS=-DNETGEN_V5 \
-DBUILD_ASSEMBLY=1 \
-DOCC_INCLUDE_DIR=/opt/occt-6.5.5/inc/ \
-DOCC_LIBRARY_DIR=/opt/occt-6.5.5/lib/ \
../src/free-cad-code/

$ make -j 8
$ sudo make install
That's all!
Post Reply