Linking to Intel TBB on Linux, runtime crash on editor start

Yikes. I don’t have the expertise to be much help but I did notice in the stack, item 42 says “Cannot access memory…”. The line it references in the source is

int32 ErrorLevel = EnginePreInit( CmdLine );

So maybe the command line pointer is bad? It looks like they mess with it a bit in there before using it in that call. Just a stab in the dark. Good luck!

I can’t link to our own .so file that depends on libtbb.so. It looks like TBB is throwing an exception. I can link with Unreal using the same code. TBB has been built with GCC. (I’m trying to get it build with clang separately.)

Should this be possible?
Is there a reason TBB in ThirdParty is not support on Linux?
Is there something on dl load that Unreal prevents TBB from catching its exception?

The crash appears to be coming when TBB runs this code: oneTBB/tbb_misc.cpp at a2cfdfe946933cbe38bffe1d8086ae36f06691a3 · oneapi-src/oneTBB · GitHub

tbb::internal::gcc_rethrow_exception_broken () at ../../src/tbb/tbb_misc.cpp:194

Call stack:

$./UE4Editor
...
terminating with unexpected foreign exception

Program received signal SIGABRT, Aborted.
0x00007fffe649dc37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56	../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.


(gdb) bt
#0  0x00007fffe649dc37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007fffe64a1028 in __GI_abort () at abort.c:89
#2  0x00007ffff6743b2d in abort_message () from /home/sgundry/UnrealEngine/Engine/Binaries/Linux/../../../Engine/Binaries/ThirdParty/CEF3/Linux/libcef.so
#3  0x00007ffff6743ba0 in default_terminate_handler() () from /home/sgundry/UnrealEngine/Engine/Binaries/Linux/../../../Engine/Binaries/ThirdParty/CEF3/Linux/libcef.so
#4  0x00007ffff6740c83 in std::__terminate(void (*)()) () from /home/sgundry/UnrealEngine/Engine/Binaries/Linux/../../../Engine/Binaries/ThirdParty/CEF3/Linux/libcef.so
#5  0x00007ffff6740d00 in std::terminate() () from /home/sgundry/UnrealEngine/Engine/Binaries/Linux/../../../Engine/Binaries/ThirdParty/CEF3/Linux/libcef.so
#6  0x00007ffff6743c54 in default_unexpected_handler() () from /home/sgundry/UnrealEngine/Engine/Binaries/Linux/../../../Engine/Binaries/ThirdParty/CEF3/Linux/libcef.so
#7  0x00007fffe1c0847a in __gxx_dependent_exception_cleanup (code=<optimized out>, exc=<optimized out>) at ../../../../src/libstdc++-v3/libsupc++/eh_ptr.cc:197
#8  0x00007ffff674259c in __cxa_end_catch () from /home/sgundry/UnrealEngine/Engine/Binaries/Linux/../../../Engine/Binaries/ThirdParty/CEF3/Linux/libcef.so
#9  0x00007fff7b12cc11 in tbb::internal::gcc_rethrow_exception_broken () at ../../src/tbb/tbb_misc.cpp:194
#10 0x00007fff7b12f5cb in tbb::internal::governor::acquire_resources () at ../../src/tbb/governor.cpp:80
#11 0x00007fff7b13aac0 in __TBB_InitOnce (this=<optimized out>) at ../../src/tbb/tbb_main.h:71
#12 __sti___ZN48_INTERNAL_26_______src_tbb_tbb_main_cpp_9b42cb883tbb8internal28__TBB_InitOnceHiddenInstanceE () at ../../src/tbb/tbb_main.cpp:75
#13 __sti__$E () at ../../src/tbb/tbb_main.cpp:56
#14 0x00007ffff7dea20a in call_init (l=<optimized out>, argc=argc@entry=2, argv=argv@entry=0x7fffffffd908, env=env@entry=0x6b1430) at dl-init.c:78
#15 0x00007ffff7dea2f3 in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at dl-init.c:36
#16 _dl_init (main_map=main_map@entry=0x309ede0, argc=2, argv=0x7fffffffd908, env=0x6b1430) at dl-init.c:126
#17 0x00007ffff7deef87 in dl_open_worker (a=a@entry=0x7fffffffb4e8) at dl-open.c:592
#18 0x00007ffff7dea0c4 in _dl_catch_error (objname=objname@entry=0x7fffffffb4d8, errstring=errstring@entry=0x7fffffffb4e0, mallocedp=mallocedp@entry=0x7fffffffb4d0, operate=operate@entry=0x7ffff7deea70 <dl_open_worker>, args=args@entry=0x7fffffffb4e8) at dl-error.c:187
#19 0x00007ffff7dee48b in _dl_open (file=0x7fffffffc0b8 "/home/sgundry/Documents/UnrealProjects/MyProject2/Binaries/Linux/libUE4Editor-MyProject2.so", mode=-2147483647, caller_dlopen=<optimized out>, nsid=-2, argc=2, argv=0x7fffffffd908, env=0x6b1430) at dl-open.c:676
#20 0x00007fffe626402b in dlopen_doit (a=a@entry=0x7fffffffb700) at dlopen.c:66
#21 0x00007ffff7dea0c4 in _dl_catch_error (objname=0x66f8e0, errstring=0x66f8e8, mallocedp=0x66f8d8, operate=0x7fffe6263fd0 <dlopen_doit>, args=0x7fffffffb700) at dl-error.c:187
#22 0x00007fffe626462d in _dlerror_run (operate=operate@entry=0x7fffe6263fd0 <dlopen_doit>, args=args@entry=0x7fffffffb700) at dlerror.c:163
#23 0x00007fffe62640c1 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#24 0x00007ffff1deda84 in FLinuxPlatformProcess::GetDllHandle (Filename=<optimized out>) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/Core/Private/Linux/LinuxPlatformProcess.cpp:38
#25 0x00007ffff1f13bb9 in FModuleManager::LoadModuleWithFailureReason (this=<optimized out>, InModuleName=..., OutFailureReason=<optimized out>, bWasReloaded=<optimized out>) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/Core/Private/Modules/ModuleManager.cpp:452
#26 0x00007fffeb8f6bda in FModuleDescriptor::LoadModulesForPhase (LoadingPhase=<optimized out>, Modules=..., ModuleLoadErrors=...) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/Projects/Private/ModuleDescriptor.cpp:412
#27 0x00007fffeb90ac4c in FProjectManager::LoadModulesForProject (this=<optimized out>, LoadingPhase=<optimized out>) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/Projects/Private/ProjectManager.cpp:58
#28 0x0000000000435a4b in FEngineLoop::LoadStartupModules (this=<optimized out>) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:2395
#29 0x000000000041c2db in FEngineLoop::PreInit (this=<optimized out>, CmdLine=<optimized out>) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:1832
#30 0x000000000042d678 in EnginePreInit (CmdLine=0x7fffcb202000 L" /home/sgundry/Documents/UnrealProjects/MyProject2/MyProject2.uproject") at /home/sgundry/UnrealEngine/Engine/Source/Runtime/Launch/Private/Launch.cpp:42
#31 GuardedMain (CmdLine=0x1955 <error: Cannot access memory at address 0x1955>) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/Launch/Private/Launch.cpp:127
#32 0x00007fffe6c4d4b7 in CommonLinuxMain (argc=<optimized out>, argv=<optimized out>, RealMain=<optimized out>) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/Linux/LinuxCommonStartup/Private/LinuxCommonStartup.cpp:236
#33 0x00007fffe6488f45 in __libc_start_main (main=0x4371e0 <main(int, char**)>, argc=2, argv=0x7fffffffd908, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd8f8) at libc-start.c:287
#34 0x00000000004176d2 in _start ()

Try commenting out this line in LinuxToolChain.cs and see if it helps:

		LinkAction.CommandArguments += string.Format(" -Wl,--version-script=\"{0}\"", LinkerScriptPath);

You will need to rebuild the engine after commenting it out.

Thanks, but what does that do?

For an empty project, I’m now getting a libpng version mismatch with my system libpng. So I’ll need to try load UE4 3rd party libs first, I guess.

[2017.05.16-16.41.00:063][  0]LogImageWrapper:Warning: PNG Warning: Application was compiled with png.h from libpng-1.5.2
[2017.05.16-16.41.00:063][  0]LogImageWrapper:Warning: PNG Warning: Application  is  running with png.c from libpng-1.2.50

Program received signal SIGSEGV, Segmentation fault.
FPngImageWrapper::user_error_fn (png_ptr=<optimized out>, error_msg=<optimized out>) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/ImageWrapper/Private/PngImageWrapper.cpp:448
448		ctx->SetError(*ErrorMsg);
(gdb) bt
#0  FPngImageWrapper::user_error_fn (png_ptr=<optimized out>, error_msg=<optimized out>) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/ImageWrapper/Private/PngImageWrapper.cpp:448
#1  0x00007fffd6c262c6 in png_error () from /lib/x86_64-linux-gnu/libpng12.so.0
#2  0x00007fffd6c1ada8 in png_create_read_struct_2 () from /lib/x86_64-linux-gnu/libpng12.so.0
#3  0x00007fff99e1cf48 in FPngImageWrapper::LoadPNGHeader (this=0x7fff9b41d3a0) at /home/sgundry/UnrealEngine/Engine/Source/Runtime/ImageWrapper/Private/PngImageWrapper.cpp:387
#4  0x00007fff99e1ced5 in FPngImageWrapper::SetCompressed (this=0x7fff9b41d3a0, InCompressedData=0x7fffffffc258, InCompressedSize=-1804968640)
    at /home/sgundry/UnrealEngine/Engine/Source/Runtime/ImageWrapper/Private/PngImageWrapper.cpp:190

This removes hiding of global new/delete signatures (among others). The hiding is sometimes necessary since there exists third-party code that allocates through a custom new overload but deletes through a regular delete. However, in absence of such code it is better not to have them.

libpng error is known problem in our bundled CEF. Until this is fixed, disable CEF for Linux.

Hi,

When I am trying to update to 4.19.2. Is there any update on this matter since 4.15.2?
{
libstdc++.so.6.0.25 6bd38
libUE4Editor-Core-Linux-Debug.so e0414c __cxa_end_catch
libtbb.so.2 1dc11 tbb_misc.cpp:196 tbb::internal::gcc_rethrow_exception_broken()
libtbb.so.2 205cb governor.cpp:80 tbb::internal::governor::acquire_resources()
libtbb.so.2 2bac0 tbb_main.cpp:75 sti$E
ld-2.19.so 1020a dl-init.c:78 call_init
ld-2.19.so 102f3 dl-init.c:36 call_init
ld-2.19.so 14fd7 dl-open.c:600 dl_open_worker
ld-2.19.so 100c4 dl-error.c:188 _dl_catch_error
ld-2.19.so 144db dl-open.c:681 _dl_open
libdl-2.19.so 102b dlopen.c:66 __asprintf
ld-2.19.so 100c4 dl-error.c:188 _dl_catch_error
libdl-2.19.so 162d dlerror.c:163 _dlerror_run
libdl-2.19.so 10c1 dlopen.c:87 dlopen
libUE4Editor-Core-Linux-Debug.so 856033 LinuxPlatformProcess.cpp:47 FLinuxPlatformProcess::GetDllHandle(wchar_t const*)
libUE4Editor-Core-Linux-Debug.so 954754 ModuleManager.cpp:468 FModuleManager::LoadModuleWithFailureReason(FName, EModuleLoadResult&)
libUE4Editor-Projects-Linux-Debug.so 7b9c9 ModuleDescriptor.cpp:483 FModuleDescriptor::LoadModulesForPhase(ELoadingPhase::Type, TArray<FModuleDescriptor, FDefaultAllocator> const&, TMap<FName, EModuleLoadResult, FDefaultSetAllocator, TDefaultMapHashableKeyFuncs<FName, EModuleLoadResult, false> >&)
libUE4Editor-Projects-Linux-Debug.so 8dc2b ProjectManager.cpp:67 FProjectManager::LoadModulesForProject(ELoadingPhase::Type)
UE4Editor-Linux-Debug 456b1b LaunchEngineLoop.cpp:2610 FEngineLoop::LoadStartupModules()
UE4Editor-Linux-Debug 448107 LaunchEngineLoop.cpp:2027 FEngineLoop::PreInit(wchar_t const*)
UE4Editor-Linux-Debug 442c32 Launch.cpp:42 EnginePreInit(wchar_t const*)
UE4Editor-Linux-Debug 44f955 Launch.cpp:127 GuardedMain(wchar_t const*)
libUE4Editor-LinuxCommonStartup-Linux-Debug.so 69b1 LinuxCommonStartup.cpp:236 CommonLinuxMain(int, char**, int ()(wchar_t const))
UE4Editor-Linux-Debug 45a79c LaunchLinux.cpp:25 main
}

We still have the fix in LinuxToolChain.cs applied but the crash happens again in 4.19.2