10

I am very new to Linux and Ubuntu and I have ported my simple game engine to linux. The engine is in a .so file and is linked to the executable.

I am unable to run my executable because it says that it cannot find the Engine.so file (when run in terminal).

So if I am developing on Ubuntu how can I get the executable to find the library were ever it is?

Second question is when distributing the application how are the .so files installed? I assume they are not just put in the same directory as the exe as in windows? so how are they installed?

Braiam
  • 67,791
  • 32
  • 179
  • 269

1 Answers1

10

Executables search for libraries in a set of places, e.g. /lib, /usr/lib, /usr/local/lib,... so if you do not put your .so file in one of these places (/usr/local/lib might be a good place), the executable won't run.

You can explicitly specify a set directories to search for by setting an environment variable LD_LIBRARY_PATH containing whatever directories you like, (including your development directory for instance).

Anwar
  • 76,649
ubfan1
  • 17,838
  • Thanks, When programs install so they put there needed libs in those folders for you? – David Colson Sep 02 '12 at 17:08
  • @DavidColson Typically when you build from source, and do ./configure make make --install (or whatever the command strings are for that make file), it has a script to automatically install to wherever it will check for the script(s) and libraries. Although there are programs which don't install themselves anywhere correctly. – Thomas Ward Sep 02 '12 at 17:10
  • Many third-party packages make use of the second mechanism so that they can supply the appropriate versions of the libraries with their installer. – Ignacio Vazquez-Abrams Sep 02 '12 at 17:41