Exception on import MeshPart

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!
chrisf
Posts: 210
Joined: Fri Jan 03, 2014 10:20 am

Exception on import MeshPart

Postby chrisf » Thu Jul 31, 2014 4:57 pm

I'm getting an exeption on import MeshPart since updating to rev 3802 yesterday. rev 3702 still works fine. Any clues?

This rev crashes:
OS: Ubuntu 14.04.1 LTS
Word size: 64-bit
Version: 0.15.3802 (Git)
Branch: master
Hash: 0a2bec8cd2fd34ae2181ff8d7bf2a3598f2acc5f
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.7.0

with:
Traceback (most recent call last):
File "/home/chris/.FreeCAD/Macros/export_all_stl.FCMacro", line 2, in <module>
import MeshPart
<type 'exceptions.ImportError'>: /home/chris/toolchain/fcad_release_update/lib/libStdMeshers.so: undefined symbol: _ZNK16ExprIntrp_GenExp10ExpressionEv

This rev works fine:
OS: Ubuntu 14.04.1 LTS
Word size: 64-bit
Version: 0.14.3702 (Git)
Branch: master
Hash: d10ddfcb7efa85ac8d5dc2eedda8b0699a46fb13
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.7.0

Both were built clean with the same cmake command.
wmayer
Site Admin
Posts: 14892
Joined: Thu Feb 19, 2009 10:32 am

Re: Exception on import MeshPart

Postby wmayer » Thu Jul 31, 2014 5:46 pm

<type 'exceptions.ImportError'>: /home/chris/toolchain/fcad_release_update/lib/libStdMeshers.so: undefined symbol: _ZNK16ExprIntrp_GenExp10ExpressionEv
I have suspect: can you look for the symbol _ZNK16ExprIntrp_GenExp10ExpressionEv inside the library libTKAdvTools.so?
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Exception on import MeshPart

Postby shoogen » Thu Jul 31, 2014 7:34 pm

chrisf wrote:OCC version: 6.7.0
wmayer wrote:I have suspect: can you look for the symbol _ZNK16ExprIntrp_GenExp10ExpressionEv inside the library libTKAdvTools.so?
This does not sound like 6.7.0. To me it sounds like a messed up installation of OCCT with old object files and mismatching headers. (I've had a lot of problems like this)
Have you compiled OCCT by yourself. And did you update it, without fully uninstalling the old version?
EDIT: (the edit was non-sense. see post below)
wmayer
Site Admin
Posts: 14892
Joined: Thu Feb 19, 2009 10:32 am

Re: Exception on import MeshPart

Postby wmayer » Thu Jul 31, 2014 9:27 pm

Now that I am currently under Linux I quickly checked this myself for OCC 6.6

Code: Select all

nm libTKAdvTools.so | grep _ZNK16ExprIntrp_GenExp10ExpressionEv
gives this output:
nm wrote: 00081b60 T _ZNK16ExprIntrp_GenExp10ExpressionEv
A few people more like Jim and Mark have complained too that MeshPart doesn't load any more. So, I guess shoogen is right that there is a binary mix-up of different OCC versions.
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Exception on import MeshPart

Postby shoogen » Thu Jul 31, 2014 10:41 pm

I got

Code: Select all

nm lin64/gcc/libd/libTKMath.so 
000000000027a63e T _ZNK16ExprIntrp_GenExp10ExpressionEv
nm lin64/gcc/libd/libTKQADraw.so 
                 U _ZNK16ExprIntrp_GenExp10ExpressionEv
for a current 6.7.3.dev version of occt
but as TKMath is allready in CMakeLists.txt. It should work.

And i got

Code: Select all

nm ../oce-install/lib/libTKAdvTools.so.9.0.0 
000000000008c480 T _ZNK16ExprIntrp_GenExp10ExpressionEv
for the oce-dev version that is about one week old.
So maybe i was wrong removing TKAdvTools from CMakeLists.txt. But I thought i succesfully compiled FreeCAD against it.
But i did not really test the dynamic linking.
it turns out i get an error

Code: Select all

Traceback (most recent call last):
  File "<string>", line 1, in <module>
<type 'exceptions.ImportError'>: /home/sebastian/fc-build-oce/lib/libStdMeshers.so: undefined symbol: _ZN17Expr_NamedUnknownC1ERK23TCollection_AsciiString
or demangled
Expr_NamedUnknown::Expr_NamedUnknown(TCollection_AsciiString const&)
:(
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Exception on import MeshPart

Postby shoogen » Thu Jul 31, 2014 10:55 pm

Here is the workaround

Code: Select all

git revert 6843d6ad
:cry:
wmayer
Site Admin
Posts: 14892
Joined: Thu Feb 19, 2009 10:32 am

Re: Exception on import MeshPart

Postby wmayer » Fri Aug 01, 2014 10:19 am

Now, I am confused. On Windows I use OCC 6.6 and everything still compiles and links fine with TKAdvTools removed. As mentioned earlier the missing symbol chrisf has is in OCC 6.6 or earlier in TKAdvTools. Now that he uses OCC 6.7 and TKAdvTools has been removed and the missing symbol is now in TKMath he shouldn't get this problem. But the fact that he does must be related to a corrupt build where he has some leftovers from the old OCC 6.6. So to fix this problem he must rebuild FreeCAD from scratch.

So, what confuses me is when I don't need to link to TKAdvTools on Windows why should I have to on Linux? Anyway, I will check this again on Linux because I have also OCC 6.6 there. Then we will see...

Anyway, I think it's time to activate this in the CMake file:

Code: Select all

    # get linker errors as soon as possible and not at runtime e.g. for modules
    if(UNIX)
    #    SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
    endif(UNIX)
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Exception on import MeshPart

Postby shoogen » Fri Aug 01, 2014 10:29 am

wmayer wrote:Now, I am confused. On Windows I use OCC 6.6 and everything still compiles and links fine with TKAdvTools removed.
Did you test actual loading (like in meshing a shape)?
wmayer wrote:Now that he uses OCC 6.7 and TKAdvTools has been removed and the missing symbol is now in TKMath he shouldn't get this problem.
I checked that in the OCCT git repo. Unlike many of their changes there seems to be no smooth transition. The the missing symbols are not in TKMath for versions 6.7.x
This change is not included in any OCCT release yet http://git.dev.opencascade.org/gitweb/? ... 7dd8d11638
chrisf
Posts: 210
Joined: Fri Jan 03, 2014 10:20 am

Re: Exception on import MeshPart

Postby chrisf » Fri Aug 01, 2014 12:22 pm

Thanks for looking into this. This is not a big problem for me at the moment because I can keep working with 3702 for now. I should get time to look further into it over the weekend.

I did compile OCC 6.7.1 some time ago but it didn't help the problem that I was having so reverted to OCE 6.7.0 and haven't built with OCC 6.7.1 for over a month.

The build that crashes was a completely fresh build in a new directory. I did make some minor local changes to the cmakelists to accommodate switching from OCE to OCC so I've just cloned into the master repository again to make sure that's not the cause of the problem.
wmayer
Site Admin
Posts: 14892
Joined: Thu Feb 19, 2009 10:32 am

Re: Exception on import MeshPart

Postby wmayer » Fri Aug 01, 2014 1:07 pm

OK, compiled from scratch with CMAKE_SHARED_LINKER_FLAGS="-Wl,--no-undefined" and it gives me a linker error for StdMeshers.

EDIT: The fix is checked-in.