Robot example crashes

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Robot example crashes

Post by wmayer »

In fact I had FREECAD_USE_EXTERNAL_KDL=ON. If I set it to OFF everything works
Since on the local copy of the KDL has been added some extensions it doesn't make sense to allow to use an external KDL because both versions are neither source nor binary compatible. To fix this issue one has to revert the changes made by JRiegel and then make sure if FREECAD_USE_EXTERNAL_KDL=ON not to include the header files of the local KDL. For now the easiest way is to not offer FREECAD_USE_EXTERNAL_KDL or disable its functionality.
but with the following corrections, which I do not know whether are essential or not
Recently I added some changes to fix possible crashes.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Robot example crashes

Post by sgrogan »

wmayer wrote: Fri Aug 17, 2018 7:38 pm For now the easiest way is to not offer FREECAD_USE_EXTERNAL_KDL or disable its functionality.
The OSX guys are using this for the auto-builds
https://github.com/FreeCAD/FreeCAD/blob ... s.yml#L194
I thought this was only for OSX to begin with, but maybe it is obsolete.

EDIT: doesn't seem to affect the build https://travis-ci.org/FreeCAD/FreeCAD/b ... tification
"fight the good fight"
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Robot example crashes

Post by wmayer »

The OSX guys are using this for the auto-builds
I know but the way it is used is incorrect. If it were used correctly it would lead to a build failure because of the additional methods added by JRiegel. On macOS the Robot module sees the header of the local KDL, hence no build failure but links against the installed KDL which lacks of the additional class members, i.e. the class layout is different and thus incompatible.

And this means that e.g. the added Path variable will never be initialized because it uses the constructor of the installed KDL that doesn't know about it. The behaviour is undefined in this case.
User avatar
federico.carminati
Posts: 66
Joined: Thu May 18, 2017 1:01 pm
Location: Geneva, Switzerland

Re: Robot example crashes

Post by federico.carminati »

This is not my empirical evidence on Mac. I have compiled with internal KDL and I see no sign of the external one

Code: Select all

$ otool -L /Applications/FreeCAD.app/Contents/lib/Robot* | grep -i kdl
$ 
comes up empty. On the contrary I find all the stuff in the Robot libraries

Code: Select all

[...r/local/FreeCAD/build] nm -o /Applications/FreeCAD.app/Contents/lib/Robot* | grep 'Trajectory_Segment' | c++filt
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000178350 T KDL::Trajectory_Segment::GetProfile()
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000178330 T KDL::Trajectory_Segment::GetPath()
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000177df0 T KDL::Trajectory_Segment::Trajectory_Segment(KDL::Path*, KDL::VelocityProfile*, bool)
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000177f00 T KDL::Trajectory_Segment::Trajectory_Segment(KDL::Path*, KDL::VelocityProfile*, double, bool)
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000177d90 T KDL::Trajectory_Segment::Trajectory_Segment(KDL::Path*, KDL::VelocityProfile*, bool)
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000177e30 T KDL::Trajectory_Segment::Trajectory_Segment(KDL::Path*, KDL::VelocityProfile*, double, bool)
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000178300 T KDL::Trajectory_Segment::~Trajectory_Segment()
/Applications/FreeCAD.app/Contents/lib/Robot.so: 00000000001782e0 T KDL::Trajectory_Segment::~Trajectory_Segment()
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000178250 T KDL::Trajectory_Segment::~Trajectory_Segment()
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000178080 T KDL::Trajectory_Segment::Acc(double) const
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000177f70 T KDL::Trajectory_Segment::Pos(double) const
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000177fe0 T KDL::Trajectory_Segment::Vel(double) const
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000178370 unsigned short KDL::Trajectory_Segment::Clone() const
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000178140 T KDL::Trajectory_Segment::Write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const
/Applications/FreeCAD.app/Contents/lib/Robot.so: 0000000000177f50 T KDL::Trajectory_Segment::Duration() const
/Applications/FreeCAD.app/Contents/lib/Robot.so: 00000000001de800 S typeinfo for KDL::Trajectory_Segment
/Applications/FreeCAD.app/Contents/lib/Robot.so: 00000000001c8de0 S typeinfo name for KDL::Trajectory_Segment
/Applications/FreeCAD.app/Contents/lib/Robot.so: 00000000001de7a0 S vtable for KDL::Trajectory_Segment
And everything works fine.

What bothers me is that when you build with the external KDL there are still files from the internal one that are compiled and (very possibly... I have to confirm) loaded and this probably creates a mess. When using the external KDL no files from the internal one should be compiled. But if the backward compatibility is broken I am afraid that we can only work with the internal one.
Federico Carminati
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Robot example crashes

Post by wmayer »

I have compiled with internal KDL and I see no sign of the external one
No, it's exactly the opposite.
What bothers me is that when you build with the external KDL there are still files from the internal one that are compiled and (very possibly... I have to confirm) loaded and this probably creates a mess. When using the external KDL no files from the internal one should be compiled.
That's exactly what I said the whole time.

For now the only solution is not to allow to link against the external KDL which I did with git commit 9f9886691b
Post Reply