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

Having trouble installing or compiling FreeCAD? Get help here.
blacey
Posts: 337
Joined: Tue Dec 08, 2015 11:28 pm

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

Postby blacey » Sat Mar 11, 2017 7:54 pm

NormandC wrote:Compiling netgen is proving a pain... :?

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!


Yeah, I had to remove FWOSPlugin from the macOS build as well and was part of the configure changes (it has been a while so I forgot about that one). I just updated the patch set to include that change in configure so you should be able to use it directly...

NormandC wrote: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! :?


You will want to build netgen with opencascase support doing something similar to the following (this is close to what we use on macOS):

Code: Select all

./configure \
 --disable-dependency-tracking \
 --prefix=/usr/local \
 --disable-gui \
 --enable-nglib \
 --enable-occ \
 --with-occ=/usr/local/opt/opencascade


You will want to set --prefix to the proper install location on your system and make sure that --with-occ points to your install of opencascade. Give it a whirl and let me know how it goes.

Sorry for the slow response - was out this AM.
User avatar
sgrogan
Posts: 3005
Joined: Wed Oct 22, 2014 5:02 pm

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

Postby sgrogan » Sat Mar 11, 2017 8:06 pm

Could this be a netgen-headers problem? Last time I tried this on win I had to manually copy the headers from the source. But I was using netgen 5.1 at the time.
User avatar
NormandC
Posts: 12080
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

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

Postby NormandC » Sat Mar 11, 2017 8:16 pm

Hi Bruce,

NormandC wrote: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!

Should have checked before saying this, that's untrue, in bernd's patched netgen the whole list of occ toolkits was removed from configure, just like your first patch was doing. I'm puzzled, so this list is unnecessary? I kept it but only removed the last one.

blacey wrote:You will want to build netgen with opencascase support doing something similar to the following (this is close to what we use on macOS):

Cool, thanks. I didn't think of setting a prefix to /usr/local, right now it installs in /opt/netgen which I find a hassle. I think I won't need the --with-occ section since the default path in configure is the one where my occ package is installed.

blacey wrote:Sorry for the slow response - was out this AM.

You replied less than an hour after my post, that's not slow! I went and did something else to take a break anyway. :)

Thanks again!

sgrogan wrote:Could this be a netgen-headers problem?

I've been wondering the same thing. I compared the files installed by the netgen-headers package to my own checkinstall made package, and they are all missing, I don't know why. They're all in my build folder, but weren't copied by checkinstall which should just do the same thing as make install. I'm hoping Bruce's configure options along with the prefix will make things better.

If not I may try to make a debian package based on the debian/5.1.dfsg tag of the Debian Git repo for netgen. I figure since it was using netgen 5.1 it must be nearer what's needed for 5.3.1.
User avatar
NormandC
Posts: 12080
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

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

Postby NormandC » Sun Mar 12, 2017 12:16 am

Bruce, I'm sorry to report that with your configure option, make produces a boatload of errors (I have the log if you wish to see it).

bernd's configure script is still the stuff that seems to make things go further and apparently succeed with no reported errors. I need to set tcl/tk to 8.5 (because 8.6 is installed by default on Ubuntu 16.04), and gnu++11.

Code: Select all

./configure --prefix=/usr/local --with-tcl=/usr/lib/tcl8.5 --with-tk=/usr/lib/tk8.5 --enable-occ --enable-nglib --enable-shared CXXFLAGS="-DNGLIB_EXPORTS -std=gnu++11"


But I don't think I'm getting anywhere with this %?&*!!! netgen compilation.

Looking at the checkinstall produced package (which should be exactly the same result as with make install), it still does not include the files from /libsrc. On Ubuntu, netgen support in FreeCAD was only possible when a "netgen-headers" package was made available upstream with the following list of files:
http://packages.ubuntu.com/xenial/amd64/netgen-headers/filelist

I see those files in the source folder where the build occurred, but they are not installed by checkinstall.

This is the list of files installed under /usr/local.

Code: Select all

(..)/usr$ ls -R --format=single-column
.:
local

./local:
bin
include
lib
share

./local/bin:
netgen
ng_stl
ng_vol

./local/include:
ngexception.hpp
nginterface.h
nginterface_v2.hpp
nglib.h
soldata.hpp

./local/lib:
libcsg.la
libcsg.so
libcsg.so.0
libcsg.so.0.0.0
libcsgvis.la
libcsgvis.so
libcsgvis.so.0
libcsgvis.so.0.0.0
libgeom2d.la
libgeom2d.so
libgeom2d.so.0
libgeom2d.so.0.0.0
libgeom2dvis.la
libgeom2dvis.so
libgeom2dvis.so.0
libgeom2dvis.so.0.0.0
libinterface.la
libinterface.so
libinterface.so.0
libinterface.so.0.0.0
libmesh.la
libmesh.so
libmesh.so.0
libmesh.so.0.0.0
libnglib.la
libnglib.so
libocc.la
libocc.so
libocc.so.0
libocc.so.0.0.0
liboccvis.la
liboccvis.so
liboccvis.so.0
liboccvis.so.0.0.0
libstl.la
libstl.so
libstl.so.0
libstl.so.0.0.0
libstlvis.la
libstlvis.so
libstlvis.so.0
libstlvis.so.0.0.0

./local/share:
doc
netgen

./local/share/doc:
netgen

./local/share/doc/netgen:
ng4.pdf

./local/share/netgen:
boundarycondition.geo
boxcyl.geo
circle_on_cube.geo
cone.geo
cubeandring.geo
cubeandspheres.geo
cube.geo
cubemcyl.geo
cubemsphere.geo
cube.surf
cylinder.geo
cylsphere.geo
ellipsoid.geo
ellipticcyl.geo
extrusion.geo
fichera.geo
frame.step
hinge.stl
lshape3d.geo
manyholes2.geo
manyholes.geo
matrix.geo
ortho.geo
part1.stl
period.geo
revolution.geo
screw.step
sculpture.geo
shaft.geo
shell.geo
sphere.geo
sphereincube.geo
squarecircle.in2d
squarehole.in2d
square.in2d
torus.geo
trafo.geo
twobricks.geo
twocubes.geo
twocyl.geo

@blacey, could you tell me if anything is obviously missing apart from the files listed in /libsrc? And how do I get to install them?

Thanks.
User avatar
NormandC
Posts: 12080
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

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

Postby NormandC » Sun Mar 12, 2017 1:40 am

After a Gitter session with blacey, we he came to the conclusion that essential headers (found in the netgen-headers package) need to be copied manually, that's what the MacOS X nglib formula does. That's really an oversight from the developer... :|

blacey wrote:Ok, the nglib formula on macOS manually installs the include files. So apparently ./configure does not handle that…

Code: Select all

# The nglib installer doesn't include some important headers by default.
# This follows a pattern used on other platforms to make a set of sub
# directories within include/ to contain these headers.
subdirs = ["csg", "general", "geom2d", "gprim", "include", "interface",
           "linalg", "meshing", "occ", "stlgeom", "visualization"]
subdirs.each do |subdir|
      (include/"netgen"/subdir).mkpath
      (include/"netgen"/subdir).install Dir.glob("libsrc/#{subdir}/*.{h,hpp}")
end


And looking at the debian package for netgen 4.9.13, I think that's what it does as well.

Bruce, I can't thank you enough for spending time with me to troubleshoot this. And now I know I was not doing something wrong! This was driving me nuts. :?
blacey
Posts: 337
Joined: Tue Dec 08, 2015 11:28 pm

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

Postby blacey » Sun Mar 12, 2017 4:55 am

NormandC wrote:essential headers (found in the netgen-headers package) need to be copied manually
Bruce, I can't thank you enough for spending time with me to troubleshoot this. And now I know I was not doing something wrong! This was driving me nuts. :?


There is a reason it is called "Teamwork" or "collaboration d'équipe" but my role was small and I, along many others here, can't thank you enough for auguring in and advancing the Linux PPAs!
User avatar
NormandC
Posts: 12080
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

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

Postby NormandC » Sun Mar 12, 2017 6:19 pm

blacey wrote:I, along many others here, can't thank you enough for auguring in and advancing the Linux PPAs!

:oops:

I did push the idea for the PPA and made the initial research, but it's actually wmayer who first set things up before I could take over. Big thanks go to him as well!

Some more progress. Based on what we found yesterday, I compiled FreeCAD with the old OCE 0.17, libnglib-4-9.13 and netgen-headers from the Ubuntu repositories so I could note what paths were found by cmake for netgen libraries. That allowed me to finally succeed in compiling FreeCAD with OCCT7.1.0 and netgen 5.3.1 compiled from source with your patch applied.

FC017_OCCT7_netgen_01.png
FC017_OCCT7_netgen_01.png (39.88 KiB) Viewed 137 times


FC017_OCCT7_netgen_02.png
FC017_OCCT7_netgen_02.png (33.13 KiB) Viewed 137 times


OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10473 (Git)
Build type: Unknown
Branch: master
Hash: 78b986a2657b7de79b6e350a2535dc0fbfe3f1cf
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0

Which makes me think, might it not be a good idea for the "About FreeCAD" copy to clipboard button to list more of FreeCAD's libraries?

Anyway, the next step is to try to make a debian package of netgen 5.3.1.
User avatar
NormandC
Posts: 12080
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

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

Postby NormandC » Wed Mar 15, 2017 4:24 am

Here's where I'm at.

https://git.launchpad.net/~freecad-maintainers/+git/netgen/

I pushed a single branch that contains the source code and the debian packaging folder.

It contains 3 branches:
  • master contains the complete source with debian package necessary to build a recipe.
  • upstream contains the untainted source code imported from a tarball. The import created a tag "upstream/<version>".
  • pristine-tar is a branch automatically added at tarball import and contains data to rebuild the original tarball.

I did that for a few reasons:
  • That's how packages for official Debian and Ubuntu repositories are developed. For example see https://anonscm.debian.org/cgit/debian-science/packages/netgen.git/
  • There is really no good reason to create two separate git repos when we import source code from a tarball, with no prior history, and with no intention to submit commits to the source code itself.
  • No need to nest a packaging branch in the build recipe.
  • I wanted to test this process.

All this is set up using git-buildpackage. It comes with an html manual located in /usr/share/doc/git-buildpackage/manual-html/index.html

Then, working in master, I copied and edited the debian packaging folder from the netgen-4.9.13 package from the Ubuntu repository.

It does not currently build. :(

I suspect that it's because C++11 isn't enabled. I don't know how to enable it in the debian/rules makefile.

I need to reproduce these options given by blacey for compiling netgen 5.3.1 after applying his patch (and which worked perfectly as per my previous posts above):

Code: Select all

./configure --prefix=/usr/local --with-tcl=/usr/lib/tcl8.5 --with-tk=/usr/lib/tk8.5 --enable-occ --enable-nglib --disable-gui --disable-dependency-tracking --enable-shared CXXFLAGS="-DNGLIB_EXPORTS -std=gnu++11"

I have them all in rules except for DNGLIB_EXPORTS and gnu++11.

The attached tar.gz is the build log. Sorry, most of the terminal output is in French...
Attachments
netgen_5.3.1-1ppa1_amd64_failed.build.tar.gz
(13.05 KiB) Downloaded 2 times
gdo35
Posts: 173
Joined: Wed Jan 25, 2012 7:25 pm

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

Postby gdo35 » Wed Mar 15, 2017 3:20 pm

I manage to build the packages, I dont know if they are good but I have packages.

I just did a checkout from NormandC git repository and modified the following files :

  • normandc wrote:I suspect that it's because C++11 isn't enabled. I don't know how to enable it in the debian/rules makefile.
+1

To enable it in debian/rules, just export CFLAGS/CXXFLAGS with the wanted option.

Code: Select all

$ git diff debian/rules
diff --git a/debian/rules b/debian/rules
index 6b8cf3f..ee9feb9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,6 +5,8 @@ DEB_AUTO_CLEANUP_RCS            := yes
 #DEB_AUTO_UPDATE_AUTOCONF      := 1
 
 export MACHINE=LINUX
+export CFLAGS=-std=gnu++11
+export CXXFLAGS=${CFLAGS}
 
 
 DEB_DH_COMPRESS_ARGS := -X pdf
@@ -26,6 +28,7 @@ makebuilddir/netgen::
            cp -p $$autoreconfile $$autoreconfile.save ; \
          done; \
        fi
+       sed -i 's/ -lFWOSPlugin//g' configure.ac
        autoreconf --install
 
 build/netgen::
@@ -33,9 +36,9 @@ build/netgen::
 
 install/netgen::
        install -d $(DEB_DESTDIR)/usr/share/man/man1
-       install -m644 debian/netgen.1 $(DEB_DESTDIR)/usr/share/man/man1
-       install -m644 debian/ng_stl.1 $(DEB_DESTDIR)/usr/share/man/man1
-       install -m644 debian/ng_vol.1 $(DEB_DESTDIR)/usr/share/man/man1
+       #install -m644 debian/netgen.1 $(DEB_DESTDIR)/usr/share/man/man1
+       #install -m644 debian/ng_stl.1 $(DEB_DESTDIR)/usr/share/man/man1
+       #install -m644 debian/ng_vol.1 $(DEB_DESTDIR)/usr/share/man/man1
        install -d $(DEB_DESTDIR)/usr/share/netgen
        mv $(DEB_DESTDIR)/usr/bin/*.tcl $(DEB_DESTDIR)/usr/share/netgen
        chmod ugo-x $(DEB_DESTDIR)/usr/share/netgen/*.tcl


  • The both export do the trick according to "-std=gnu++11" missing option.
  • The sed command I added is to remove libFWOSPlugin.so dependency. I got an error at build telling me the lib cannot be found. I dont know the purpose of this lib and I applied a noob solution : removing it. If this lib is really useless for netgen, the good way is to remove it from configure.ac and commit. This sed is just a quick and dirty fix...[edit] I just saw blacey post about it ;)[/edit]
  • As you notice, I deactivate man pages install, due to missing files. It will need to be corrected later.

I also needed to reorder packages into debian/control file according to inter packages dependencies :

Code: Select all

$ git diff debian/control
diff --git a/debian/control b/debian/control
index 7be7cb6..0ec2a75 100644
--- a/debian/control
+++ b/debian/control
@@ -31,30 +31,6 @@ Vcs-Git: git://git.debian.org/git/debian-science/packages/netgen.git
 Vcs-Browser: http://git.debian.org/?p=debian-science/packages/netgen.git
 Homepage: http://sourceforge.net/projects/netgen-mesher/
 
-Package: netgen
-Architecture: any
-Depends: ${shlibs:Depends},
-         ${misc:Depends}
-Description: Automatic 3d tetrahedral mesh generator
- NETGEN is an automatic 3d tetrahedral mesh generator. It accepts
- input from constructive solid geometry (CSG) or boundary
- representation (BRep) from STL file format.  NETGEN contains modules
- for mesh optimization and hierarchical mesh refinement.
-
-Package: netgen-doc
-Section: doc
-Architecture: all
-Depends: ${misc:Depends}
-Suggests: netgen
-Description: Automatic 3d tetrahedral mesh generator documentation
- NETGEN is an automatic 3d tetrahedral mesh generator. It accepts
- input from constructive solid geometry (CSG) or boundary
- representation (BRep) from STL file format.  NETGEN contains modules
- for mesh optimization and hierarchical mesh refinement.
- .
- This package contains the user manual (in PDF format) and example
- files.
-
 Package: libnglib-dev
 Section: libdevel
 Architecture: any
@@ -99,3 +75,28 @@ Description: Automatic 3d tetrahedral mesh generator internal headers
  refinement.
  .
  This package contains internal headers.
+
+Package: netgen
+Architecture: any
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Description: Automatic 3d tetrahedral mesh generator
+ NETGEN is an automatic 3d tetrahedral mesh generator. It accepts
+ input from constructive solid geometry (CSG) or boundary
+ representation (BRep) from STL file format.  NETGEN contains modules
+ for mesh optimization and hierarchical mesh refinement.
+
+Package: netgen-doc
+Section: doc
+Architecture: all
+Depends: ${misc:Depends}
+Suggests: netgen
+Description: Automatic 3d tetrahedral mesh generator documentation
+ NETGEN is an automatic 3d tetrahedral mesh generator. It accepts
+ input from constructive solid geometry (CSG) or boundary
+ representation (BRep) from STL file format.  NETGEN contains modules
+ for mesh optimization and hierarchical mesh refinement.
+ .
+ This package contains the user manual (in PDF format) and example
+ files.
+


There is no libnglib-*.so but there is several independant libs that were not installed but needed by netgen binaries. I install them all :

Code: Select all

$ git diff debian/libnglib-5.3.1.install
diff --git a/debian/libnglib-5.3.1.install b/debian/libnglib-5.3.1.install
index b68614b..d0dbfd1 100644
--- a/debian/libnglib-5.3.1.install
+++ b/debian/libnglib-5.3.1.install
@@ -1 +1 @@
-usr/lib/libnglib-*.so
+usr/lib/lib*.so.*


As said before, I do not install man pages for now :

Code: Select all

$ git diff debian/netgen.install
diff --git a/debian/netgen.install b/debian/netgen.install
index 00aa54d..6a15349 100644
--- a/debian/netgen.install
+++ b/debian/netgen.install
@@ -1,5 +1,5 @@
 usr/bin/*
-usr/share/man/man1/*
+#usr/share/man/man1/*
 usr/share/netgen/*.tcl
 usr/share/applications/netgen.desktop
 usr/share/pixmaps/netgen16x16.xpm


Then issuing this command :

Code: Select all

$ debuild -uc -us -j$(nproc) --lintian-opts --profile debian

produces 5 packages :

Code: Select all

ls ../*.deb
../libnglib-5.3.1_5.3.1-1ppa1_amd64.deb  ../netgen_5.3.1-1ppa1_amd64.deb    ../netgen-headers_5.3.1-1ppa1_amd64.deb
../libnglib-dev_5.3.1-1ppa1_amd64.deb    ../netgen-doc_5.3.1-1ppa1_all.deb


I did not take the time to read all previous posts, so sorry if I said things already said before.
I could forget some points, just let me know. ;)

May The Force Be With You. :mrgreen:

++
gdo
HoWil
Posts: 386
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

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

Postby HoWil » Wed Mar 15, 2017 8:33 pm

Maybe one of the occ guys can have a look at ... https://forum.freecadweb.org/viewtopic. ... 54#p165574
Looks like it is a related Segmentation fault-prob.
Thanks in advance,
HoWil