[Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: [Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Post by triplus »

Didn't test it yet but just wanted to say thanks.

In the lines of the established culture of crediting in FreeCAD community thanks especially to you @gdo35. As without your help it wouldn't have happened.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Post by NormandC »

NormandC wrote:Interestingly, I found on the Debian git repository for the netgen package a debian/5.1.dfsg tag for building a netgen 5.1 package. It dates back 3 years ago. Why the heck haven't they completed the work?

I'll try to see if it can be of use with 5.3.1.

https://anonscm.debian.org/cgit/debian- ... n/5.1.dfsg
Link isn't working tonight. Their whole Git system appears to be down. :?

EDIT: ok they're back. Now too late to do anything...
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Post by NormandC »

@ blacey I'm in need of help on netgen again :?

EDIT: see my reply below, it seems to require patching, I'll try that tomorrow...
blacey wrote:For those not on Gitter, you can apply netgen nglib patch set for OCCT 7.x as follows:

Code: Select all

tar xvzf netgen-5.3.1.tar.gz
cd netgen-5.3.1
curl -L https://github.com/FreeCAD/homebrew-freecad/releases/download/0/nglib-occt7.patch | patch -p1
Done, now I try to compile it against my libopencascade debian packages. The development files are in /usr/include/opencascade/, while the libs (*.so*) are in /usr/lib/x86_64-linux-gnu/.

In his compilation script, bernd does this:

Code: Select all

./configure --prefix=/opt/local/FreeCAD-0.17 --with-tcl=/usr/lib/tcl8.5 --with-tk=/usr/lib/tk8.5 --enable-occ --with-occ=/opt/local/FreeCAD-0.17 --enable-shared --enable-nglib CXXFLAGS="-DNGLIB_EXPORTS -std=gnu++11"
Here's one of the things I tried:

Code: Select all

./configure --with-tcl=/usr/lib/tcl8.5 --with-tk=/usr/lib/tk8.5 --enable-occ --with-occ=/usr/lib/x86_64-linux-gnu --enable-shared --enable-nglib CXXFLAGS="-DNGLIB_EXPORTS -std=gnu++11"
But the occ path doesn't look right.

Code: Select all

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for g++ option to support OpenMP... -fopenmp
checking for ar... ar
checking the archiver (ar) interface... ar
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking iostream usability... yes
checking iostream presence... yes
checking for iostream... yes
checking iostream.h usability... no
checking iostream.h presence... no
checking for iostream.h... no
checking limits usability... yes
checking limits presence... yes
checking for limits... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking iomanip usability... yes
checking iomanip presence... yes
checking for iomanip... yes
checking iomanip.h usability... no
checking iomanip.h presence... no
checking for iomanip.h... no
OCCFLAGS = -DOCCGEOMETRY -I/usr/lib/x86_64-linux-gnu/inc -I/usr/lib/x86_64-linux-gnu/include -D_OCC64 -DHAVE_IOSTREAM -DHAVE_LIMITS -DHAVE_LIMITS_H -DHAVE_IOMANIP
OCCLIBS = -L/usr/lib/x86_64-linux-gnu/lib
checking for correct TEA configuration... ok (TEA 3.9)
configure: configuring netgen 5.3.1
checking for Tcl configuration... found /usr/lib/tcl8.5/tclConfig.sh
checking for existence of /usr/lib/tcl8.5/tclConfig.sh... loading
checking for Tk configuration... found /usr/lib/tk8.5/tkConfig.sh
checking for existence of /usr/lib/tk8.5/tkConfig.sh... loading
checking for Tcl public headers... /usr/include/tcl8.5
checking for Tk public headers... /usr/include/tcl8.5
checking GL/gl.h usability... yes
checking GL/gl.h presence... yes
checking for GL/gl.h... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libsrc/Makefile
config.status: creating libsrc/csg/Makefile
config.status: creating libsrc/general/Makefile
config.status: creating libsrc/geom2d/Makefile
config.status: creating libsrc/gprim/Makefile
config.status: creating libsrc/include/Makefile
config.status: creating libsrc/interface/Makefile
config.status: creating libsrc/linalg/Makefile
config.status: creating libsrc/meshing/Makefile
config.status: creating libsrc/occ/Makefile
config.status: creating libsrc/stlgeom/Makefile
config.status: creating libsrc/visualization/Makefile
config.status: creating ng/Makefile
config.status: creating nglib/Makefile
config.status: creating tutorials/Makefile
config.status: creating doc/Makefile
config.status: creating windows/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

------------------------------------------------------------------------
  netgen 5.3.1:  Automatic configuration OK.

  Enabled functionality:

    OCC: ............... true
    JPEGlib: ........... false
    FFMPEG: ............ false
    NGLIB: ............. true
    GUI: ............... true


  Building:

    Type 'make' to compile netgen.

    Type 'make install' to install netgen.

  Example programs will be built but not installed.
------------------------------------------------------------------------
I also tried --with-occ=/usr and I get the same result.

When doing make I get

Code: Select all

Making all in occ
make[3] : on entre dans le répertoire « /home/normand/compilation/netgen/netgen-5.3.1-patched/libsrc/occ »
/bin/bash ../../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I../../libsrc/include  -DOCCGEOMETRY -I/usr/lib/x86_64-linux-gnu/inc -I/usr/lib/x86_64-linux-gnu/include -D_OCC64 -DHAVE_IOSTREAM -DHAVE_LIMITS -DHAVE_LIMITS_H -DHAVE_IOMANIP -I"/usr/include/tcl8.5"   -DNGLIB_EXPORTS -std=gnu++11 -fopenmp -MT Partition_Inter2d.lo -MD -MP -MF .deps/Partition_Inter2d.Tpo -c -o Partition_Inter2d.lo Partition_Inter2d.cxx
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I../../libsrc/include -DOCCGEOMETRY -I/usr/lib/x86_64-linux-gnu/inc -I/usr/lib/x86_64-linux-gnu/include -D_OCC64 -DHAVE_IOSTREAM -DHAVE_LIMITS -DHAVE_LIMITS_H -DHAVE_IOMANIP -I/usr/include/tcl8.5 -DNGLIB_EXPORTS -std=gnu++11 -fopenmp -MT Partition_Inter2d.lo -MD -MP -MF .deps/Partition_Inter2d.Tpo -c Partition_Inter2d.cxx  -fPIC -DPIC -o .libs/Partition_Inter2d.o
In file included from Partition_Inter2d.ixx:28:0,
                 from Partition_Inter2d.cxx:33:
Partition_Inter2d.jxx:31:30: fatal error: BRepAlgo_AsDes.hxx: No such file or directory
compilation terminated.
Maybe this is the problem?

Code: Select all

checking build system type... x86_64-unknown-linux-gnu
Any pointers would be appreciated.

Thanks!
Last edited by NormandC on Fri Mar 10, 2017 5:20 am, edited 1 time in total.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Post by NormandC »

Just had a look at the debian packaging of netgen-4.9.13, it requires a patch to solve the occ-dir issue. Seems like this is still the case with 5.3.1.

configure-occ.patch

Code: Select all

Change OCC include directory and the Togl lib name to Debian's.

Index: netgen/configure.ac
===================================================================
--- netgen.orig/configure.ac
+++ netgen/configure.ac
@@ -44,7 +44,7 @@
 
 if test a$occon = atrue ; then
 
-	AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/inc"])
+	AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/include/oce"])
 	AC_SUBST([OCCLIBS], ["-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"])
 
 #  -lTKDCAF
Index: netgen/ng/Makefile.am
===================================================================
--- netgen.orig/ng/Makefile.am
+++ netgen/ng/Makefile.am
@@ -16,7 +16,7 @@
 	$(top_builddir)/libsrc/gprim/libgprim.la \
 	$(top_builddir)/libsrc/linalg/libla.la \
 	$(top_builddir)/libsrc/general/libgen.la \
-	$(OCCLIBS) -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl1.7 $(LIBGLU) $(TK_LIB_SPEC) $(TCL_LIB_SPEC) $(MPI_LIBS) $(FFMPEG_LIBS) $(JPEGLIB_LIBS) $(PKG_LIBS) 
+	$(OCCLIBS) -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl $(LIBGLU) $(TK_LIB_SPEC) $(TCL_LIB_SPEC) $(MPI_LIBS) $(FFMPEG_LIBS) $(JPEGLIB_LIBS) $(PKG_LIBS) 
 
 # add for static linkage of ngsolve:
 #   /opt/netgen/lib/libngsolve.a /opt/netgen/lib/libngcomp.a /opt/netgen/lib/libngcomp.a  /opt/netgen/lib/libngfemng.a   /opt/netgen/lib/libngmg.a  /opt/netgen/lib/libngla.a  /opt/netgen/lib/libngbla.a  /opt/netgen/lib/libngstd.a -L/opt/intel/mkl/10.2.1.017/lib/em64t /opt/intel/mkl/10.2.1.017/lib/em64t/libmkl_solver_lp64.a  -lmkl_intel_lp64  -lmkl_gnu_thread -lmkl_core
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: [Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Post by blacey »

NormandC wrote:I'm in need of help on netgen again :?

EDIT: see my reply below, it seems to require patching, I'll try that tomorrow...

Any pointers would be appreciated.

Thanks!
Happy to give it a go...

1) First, make is failing to find the OpenCascade include file BRepAlgo_AsDes.hxx. The author hardwired the include paths in the configure.ac/configure script so the nglib formula on macOS mutates the configure script because the include files are not installed into one of the author's hardwire paths. It seems you need to do the same on Linux. Perform a find to locate the header file to determine the proper include prefix.

Code: Select all

find /usr -name BRepAlgo_AsDes.hxx
It should find the include file somewhere under /usr. If find is unable to locate BRepAlgo_AsDes.hxx then you will need to double-check that the opencascade package installs all the header files. Record the full prefix for the include file BRepAlgo_AsDes.hxx...

2) Below is the section of the netgen configure script that you will want to examine and possibly change:

Code: Select all

if test a$occon = atrue ; then

        OCCFLAGS="-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"

        OCCLIBS="-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"
If step 1 reveals /usr/include/opencascade is the full prefix for BRepAlgo_AsDes.hxx, then you should be able to build netgen using --with-occ=/usr/lib/x86_64-linux-gnu because the author hardwired /usr/include/opencascade as one of the include paths and it will set occ-dir to /usr/lib/x86_64/lib. I doubt that is the case though because it failed to find BRepAlgo_AsDes.hxx. So just add "-I/usr/<full_include_prefix_from_step_1>" to the OCCFLAGS line in configure and run configure again.

3) Once you have a working configure script, you can use something like sed to edit the configure script before running configure or create a patch file for the configure and apply it before running configure.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Post by NormandC »

Thanks Bruce.

Code: Select all

find /usr -name BRepAlgo_AsDes.hxx
/usr/include/opencascade/BRepAlgo_AsDes.hxx
blacey wrote:Below is the section of the netgen configure script that you will want to examine and possibly change:
But it's not the same content after applying your patch, re:
blacey wrote:For those not on Gitter, you can apply netgen nglib patch set for OCCT 7.x as follows:
Which I applied:

Code: Select all

if test a$occon = atrue ; then
 
-	OCCFLAGS="-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"
+	OCCFLAGS="-DOCCGEOMETRY -I$occdir/inc -I$occdir/include"
 
-	OCCLIBS="-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"
+	OCCLIBS="-L$occdir/lib"
So I need to go back to the original unpatched configure file at least for that section because it's an undesirable change on Ubuntu.

Thanks.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: [Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Post by bejant »

I noticed yesterday:

OS: Ubuntu 16.04.2 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.17.10452 (Git)
Build type: None
Branch: master
Hash: 0196d50c487a6937bbcca5aeb13df32a652907db
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0

Thank you!
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: [Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Post by blacey »

NormandC wrote:Thanks Bruce.

Code: Select all

find /usr -name BRepAlgo_AsDes.hxx
/usr/include/opencascade/BRepAlgo_AsDes.hxx
blacey wrote:Below is the section of the netgen configure script that you will want to examine and possibly change:
But it's not the same content after applying your patch, re:
Ah, sorry about that. I have regenerated and re-uploaded the patch set for you but this time without patching configure. Give it a shot and let me know how it goes.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Post by NormandC »

No problem, thanks for updating the patch, I'll try it over the weekend.

@ HoWil and bejant
Glad you find it useful, I'm happy that the PPA is now on par with OS X and Win regarding OCC, now I hope we can update netgen and vtk.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Ubuntu Daily PPA] Transitioning to OCCT7, VTK7...

Post by NormandC »

Compiling netgen is proving a pain... :?

I had to make a change in the configure file:

Code: Select all

if test a$occon = atrue ; then

        OCCFLAGS="-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"

        OCCLIBS="-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"
The last library referenced, "FWOSPlugin", was removed from Open CASCADE 7.0.0. bernd hasn't removed it from his patched netgen repo, I'm surprised it manages to compile!

So after this slight change it seems to build fine with make, but afterwards the make install step is where I trip. Actually I don't want to do make install because I have no idea if I'll be able to remove it afterwards. So I used checkinstall instead, because it creates a basic .deb package I can easily uninstall.

But no matter what I do, it does not install all the required files. When I try to configure FreeCAD with BUILD_FEM_NETGEN enabled, I get bunches of errors about missing files. I also have to manually set a lot of paths for netgen which is pain, because I'm not even sure these paths are correct.
FC_compiling_FreeCAD_with_netgen_01.png
FC_compiling_FreeCAD_with_netgen_01.png (194.16 KiB) Viewed 2118 times
After configure...
VTK components: vtkCommonCore;vtkCommonDataModel;vtkFiltersVerdict;vtkIOXML;vtkFiltersCore;vtkFiltersGeneral;vtkIOLegacy;vtkFiltersExtraction;vtkFiltersSources;vtkFiltersGeometry;vtkIOMPIParallel;vtkParallelMPI;vtkhdf5
Check for medfile (libmed and libmedc) ...
CMake Error at cMake/FindNETGEN.cmake:107 (file):
file STRINGS file "/opt/netgen/include/mydefs.hpp" cannot be read.
Call Stack (most recent call first):
CMakeLists.txt:674 (find_package)


CMake Error at cMake/FindNETGEN.cmake:110 (string):
string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
command.
Call Stack (most recent call first):
CMakeLists.txt:674 (find_package)


CMake Error at cMake/FindNETGEN.cmake:131 (MATH):
math cannot parse the expression: "(NOTFOUND << 16) + (0 << 8)": syntax
error, unexpected exp_SHIFTLEFT, expecting exp_OPENPARENT or exp_NUMBER
(12)
Call Stack (most recent call first):
CMakeLists.txt:674 (find_package)



Found NETGEN version NOTFOUND.0, calculated:
Checking for module 'Coin'
No package 'Coin' found
Or do I actually need to upgrade MED and VTK for netgen 5.3.1 to work?

I need to go over these 19 pages of replies again! :?
Post Reply