ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Slackware loved and lost, Ubuntu current.
Posts: 34
Original Poster
Rep:
Only for the filesize... I'm working on a library that I have to frequently upload to a server to test. Zip achieves a compression ratio of around 75%, which is impressive, but it got me wondering if there's any specially targetted tool for the job, like there is for executables.
It'd save me having to zip / unzip every time I upload it (and would probably yield an even greater ratio than zip)
You should also consider the -Os gcc option, and of course stripping debug symbols and the symbol table. Assuming you've already done that, how exactly do you load a compressed shared library? As far as I know, ld.so will mmap the appropriate shared libraries at run-time. You might be able to hack it and make it bunzip, also, which would allow you to bzip2 the libraries.
Kevin Barry
Only for the filesize... I'm working on a library that I have to frequently upload to a server to test. Zip achieves a compression ratio of around 75%, which is impressive, but it got me wondering if there's any specially targetted tool for the job, like there is for executables.
It'd save me having to zip / unzip every time I upload it (and would probably yield an even greater ratio than zip)
???
Under UNIX-like systems 'tar' and/or its better incarnation GNU tar exist.
Under UNIX-like systems 'gzip', 'bzip2', 'p7zip', 'zip' and other various compressors (including various LZMA ones) exist.
'tar' can call 'gzip' and 'bzip2' through 'z' and 'j' command line switches; I think that latest 'tar' versions know something about LZMA too.
'tar' can pack the whole directory.
'tar' can output to STDOUT while the compressors can take data from STDIN, so 'tar' can be combined with any of the above compressors.
So, why/what a specific application is needed ?
If you want one tool - write a shell alias or a script which combines/aggregates what is necessary - the amount of lines will be probably more than an order of magnitude less than in this post.
Unfortunately, upx will not work to compress shared libs. You can always use xz, bzip2 or whatever.
I was hoping that you were going to ask about be able to use compressed shared libs to run programs -exactly since upx doesn't work. Long ago, I saw a hackish way to do it by renaming and compressing the lib with whatever and then creating a wrapper with the original name which would then unpack and execute the real lib when needed.
Distribution: Slackware loved and lost, Ubuntu current.
Posts: 34
Original Poster
Rep:
Quote:
Originally Posted by gnashley
I was hoping that you were going to ask about be able to use compressed shared libs to run programs -exactly since upx doesn't work. Long ago, I saw a hackish way to do it by renaming and compressing the lib with whatever and then creating a wrapper with the original name which would then unpack and execute the real lib when needed.
Quote:
Originally Posted by ta0kira
Assuming you've already done that, how exactly do you load a compressed shared library? As far as I know, ld.so will mmap the appropriate shared libraries at run-time. You might be able to hack it and make it bunzip, also, which would allow you to bzip2 the libraries.
Kevin Barry
That's the sort of thing I was after. I'm surprised there aren't any common solutions out there - not sure I want to try implementing it myself, however...
Quote:
Originally Posted by ta0kira
You should also consider the -Os gcc option, and of course stripping debug symbols and the symbol table.
Aha. The -s option to remove the symbol table helps me a lot (80% filesize reduction).
That (and having found the ssh compression options for sFTP uploads) should do fine for now...
- UPX can compress all executables, be it AOUT, ELF, libc4, libc5,
libc6, Shell/Perl/Python/... scripts, standalone Java .class
binaries, or whatever...
All scripts and programs will work just as before.
- Compressed programs are completely self-contained. No need for
any external program.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.