[Gmsh] segfaults on linux but not windows with SDK

Christophe Geuzaine cgeuzaine at uliege.be
Thu Mar 14 20:31:03 CET 2019



> On 14 Mar 2019, at 17:49, Julien Hess <julien.hess.ch at gmail.com> wrote:
> 
> Hello Max and Christophe,
> 
> I just encountered the same problem with the latest version 4.2.2 of the SDK. The regular header works just fine on Ubuntu with GCC 4, but the approach with the cwrap and gmshc.h to make it work with GCC 5 still causes a segfault when calling gmsh::initialize(). Do you remember what the issue with the cwrap header was? Is there a way to fix or bypass that issue?
> 

As stated in the README, until we ship the SDK compiled with a more recent gcc you should use "-D_GLIBCXX_USE_CXX11_ABI=0". Or as suggested on the mailing list, you could inline the functions in gmsh.h_cwrap or encapsulate them in another namespace. If somebody can confirm that inlining allows to solve the issue, we could change gmsh.h_cwrap to do the inlining by default.

More detailed explanation : the ABI from gcc5 is *partially* compatible with the gcc4 ABI. This means that using gmsh.h_cwrap as-is will lead to infinite recursions for e.g gmsh::initialize (which has the same name mangling with the 2 compilers), as the call to the function defined in gmsh.h_cwrap will call the C function, which itself will call back the function in gmsh.h_cwrap (instead of the function in the library).

Christophe


> Thanks for any help!
> 
> Julien
> 
> On 27 Jul 2018, at 15:02, Max Orok <morok at mevex.com
> > wrote:
> 
> 
> Yes, there was an issue with the cwrap header but the regular header was
> fine after all.
> Sorry for the trouble!
> 
> Max Orok
> 
> On Fri, Jul 27, 2018 at 1:58 AM, Christophe Geuzaine <
> cgeuzaine at uliege.be
> >
> wrote:
> 
> >
> 
> >
> > On 10 Jul 2018, at 17:32, Max Orok <morok at mevex.com
> > wrote:
> 
> >
> >
>  Hello all,
> 
> >
> >
>  Sorry for the newbie question. I have some C++ code that has successfully
> 
> >
>  built and ran using the windows gmsh SDK but which causes a segfault on
> 
> >
>  ubuntu when trying to call gmsh::initialize(). I have tried the basic gmsh
> 
> >
>  C++ header and .so files, using the cwrap and gmshc.h version of the gmsh
> 
> >
>  header file, defining the ABI number for g++ as 0, (and 1 just for kicks),
> 
> >
>  and finally recompiling the .so from source with the same compiler as the
> 
> >
>  other code, all to no avail. Is there anything further I can try apart from
> 
> >
>  wrestling with gdb?
> 
> >
> >
> >
>  Did you fix the issue ?
> 
> >
> >
>  CG
> 
> >
> >
> >
>  Thanks for your time,
> 
> >
>  Max Orok
> 
> >
>  _______________________________________________
> 
> >
>  gmsh mailing list
> 
> > gmsh at onelab.info
> > http://onelab.info/mailman/listinfo/gmsh
> >
> >
> >
>> 
> >
>  Prof. Christophe Geuzaine
> 
> >
>  University of Liege, Electrical Engineering and Computer Science
> 
> > http://www.montefiore.ulg.ac.be/~geuzaine
> >
> > Free software: http://gmsh.info | http://getdp.info | http://onelab.info
> >
> >
> 
> -- 
> Max Orok
> Summer Student
> 
> www.mevex.com
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

— 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine






More information about the gmsh mailing list