Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-12

How to strip debug symbols from exe file?

11 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

I usually program with Lazarus on a Linux platform and with Delphi on Windows.
But now I am working on a Lazarus 1.8.0/fpc3.0.4 IDE to make a crossplatform program.

On Linux I am used to do "strip -s filename" on the resulting executable to bring it down to a sensible size.
But on Windows 7, what can I do?

My little command line program (no GUI stuff at all) is bloated up to 7.7 Mbytes even though I have barely started work on it. I realized this when the svn import took such a long time...

Bo Berglund Developer in Sweden

Reply by email

Michael Van Canneyt
to Bo Berglund
Bo Berglund wrote 8 lines
I usually program with Lazarus on a Linux platform and with Delphi on Windows. But now I am working on a Lazarus 1.8.0/fpc3.0.4 IDE to make a crossplatform program. On Linux I am used to do "strip -s filename" on the resulting executable to bring it down to a sensible size. But on Windows 7, what can I do?

You can do exactly the same. FPC is distributed with a strip binary.

Michael.

Reply by email

Juha Manninen
to Bo Berglund: I usually program with Lazarus on a Linux platform and with Delphi on Windows. But now I…
Bo Berglund wrote
My little command line program (no GUI stuff at all) is bloated up to 7.7 Mbytes even though I have barely started work on it.

I believe there is debug info included.
If you compile with optimization and without debug info, the binary will have sensible size. No strip is needed then.

I realized this when the svn import took such a long time...

How is svn import related to compiled binary size? Do you store the executable binary in revision control? You should not.

Juha

Reply by email

Bo Berglund
to Michael Van Canneyt: You can do exactly the same. FPC is distributed with a strip binary. Michael.
Michael Van Canneyt wrote 6 lines
> On Linux I am used to do "strip -s filename" on the resulting > executable to bring it down to a sensible size. > But on Windows 7, what can I do? You can do exactly the same. FPC is distributed with a strip binary.

Thanks, I did not know it was an fpc utility, I believed it was something that came with Linux...
However the fpc install is not on path so I had to do this:

C:\Programs\lazarus1.8\fpc\3.0.4\bin\x86_64-win64\strip -s SvnMailer.exe

Brought it down from 7.7M to 1.4M, pretty much. :)

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Juha Manninen: On Sat, Dec 30, 2017 at 1:07 PM, Bo Berglund via Lazarus I believe there is debug info…
Juha Manninen wrote
How is svn import related to compiled binary size?

Because the server I use is located in Austin, Tx and I am in Sweden. Have to use a VPN, which is not fast at all.

Do you store the executable binary in revision control? You should not.

We always store binary output in version control so the exact binary used by a customer can be retrieved when looking for problems. But we only do this on released versions.
However, I just imported the program to the new Subversion server I have set up as a replacement for CVS and then I wanted to mar it as part of the project.

Bo Berglund Developer in Sweden

Reply by email

Sven Barth
to Bo Berglund: On Sat, 30 Dec 2017 12:14:43 +0100 (CET), Michael Van Canneyt via Thanks, I did not know…

Am 30.12.2017 12:50 schrieb "Bo Berglund via Lazarus" <

:
Michael Van Canneyt wrote 6 lines
> On Linux I am used to do "strip -s filename" on the resulting > executable to bring it down to a sensible size. > But on Windows 7, what can I do? You can do exactly the same. FPC is distributed with a strip binary.

Thanks, I did not know it was an fpc utility, I believed it was something that came with Linux...

It's indeed something that's provided by Linux distributions, but on Windows we provide that and some other tools as well.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171230/11a392d6/attachment.html>

Reply by email

Graeme Geldenhuys
to coppolastudio: An HTML attachment was scrubbed... URL: <http://lists.lazarus-ide.org/pipermail/lazarus/at…
coppolastudio wrote
furthermore you can pack the executable with upx

That shouldn't be needed if debugging information is excluded from the executable. Also from what I remember (years back), Windows anti-virus software hated UPX compressed executables - giving tons of false positives.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Kostas Michalopoulos
to coppolastudio

UPX compressed executables need more memory since normally the OS will load code pages on demand and only code that is actually executed is loaded from the executable, whereas UPX forces the entire executable to be in memory. Moreover UPX prevents the OS to share the code between different instances of the program - that means if you run a 10MB program twice, with UPX you'll use 20MB whereas without UPX you'll only use 10MB. Similarly the OS can cache the executable between runs, so by UPXing it you lose that too.

There isn't really much of a reason to compress executables nowadays, the idea is a relic from the days of floppy disks and sub-GB hard drives. Today they actually do more harm than good and only give a fake feel of compactness.

There is only one case where they might be justified and this is downloading the executable by itself off the Internet. This can save bandwidth with UPX's --lzma compression (at the cost of memory) but this is of marginal worth and only if you are distribution a single executable without any other files. In any other case you are better off compressing the entire program and its data files in a solid archive like .7z or .tar.xz or with a setup program that support LZMA compression. This will actually create smaller files for download.

On Sun, Dec 31, 2017 at 11:08 AM, coppolastudio via Lazarus <

Show quoted text 38 lines
wrote: upx zip the executable. about false positves I never got this troubles with my few files and free av like Avira or AVG, regards Inviato tramite il client di Posta WPS Il Graeme Geldenhuys via Lazarus , 30/dic/2017 08:28 PM ha scritto: On 2017-12-30 15:16, coppolastudio via Lazarus wrote: > furthermore you can pack the executable with upx That shouldn't be needed if debugging information is excluded from the executable. Also from what I remember (years back), Windows anti-virus software hated UPX compressed executables - giving tons of false positives. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -- _______________________________________________ Lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus -- _______________________________________________ Lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171231/7616ac78/attachment.html>

Reply by email