Can't link a Library

I’m using Ubuntu 17.04 and the latest UE4 4.16.

I have a C++ library I want to include in my project, yet UE4 doesn’t seem to link the library correctly and gives me this error:

./UE4Editor: symbol lookup error: /home/ricardo/Documents/UnrealProjects/DivisactionIntg2/Binaries/Linux/ undefined symbol: _ZN11Divisaction5DTime17setTimeCalculatorENSt3__110shared_ptrINS_15DTimeCalculatorEEE

From the beginning:

I edited the build.cs to include the library by adding these lines:

PublicLibraryPaths.Add (LibrariesPath);
PublicAdditionalLibraries.Add (Path.Combine (LibrariesPath, ""));
PublicIncludePaths.Add (Path.Combine (ThirdPartyPath, "Divisaction", "Includes"));

I compiled the project and it compiled fine, but when running it would fail and say the library was missing. After digging around I put the library in the Binaries folder and that solved the problem.

But even after compiling and finding the library, during UE4 is starting up it fails with the above error…

./UE4Editor: symbol lookup error: /home/ricardo/Documents/UnrealProjects/DivisactionIntg2/Binaries/Linux/ undefined symbol: _ZN11Divisaction5DTime17setTimeCalculatorENSt3__110shared_ptrINS_15DTimeCalculatorEEE

How can I fix this?

You might be affected by a bug with how UBT calculates RPATH for the libraries. In Engine/Sources/Programs/UnrealBuildTool/Linux/LinuxToolchain.cs, try replacing line 1117 (or so) with

string RelativePath = new FileReference(AdditionalLibrary).Directory.MakeRelativeTo(OutputFile.Reference.Directory);

(instead of current

string RelativePath = Utils.MakePathRelativeTo(...)


Thank you for the reply. Your solution removes the need to copy and paste the library in the binaries, but the last problem persists. It seems it can’t find the implementation of a function.

I tried other classes of the library and they all crash… It doesn’t seem the engine accepts the library…

If the library is found (you can double check with running


it should not have “not found” but instead point to, make sure that it contains the text for Divisaction::DTime::setTimeCalculator() function. You can run

 nm --demangle 

and grep for that function name. It should say “t” and not “U” next to it.

It doesn’t seem to have the library on the output of ldd…

$ ldd =>  (0x00007ffd77466000) => /lib/x86_64-linux-gnu/ (0x00007f032bbc1000) => not found => not found => not found => not found => not found => /lib/x86_64-linux-gnu/ (0x00007f032b8b6000) => /lib/x86_64-linux-gnu/ (0x00007f032b4ef000) => /lib/x86_64-linux-gnu/ (0x00007f032b2d8000)
/lib64/ (0x0000558781bf5000)

Update: it does find the library: => /home/ricardo/Documents/UnrealProjects/DivisactionIntg2/Binaries/Linux/./ (0x00007fb1a4f54000)

Yet the path should be:


I ran

nm --demangle

And Divisaction::DTime::setTimeCalculator() appears with a T next to it.

The same error is still thrown.

If you have the time, I could upload the .so and you could try it out.

I know this is a bummer, but I really need to get it to work.

I ran nm on my lib and on the project lib and searched for setTimeCalculator function.

On my lib I get this:

0000000000051780 T _ZN11Divisaction5DTime17setTimeCalculatorESt10shared_ptrINS_15DTimeCalculatorEE

While on the project lib I get:

U _ZN11Divisaction5DTime17setTimeCalculatorENSt3__110shared_ptrINS_15DTimeCalculatorEEE

After doing a c++filt I see they differ very little, but they differ:


How can I fix this?

New update: I was able to correctly compile my lib with clang. libc++ and libc++abi.

Problem now is that UE4 tries to link my .so with old libs files. Like:


How can I change it? Maybe I’ll try compiling it with the UE4 libs… but how?

The only solution I found is to copy paste the code into a UE4 Plugin and compile it from there.

Basically, unless you have a extern “C” library (which I don’t), the library needs to be compiled using the same libraries as the engine. (aka compatibility issues…)