1

If I want to compile an application which needs packages that are not provided by distribution's package manager and I want to generate a distribution package from it, do users who use this distribution package need all those extra libraries installed or will these libraries packed into the binary? I know that it could depend from application to application but how can I recognize if a package needs dynamic linked libraries?

6

The ldd command will tell if a binary of yours is using shared libraries. For those that do not belong to a distribution package, it is up to you to either point the users of your package to the location where to download them, or to bundle the libraries in your package which is certainly the simpler way for the users, assuming the library license allows you to do it.

If you bundle them, make sure the binaries you build will find these libraries by using LD_RUN_PATH at compilation time which is a better practice than to rely on LD_LIBRARY_PATH to fix broken executables.

See http://www.eyrie.org/~eagle/notes/rpath.html for details.

  • And if you bundle them, the user (or your install or start script) can set the LD_LIBRARY_PATH to point to the location of the libraries. – Alfe Dec 2 '13 at 8:52
  • @Alfe Answer updated, although suggesting an alternative safer way. – jlliagre Dec 2 '13 at 8:57
  • That's interesting. Can you point to some documentation on LD_RUN_PATH? – Alfe Dec 2 '13 at 9:01
  • 1
    @Alfe Link added – jlliagre Dec 2 '13 at 9:07
  • Due to that information and the link, I can easily ⁺¹ this answer :) – Alfe Dec 2 '13 at 10:14
3

Most applicaiton on a regular distribution does use libraries and are not compile statically because the overload of RAM and disk would be much more important.

When you include libraries inside a executale it became much more heavy, so the loading of that executable is much more slow and ram costy.

If you want to deploy an application that does not use standard system library and you do not want to install them on your system, you can considered the static compilation so your program will not rely on any system library. The command ldd youprogram will tell you if your program is static or not.

If you want to put your application into a sub folder using the library inside that directory instead the one of the system, you will have to set LD_RUN_PATH when lunching your application to include the library you pack with it and not the system library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.