Recompute routine in Sketcher

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Recompute routine in Sketcher

Postby NormandC » Sun Jul 27, 2014 3:52 pm

Konstantin, wmayer and I have just discussed of how the Debian maintainers do it. The bit of code wmayer posted is it, and it's undecipherable to me. I'll have to read up on the matter.

The FreeCAD package in the official Ubuntu repository is copied from the Debian repo. As for the "devs PPA" well that's just me since wmayer set it up! Since he's one of the 3 main FreeCAD developers and he has a lot on his plate I try to take care of the PPA so he doesn't have to. Plus I was the one who asked for the PPA in the first place. That's how it works in small open source projects with few resources: if you want something, then you lend a hand and learn along the way! ;)

But I've reached a point where I wouldn't mind stepping down from this "job" as I sometimes do not feel up to the task like right now. But until an experienced Debian packager volunteers I'm afraid you'll be stuck with me. ;) (that being said, if anyone wants to learn how to manage the PPA, I'll be glad to teach the little I know)

Thanks for the feedback guys, RelWithDebInfo seems like the right choice. Now to translate that to the apparently new rules method.
Konstantin
Posts: 261
Joined: Wed Jul 23, 2014 10:10 am

Re: Recompute routine in Sketcher

Postby Konstantin » Sun Jul 27, 2014 4:04 pm

No, please, normandc, I don't blame you or any one! Maybe it's a language barier :) Actually, I'm very proud of you guys, You are standing allone against proprietary CAD world! And it's great! It's bad, that comunity is lot smaller then in Blender, and not so many contributors, only annoying beggars like me.
User avatar
DevJohan
Posts: 41
Joined: Sun Jul 13, 2014 2:36 pm
Location: Stockholm, Sweden

Re: Recompute routine in Sketcher

Postby DevJohan » Mon Jul 28, 2014 2:34 pm

Eigen uses range checks to test lookup of elements in matrices when using debug build. This behavior is disabled by defining EIGEN_NO_DEBUG macro. Eigen internally defines this macro if NDEBUG is defined. I don't know if this is part of the problem described here, but defining EIGEN_NO_DEBUG could speedup Eigen code if you don't want extensive range checks.
wmayer
Site Admin
Posts: 15253
Joined: Thu Feb 19, 2009 10:32 am

Re: Recompute routine in Sketcher

Postby wmayer » Sun Aug 03, 2014 9:03 pm

normandc wrote:I noticed tonight that the Debian maintainers have uploaded 0.14.3702 in debian sid (unstable) 4 days ago and their /debian/rules file is extremely different from ours. I'm thinking of trying to build a deb Ubuntu package with it and see how it goes.
I just did, and installed it. Editing Sketch001 from the horsie.fcstd file is bleeding fast!

It does look like the /debian/rules file makes a difference. But there are problems:
The Start workbench is not compiled. Since it's the default start workbench, FreeCAD loads with nothing in the window but the menu and the report view.
The Start module is there but for any reason they put it into a different directory. Same for Robot, Raytracing and Drawing modules.

I have tried today the debian rules file on Ubuntu 12.04. It creates a package but it lacks of all binaries. Does this work correctly for you on 14.04? My deb file only includes a handful of icons and that's it basically. The doc and dev packages contain nothing.

Btw, I downloaded the latest deb file from PPA for 14.04 and checked some binaries. These don't contain any debug information so it's just a matter that optimization is switched off for them.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Recompute routine in Sketcher

Postby NormandC » Sun Aug 03, 2014 9:53 pm

wmayer wrote:The Start module is there but for any reason they put it into a different directory. Same for Robot, Raytracing and Drawing modules.
I didn't notice that, but I really didn't look into it much.

Now that you mentioned it, there is an awful amount of stuff missing from /usr/lib/freecad/Mod: Arch, Complete, Draft, Drawing, Fem, and many others.
wmayer wrote:I have tried today the debian rules file on Ubuntu 12.04. It creates a package but it lacks of all binaries. Does this work correctly for you on 14.04? My deb file only includes a handful of icons and that's it basically. The doc and dev packages contain nothing.
Actually I didn't only use their rules file, I used their whole debian folder except I replaced the control file with mine but with libfltk1.3-dev added as Build-Dep or building the package would fail.

If you have a 64-Bit Ubuntu 14.04 installation I could upload my packages for you to look at them.

Since then I installed a Debian testing virtual machine in VirtualBox to check how their package worked natively. It is exactly as the one I built from their Debian folder.

O/T note: damn VirtualBox, I'm never able to get guest additions working properly on Linux-based guests. :evil: :evil: :evil:
wmayer wrote:Btw, I downloaded the latest deb file from PPA for 14.04 and checked some binaries. These don't contain any debug information so it's just a matter that optimization is switched off for them.
But why is it switched off for 14.04, while it's perfectly fine for 12.04, with exactly the same rules file? :? It was the same problem on 13.10 BTW, which was never resolved.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Recompute routine in Sketcher

Postby NormandC » Sun Aug 03, 2014 9:56 pm

DevJohan wrote:Eigen uses range checks to test lookup of elements in matrices when using debug build. This behavior is disabled by defining EIGEN_NO_DEBUG macro. Eigen internally defines this macro if NDEBUG is defined. I don't know if this is part of the problem described here, but defining EIGEN_NO_DEBUG could speedup Eigen code if you don't want extensive range checks.
The Daily Builds PPA uses the readily available libeigen3-dev package from the Ubuntu repositories. Could the problem be caused by this package having been built with these range checks starting from Ubuntu 13.10? Which would explain why Ubuntu 12.04 FreeCAD packages are not affected?
wmayer
Site Admin
Posts: 15253
Joined: Thu Feb 19, 2009 10:32 am

Re: Recompute routine in Sketcher

Postby wmayer » Mon Aug 04, 2014 6:32 am

normandc wrote:
DevJohan wrote:Eigen uses range checks to test lookup of elements in matrices when using debug build. This behavior is disabled by defining EIGEN_NO_DEBUG macro. Eigen internally defines this macro if NDEBUG is defined. I don't know if this is part of the problem described here, but defining EIGEN_NO_DEBUG could speedup Eigen code if you don't want extensive range checks.
The Daily Builds PPA uses the readily available libeigen3-dev package from the Ubuntu repositories. Could the problem be caused by this package having been built with these range checks starting from Ubuntu 13.10? Which would explain why Ubuntu 12.04 FreeCAD packages are not affected?
To be sure on this you cam add some extra lines to MainGui.cpp and check with a locally built .deb file.

In the include section add:

Code: Select all

#include <stdio.h>
and right after main() call this (the line after the "{"):

Code: Select all

#ifdef NDEBUG
printf("NDEBUG is defined");
#endif
If you then run FreeCAD from the command line and you see this message NDEBUG is set.
wmayer
Site Admin
Posts: 15253
Joined: Thu Feb 19, 2009 10:32 am

Re: Recompute routine in Sketcher

Postby wmayer » Mon Aug 04, 2014 1:44 pm

Actually I didn't only use their rules file, I used their whole debian folder except I replaced the control file with mine but with libfltk1.3-dev added as Build-Dep or building the package would fail.
OK, I have everything working on 12.04 now. On Launchpad in the packaging.precise branch I have updated the files:
* copyright
* dirs
* menu
* rules

and I have added these files:
* freecad-doc.doc-base
* freecad-doc.docs
* freecad.install
* freecad.lintian-overrides
* freecad.manpages

So, let's wait for the next precise package and if this works normally you can pick up the above changes for 14.04.
If you have a 64-Bit Ubuntu 14.04 installation I could upload my packages for you to look at them.
No, I don't have one.
But why is it switched off for 14.04, while it's perfectly fine for 12.04, with exactly the same rules file? It was the same problem on 13.10 BTW, which was never resolved.
I guess some internal changes of the packaging framework.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Recompute routine in Sketcher

Postby NormandC » Mon Aug 04, 2014 8:57 pm

wmayer wrote:So, let's wait for the next precise package and if this works normally you can pick up the above changes for 14.04.
Thanks!
wmayer
Site Admin
Posts: 15253
Joined: Thu Feb 19, 2009 10:32 am

Re: Recompute routine in Sketcher

Postby wmayer » Tue Aug 05, 2014 1:26 pm

DevJohan wrote:Eigen uses range checks to test lookup of elements in matrices when using debug build. This behavior is disabled by defining EIGEN_NO_DEBUG macro. Eigen internally defines this macro if NDEBUG is defined. I don't know if this is part of the problem described here, but defining EIGEN_NO_DEBUG could speedup Eigen code if you don't want extensive range checks.
The build log for 12.04 writes out which compiler flags are used.
dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security
dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): -D_FORTIFY_SOURCE=2
dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security
dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): -Wl,-Bsymbolic-functions -Wl,-z,relro
So, it's definitely true that FreeCAD is built with debug information but also with enabled optimization. Since on 12.04 we don't suffer from a performance penalty I guess these range checks are no that time consuming.