Linking completely statically
Tyson Whitehead
twhitehead at gmail.com
Mon Aug 10 21:22:41 UTC 2020
On Mon, 10 Aug 2020 at 03:12, Bardur Arantsson <spam at scientician.net> wrote:
> Once you have that bit set up, you can copy *most* of the libraries
> .so's you're using to that folder on the install target and they'll be
> loaded from there. (Copying libc.so is ill advised, but most of the
> others will work just fine. I believe ld-linux-... is also never ever
> loaded from there since that *is* the dynamic loader.)
Not 100% certain, but I think the issue with libc may be that it may be
somewhat tied to the ld-linux.
You can actually copy everything, including ld-linux, though. You then
invoke the program via ld-linux (it's actually an executable -- see the
ld.so page)
./ld-linux-x86_64.so.2 --library-path <path to copied libraries>
<executable> <args> ...
If you wrap your binaries with a shell script it is actually pretty clean
(make sure to exec so you don't windup with the shell sitting between
parent and childs that can cause some subtle issues)
The only real breakage I've seen from this is when you try and run on too
old of a kernel for your libc or the remote system has an unusual nsswitch
plugin you didn't provide.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20200810/e423c4df/attachment.html>
More information about the Glasgow-haskell-users
mailing list