tags:

views:

54

answers:

3

I need to distribute a binary file for GNU/Linux...

On Windows, I could run a utility named "depends.exe" that would verify all dependencies that the file have, thus I would be able to know what to ship with the file, how I do the same with GNU/Linux?

Clarification: I did not mean LITERALLY distributing it (unless it is some certain library that never generate problems, like... libThatOnlyMySoftwareUseVersion0.00042895.08421thatnoonehas Kinda like figuring that the users would need...)

A: 

On linux you can try ldd.

ghostdog74
+1  A: 

typically you would build a linux binary for a particular distribution of linux, and just provide your own binary, and require users to install the other pieces. If you are using a system that uses rpm packages, you want to read up on how to build RPMs, if you are using a Debian variant then you want to see how apt binary packages are built.

If you want to manually check what libraries your binary is linking against then:

    ldd /whereever/is/your/binary

will give you a list of linked libraries for a dynamically linked binary. but you DO NOT want to distribute most of these as it's like trying to redistribute system32.dll or windows.dll bad bad idea :^)

Elf King
What are `system32.dll` and `windows.dll`? :P
Delan Azabani
@Delan: Some kind of malware, I think ;)
Dan Moulding
@Dan +1 for the correct answer
Elf King
+5  A: 

The utility you are looking for on Linux is called ldd. However, do your users a favor and don't think about distributing libraries with your program. Require your users to install the prerequisites through the proper channels. Or, better yet, package your software using an appropriate installation system like RPM, apt, or portage (I'm assuming you can't use source distribution and the autotools); doing so allows the package management system to automatically resolve dependencies by pulling in any required libraries.

Distributing versions of libraries using ad-hoc schemes is going to only cause problems for end users (something akin to DLL hell on Windows). They can end up with conflicts, crashes, and possibly security holes.

You can use ldd to figure out what libraries your binary depends on so that you can set up the proper dependencies when you make your packages (some packagers, like RPM, actually do this for you).

Dan Moulding