Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No strip.exe needed in gfortran4.7?

Status
Not open for further replies.

GerritGroot

Technical User
Nov 3, 2006
291
0
0
ES
Hi,

I changed from gfortran 4.6 to gfortran 4.7 and the size of my executable reduced to one third when compiling with 4.7 with respect to 4.6

I suppose this may be because the default debug settings changed. Before I used strip.exe to reduce the size of my .exe file (see: but now strip doesn't have any effect.

Which compiler option do I need to get the debug info back in the exe file? (in cases where I want to)

Thanks,

Gerrit
 
GerritGroot said:
I changed from gfortran 4.6 to gfortran 4.7
...
but now strip doesn't have any effect.
I tried strip coupled with 4.7 and IMHO it has the effect as before:
Code:
c:\_mikrom\Work\gfortran_test>gfortran --version
GNU Fortran (GCC) 4.7.0 20110419 (experimental) [trunk revision 170140]
Copyright (C) 2011 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING


c:\_mikrom\Work\gfortran_test>gfortran complex_function.f95 -o complex_function

c:\_mikrom\Work\gfortran_test>strip.exe --strip-all complex_function.exe -o comp
lex_function_strip.exe

c:\_mikrom\Work\gfortran_test>dir complex_function*.exe
 Volume in drive C has no label.
 Volume Serial Number is A896-048B

 Directory of c:\_mikrom\Work\gfortran_test

11. 08. 2011  07:48            36 157 complex_function.exe
11. 08. 2011  07:48            [highlight]13 838[/highlight] complex_function_strip.exe
               2 File(s)         49 995 bytes
               0 Dir(s)  928 629 133 312 bytes free

c:\_mikrom\Work\gfortran_test>
 
I didn't explain it well, strip does the same, I'm quite sure the strip.exe didn't change.

What did change is the executable coming from gfortran. In version 4.6 strip.exe was needed to reduce the size of the compiled a.exe, so to say, while using gfortran 4.7, a.exe already seems stripped when coming from the compiler, so strip.exe is not needed.

To me, it seems that something changed in the standard gfortran settings and I wonder what the switch is to include or exclude debug info in your exe.
 
Don't understand what you mean ...
as I showed above the original compiled binary
complex_function.exe has 36 157 bytes,
but the stripped complex_function_strip.exe has only 13 838 bytes
 
Either 4.7 produces stripped exes directly (which is what I supposed possible wrong), either 4.7 leaves out some debug info with respect to 4.6. For the same compiler options (-O3 and -Wall and -fbounds-check, I don't use more) gfortan 4.6 produces an exe that is three times as large as the one 4.7 produces. If the difference is not in being stripped or not, it must be in something else.
 
I think I know what's happening, and it has to do with static vs shared gfortran/gcc libraries.

In older versions of gfortran, by default, it would use static libraries, where every executable had all of the necessary gfortran binaries packed into the executable. The new version -- from what I've seen -- appears to link to the shared library by default.

An easy way to test this is by running one of 4.7's small executables on a machine without gfortran installed. If it doesn't run, that's the issue. So, while the executable is smaller, it's not properly standalone.

You can fiddle around with the flags -static-libgcc -static-libgfortran vs. -shared-libgcc -shared-libgfortran

I could, of course, be entirely wrong, but this is an issue I encountered not too long ago when I installed a newer version of gfortran.

--------------------------------------
Background: Chemical engineer, familiar mostly with MATLAB, but now branching out into real programming.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top