开发者

linux binary independent of shared libraries

I have a C++ program that depends on quite a few libraries (some common system libraries like libjpeg some personal libraries that are not installed system wide). The Program compiles well on machine A (Debian Squeeze). I would like to run the program on machine B (Ubuntu maveric) and machine C (Arch). Assume that both machines B+C are extremly mininmal installations. Don't expect to find ANY libraries that my program uses on there and if there are any they are not the same version.

Is there any program that can scan my program for ALL dependencies (using ldd or something) gather all those dependencies, and generate开发者_C百科 a script that will tell the binary to use these and only these libs it comes with on any other system ?

Thank you !


I'm not 100% sure I understand your question, but it seems like you want to ship the libraries with your package, and use LD_LIBRARY_PATH to force the linker to look in your shipped library directory before anything else.

If there's more to it, I can revise my answer as I have some experience with this. Just want to make sure I know what you're asking for.


It turns out the answer to your question is to link statically, say with g++ -static.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜