How to copy an executable with all needed libraries?

fra*_*ans 9 linux executable dependencies shared-libraries

I have two fairly identical (Linux-) systems but one with just a minimum set of packages installed. On one system I have a running (binary/ELF) executable which I want to copy over to the other system (with the minimum setup).

Now I need a way to copy all needed shared libraries as well. Currently I start the application on the source system and then go through the output of

lsof | grep <PID> 
Run Code Online (Sandbox Code Playgroud)

or

ldd <FILE>
Run Code Online (Sandbox Code Playgroud)

to get a list of all libraries currently loaded by the application and copy them over manually.

Now my question is: before I start to automate this approach and run into lots of little problems and end up with yet another reinvented wheel - Is there a tool which already automates this for me? The tool I'm dreaming of right now would work like this:

$ pack-bin-for-copy <MY_EXE>
Run Code Online (Sandbox Code Playgroud)

which creates a .tgz with all needed shared libraries needed to run this executable.

or

$ cp-bin <MY_EXE> user@target:/target/path/
Run Code Online (Sandbox Code Playgroud)

这只会复制二进制文件一次..

注意:我不需要专业部署应用程序的方法(通过 RPM/apt/等)。我正在寻找“暂时”解决方案。

ros*_*739 0

ldd-Wl,--no-dynamic-lookup如果您也在链接时启用,则用法是正确的。