Message boards : BOINC client : problem building linux client: binary code is 20x bigger than before
Message board moderation
Author | Message |
---|---|
Send message Joined: 27 Jun 08 Posts: 641 |
I am not an expert on gcc compilers I have two previous build of the linux boinc client and both builds were small: jstateson@jyslinux1:~/Downloads/boinc-master/client$ ls -l boinc -rwxrwxr-x 2 jstateson jstateson 1517832 Nov 1 01:22 boinc jstateson@jyslinux1:~/Downloads/boinc-master/client$ I decided to use a better system and did a new install of git and the client I followed the same procedure as here except that package gm4 was not found. Used https://boinc.berkeley.edu/trac/wiki/SourceCodeGit to get the master. unaccountably, the final executable was 20x bigger. I assume it is full of debugging stuff? Why is it that big? I want it reduced down to the smaller size but do not know enough about gcc or the make files to do that jstateson@jysdualxeon:~/boinc$ cd client jstateson@jysdualxeon:~/boinc/client$ ls -l boinc -rwxr-xr-x 2 root root 20075752 Nov 9 08:00 boinc The program runs ok but is way to big. Must have the proverbial kitchen sink in it. [edit] using the old makefiles did not help. I copied the 4 "Makefile" from the other Linux system and "touched" version.h but still ended up with a huge executable |
Send message Joined: 27 Jun 08 Posts: 641 |
It is big because it has debug stuff. I grep for "--strip-debug" but it was there so I am at a loss to why all the debug stuff was in the executable. my older project from 2 months ago was obtained the same way and has no debug stuff stateson@jysdualxeon:~/boinc/client$ file boinc boinc: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=753642cbdfe8381bf86e41d736eece30774dd318, with debug_info, not stripped so how do I strip the debug from it? |
Send message Joined: 17 Nov 16 Posts: 891 |
Depends on the compiler. The modern compilers default to pie mode now. The older compilers defaulted to --no-pie so the executables were a lot smaller. When you run with the current defaults you end up with a application/x-sharedlib binary. When you use the --no-pie compiler flag you get the older application/x-executable binary. You also see that the different binaries get different icons. The x-executable gets the traditional diamond Linux icon and the new sharedlib one gets the document icon. I run my configure with this line: ./configure CXX='g++ -no-pie' --disable-server --disable-manager keith@Serenity:~/Desktop/BOINC$ file boinc boinc: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=27829cfe32bab24811b220470a22b5b9ee2b9ea9, with debug_info, not stripped Best would be to use compiler flags to not use the debug symbols in the first place but you can strip the symbols out afterwards with the strip command. strip --strip-debug boinc keith@Serenity:~/Desktop/BOINC$ ls -l boinc -rwxr-xr-x 1 keith keith 1186392 Nov 9 18:13 boinc |
Send message Joined: 17 Nov 16 Posts: 891 |
It is big because it has debug stuff. I grep for "--strip-debug" but it was there so I am at a loss to why all the debug stuff was in the executable. my older project from 2 months ago was obtained the same way and has no debug stuff Oh, sorry I see you what you are saying now. You mean you see the --strip-debug in the CXX flags in the makefile and yet the symbols still get included. [Edit] Look for the CXX configure line for the -g option Most programs and libraries are, by default, compiled with debugging symbols included (with gcc's -g option) |
Send message Joined: 27 Jun 08 Posts: 641 |
the above flags had no effect on size jstateson@jysdualxeon:~/boinc/client$ ls -l boinc -rwxr-xr-x 2 root root 20073976 Nov 9 20:41 boinc
this worked! jstateson@jysdualxeon:~/boinc/client$ sudo strip --strip-debug boinc jstateson@jysdualxeon:~/boinc/client$ ls -l boinc -rwxr-xr-x 2 root root 1187568 Nov 9 20:44 boinc jstateson@jysdualxeon:~/boinc/client$ the grep I did only got a hits at config.status:old_striplib='strip --strip-debug' configure: test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" libtool:old_striplib="strip --strip-debug" and all 3 of those "hits" showed up in the old dev system and the new one. Also I don't know the significance of those "hits" FWIW. |
Send message Joined: 17 Nov 16 Posts: 891 |
Yes, I realized after posting you weren't concerned about the ELF binary type, just the size. The binary type was a pet peeve of my developer friend that did not like the sharedlib binary because of the icon. I figured out the compiler flag to get the executable binary type for him. It all depends on if the linker defaults to pulling in the debug symbol library. The compilers all default to having debug symbols because it is a pain to debug a binary without them if you need to it seems. Been reading up on the topic this afternoon. Seems like an easy fix to reduce the size down after the fact with the strip command. I'm not really concerned about the size, have plenty of both storage and memory. Would and could be a different story on my SBC computers. Need to see if the size is large with debug in the binary on those systems since they have limited memory and storage. Would like to test whether the stripped binary is any faster than one with debug symbols. On the client it probably doesn't matter much or even with the manager. I bet it has a much bigger effect on the science apps. I'm most interested in that. |
Send message Joined: 17 Nov 16 Posts: 891 |
Maybe you could try the -Wl --strip-all configure parameters the next time you compile your client. https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-strip-symbols-from-your-binaries |
Send message Joined: 27 Jun 08 Posts: 641 |
Made some progress tracking down why debug was enabled the " -g " is controlled by ac_cv_prog_cc_g if = yes then debug is on if = no then off that variable iis in the script "configure" which is created by _autosetup In one folder "boinc" if I run autosetup I get that flag set to "yes" and get debug stuff "-g -O2" in another folder "boinc-master" if I run autosetup I get that flag set to 'no" and all I get is -O3 using diff there is no difference between the two _autosetup nor the two Makefile.in nor the two Makefile.am nor the two Makefile.incl there is a difference between the final "Makefile" as the -g O2 is in one and the -O3 is in the other but that is expected due to that flag being set to "yes" One folder came from going to GitHub and a download of a zip the other folder came from git clone https://github.com/BOINC/boinc boinc Maybe that is how the difference came about, maybe not. Not going to pursue this any further. as that strip command you suggested works fine Going to "smashin crab" for late lunch as I have given up on smashing this bug. |
Copyright © 2024 University of California.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by the Free Software Foundation.