[Gmsh] segfaults on linux but not windows with SDK

Julien Hess julien.hess.ch at gmail.com
Fri Mar 15 23:52:50 CET 2019


Hello Christophe,

Awesome! With this beta SDK I managed to compile my program with gcc5, 
and I ran a few tests with success. I will test it more thoroughly next 
week. Thanks a lot!
The included binary doesn't seem to work though, just so you know.

Regarding the approach with the gmsh.h_cwrap header, I see two distinct 
issues:

 1. The "multiple-definition" error that may occur at the linking stage
    for programs that have more than one compilation unit (tutorials in
    doc/gmsh/demos/api are not concerned).
    As far as I know this issue can indeed be solved either with the
    -zmuldefs flag, by inlining the functions in gmsh.h_cwrap (that mail
    was from me) or using anonymous namespaces as suggested by Juan
    Sanchez (that I didn't try).

 2. The segfault that occurs at execution, due to the infinite recursion
    you mentioned.

But the SDK built with gcc5 made my day! ;-) Thanks again!

Cheers,

Julien


On 15.03.2019 19:09, Christophe Geuzaine wrote:
> Hello Julien (and the other Linux SDK users),
>
> Could you give this beta SDK build a try? (It's now compiled with gcc5 (to match our Windows builds), and does not depend on libgfortran anymore. It's still built with an old glibc version, so that we can continue to support older distributions.)
>
> http://gmsh.info/beta/gmsh-git-Linux64-sdk.tgz
>
> Thanks,
>
> Christophe
>
>> On 14 Mar 2019, at 20:31, Christophe Geuzaine <cgeuzaine at uliege.be> wrote:
>>
>>> 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
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190315/d85684e6/attachment-0001.html>


More information about the gmsh mailing list