x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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/libUE4Editor-DivisactionIntg2.so: 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, "libDivisaction.so"));
 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/libUE4Editor-DivisactionIntg2.so: undefined symbol: _ZN11Divisaction5DTime17setTimeCalculatorENSt3__110shared_ptrINS_15DTimeCalculatorEEE

How can I fix this?

Product Version: UE 4.16
Tags:
more ▼

asked Jun 27 '17 at 07:30 PM in Linux

avatar image

RicardoEPRodrigues
14 4 5 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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...)

more ▼

answered Sep 11 '17 at 12:06 PM

avatar image

RicardoEPRodrigues
14 4 5 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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(...)

)

more ▼

answered Jun 27 '17 at 08:18 PM

avatar image

RCL STAFF
2.7k 59 6 88

avatar image RicardoEPRodrigues Jun 28 '17 at 09:29 AM

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.

avatar image RicardoEPRodrigues Jun 28 '17 at 11:21 AM

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

avatar image RCL STAFF Jun 28 '17 at 02:21 PM

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

 ldd libUE4Editor-DivisactionIntg2.so

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

  nm --demangle libDivisaction.so 

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

avatar image RicardoEPRodrigues Jun 28 '17 at 02:34 PM

It doesn't seem to have the library on the output of ldd...

 $ ldd libUE4Editor-DivisactionIntg2.so
 linux-vdso.so.1 =>  (0x00007ffd77466000)
 libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f032bbc1000)
 libUE4Editor-Engine.so => not found
 libUE4Editor-AIModule.so => not found
 libUE4Editor-Core.so => not found
 libUE4Editor-CoreUObject.so => not found
 libUE4Editor-UMG.so => not found
 libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f032b8b6000)
 libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f032b4ef000)
 libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f032b2d8000)
 /lib64/ld-linux-x86-64.so.2 (0x0000558781bf5000)
avatar image RicardoEPRodrigues Jun 28 '17 at 04:15 PM

Update: it does find the library:

 libDivisaction.so => /home/ricardo/Documents/UnrealProjects/DivisactionIntg2/Binaries/Linux/./libDivisaction.so (0x00007fb1a4f54000)

Yet the path should be:

  /home/ricardo/Documents/UnrealProjects/DivisactionIntg2/ThirdParty/Divisaction/Libraries/libDivisaction.so

I ran

 nm --demangle libDivisaction.so

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.

avatar image RicardoEPRodrigues Jun 29 '17 at 12:13 AM

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:

 Divisaction::DTime::setTimeCalculator(std::shared_ptr<Divisaction::DTimeCalculator>)
 Divisaction::DTime::setTimeCalculator(std::__1::shared_ptr<Divisaction::DTimeCalculator>)

How can I fix this?

avatar image RicardoEPRodrigues Jun 29 '17 at 02:44 PM

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:

 Engine/Binaries/ThirdParty/CEF3/Linux/libcef.so

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question