When an external shared library’s thread exits, it crashes the engine with a signal 11 error from Fmalloc. But only if that library was compiled with libc++, ones made with libstdc++ are fine. Which would fix my problem, except that beacause UE uses libc++, in order for any function that takes a string as an input (or a vector or any other standard type) to be callable, the other library has to be compiled with libc++.
The library works fine on it’s own - it’s something about how it connects to UE that causes the issue.
Your question actually turns out to be my answer. Linking libc++ instead of libstdc++ actually avoid segfault for me and it’s running smoothly. I was having a hard time integrating third-party library on linux until I read this post. Thanks for the help although I didn’t know the exact answer you have. It maybe helpful for others who is having problems.
Glad to hear this helped. I haven’t actually got a fix for this: the nature of my project has changed slightly so the code that this was relevant for wasn’t needed any more. May I ask where your segfault was?
Any news in this field? I have a simillar problem. I’m writing a static library for iOS and when I’m building and linking it with libstdc++ everything works fine, but when with libc++ I have crashes in std::strings and std::vectors, in really strange places.
libstdc++ is currently deprecated on iOS, so I don’t want to use it, but at this moment I have no choice
When I’m running my library with iOS app it works fine, but strange things happens after linking it to the engine.
What’s more - crashes occurs only on shipping builds. Development builds works fine (but it is probably because of less restricted memory management).
I’m getting exact same issue. The thread exit in library causes segfault. I’m also seeing segfaults in strange places such as fstream and stringstream. It would be great if Unreal folks can specify the best way to compile libraries that works with their engine.
I am using windows Visual Studio Community 2017 ver.15.7.6 + UE 4.19.2.
One of my .dll work fine outside UE; However while it is used in UE project as plugin, it crashes every time in destruction of std::thread, which is very, very despairing.
Is there any way to fix this?