UE toolchain needs to include -lsupc++

Currently it is not possible to package UE project in Linux if it uses any library (such as rpclib) that uses thread local variables… Even though this is perfectly valid thing to do in C++11, you will end up with following error spitted out by Unreal Build Tool:

ATHelper: Packaging (Linux): UnrealBuildTool: /data/UnrealProjects/Blocks/Plugins/AirSim/Source/AirLib/deps/rpclib/lib/librpc.a(this_handler.cc.o): In function rpc::this_handler()': UATHelper: Packaging (Linux): UnrealBuildTool: /home/user/Research/AirSim/external/rpclib/lib/rpc/this_handler.cc:10: undefined reference to__cxa_thread_atexit'

The solution to this is described in this StackOverflow thread which is basically make sure you include linker flag -lsupc++. Would it be possible to update Unreal Build tool with this change?

Related issue on rpclib

Related issue on AirSim

You can include PublicAdditionalLibraries.Add(“subpc++”) in your Build.cs file if you’re fine with relying on a system version of the library.

Note that Unreal uses thread local variables and functions like __cxa_thread_atexit should be provided by libc++abi.a. Does this error happen only when you are using libstdc++?