How to link external library in custom modules? SCsub?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lehthanis
:warning: Old Version Published before Godot 3 was released.

I need to add an external library to my custom module, and I am getting undefined references because I don’t know how to do the linking…I’m guessing it’s in SCsub. Is there an example somewhere of how this is supposed to be done?

The library is in /lib64/libisense.so for 64 bit and /lib/libisense.so for 32.

This a is scons doc. Not sure if it is old, but hopefully it helps.

SupToasty | 2016-04-26 13:13

It doesn’t really help, because what I ended up doing is adding:

env.Append(LIBS=File('libisense.so'))

to the SCsub…and it compiles, and shows up in the editor…the template also compiles…but when I run a game that uses the module I get this error:

/home/robbie/Documents/Programming/Godot/godot/bin/godot.x11.tools.64: error while loading shared libraries: modules/intersense/libisense.so: cannot open shared object file: No such file or directory

There’s no where that explains how to do this with modules and how to do this in a clean cross platform method. It’s really holding this engine back I think, because from what I can tell, either no one knows how to do this, or no one is sharing how to do this…

lehthanis | 2016-04-27 02:13

Maybe try it with env.Append(LINKFLAGS=["-lisense"])

Hinsbart | 2016-04-28 12:56

I did manage to get it to compile in linux by manually putting the .so files in my /usr/lib folder which is not recommended and changing the line to:

env.Append(LIBS=['isense'])

but that doesn’t solve the windows problem where the manufacturer only provides a .dll.

The whole thing, with the .so’s and .dll’s can be found at:
http://www.confractus.com/intersensemodule.zip if you want to give it a shot.

lehthanis | 2016-04-28 13:02