Exe size

classic Classic list List threaded Threaded
35 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Exe size

Paul-370

I'm testing with FPC/Lazrus on Windows now, but a simple program results in
11.5 MB size.
I have enabled -Xs, -CX, -Og, -O2 in the project->compiler options
(Lazarus), but the size is still the same.
Anything else I should do?

Paul

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Michael Fuchs-5
Paul schrieb:
> I'm testing with FPC/Lazrus on Windows now, but a simple program results
> in 11.5 MB size.
> I have enabled -Xs, -CX, -Og, -O2 in the project->compiler options
> (Lazarus), but the size is still the same.
> Anything else I should do?

Use
        strip --strip-all $PROGRAMNAME.exe
after the compiling.

mfg
Michael
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Michael Fuchs-6
Michael Fuchs schrieb:

>> I'm testing with FPC/Lazrus on Windows now, but a simple program
>> results in 11.5 MB size.
>> I have enabled -Xs, -CX, -Og, -O2 in the project->compiler options
>> (Lazarus), but the size is still the same.
>> Anything else I should do?
>
> Use
>     strip --strip-all $PROGRAMNAME.exe
> after the compiling.

And if you want to shrink it more, try UPX.
http://upx.sourceforge.net/

mfg
Michael
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Michael Fuchs-5
In reply to this post by Michael Fuchs-5
Michael Fuchs schrieb:

 >> I'm testing with FPC/Lazrus on Windows now, but a simple program
results in 11.5 MB size.
 >> I have enabled -Xs, -CX, -Og, -O2 in the project->compiler options
(Lazarus), but the size is still the same.
 >> Anything else I should do?
 >
 > Use
 >     strip --strip-all $PROGRAMNAME.exe
 > after the compiling.

And if you want to shrink it more, try UPX.
http://upx.sourceforge.net/

mfg
Michael

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Paul-370
In reply to this post by Michael Fuchs-6
I've read that, but isn't it suppose to work within the ide instead of
always start the cmd prompt and type in this ?
(or use a batch)
Will this work for WinCE also, cause this what I actually want to do?

Paul


----- Original Message -----
From: "Michael Fuchs" <[hidden email]>
To: "FPC-Pascal users discussions" <[hidden email]>
Sent: Thursday, September 04, 2008 3:07 PM
Subject: Re: [fpc-pascal] Exe size


> Michael Fuchs schrieb:
>
>>> I'm testing with FPC/Lazrus on Windows now, but a simple program results
>>> in 11.5 MB size.
>>> I have enabled -Xs, -CX, -Og, -O2 in the project->compiler options
>>> (Lazarus), but the size is still the same.
>>> Anything else I should do?
>>
>> Use
>>     strip --strip-all $PROGRAMNAME.exe
>> after the compiling.
>
> And if you want to shrink it more, try UPX.
> http://upx.sourceforge.net/
>
> mfg
> Michael
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Michael Fuchs-5
Paul schrieb:
> I've read that, but isn't it suppose to work within the ide instead of
> always start the cmd prompt and type in this ?
> (or use a batch)

Project -> Compilersettings -> [Last Tab] -> Execute after
(I hope this is right, i've only the german version here).

> Will this work for WinCE also, cause this what I actually want to do?

Don't know.

hth
Michael
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Paul-370
I have to use:

C:\FPC\2.2.2\bin\i386-win32\strip.exe --strip-all
D:\FreePascal\Projects\Test\Project1.exe,
anything else fails.

In my Dutch version here, after compling is on the top position in that
compiler tab which is in fact before compling
Probably a translation bug.

After compling, I got "Oeps - debugger crash".

Ayway, the size was still 1116 kb for and empty program (button and a label)
and the limit for my full program (Delphi) is 1 Mb
There's still a long way to go ..
For Windows, it's not a problem (Delphi program), but I want it for WinCE
and I have the same restrictions there.


Paul



----- Original Message -----
From: "Michael Fuchs" <[hidden email]>
To: "FPC-Pascal users discussions" <[hidden email]>
Sent: Thursday, September 04, 2008 3:20 PM
Subject: Re: [fpc-pascal] Exe size


> Paul schrieb:
>> I've read that, but isn't it suppose to work within the ide instead of
>> always start the cmd prompt and type in this ?
>> (or use a batch)
>
> Project -> Compilersettings -> [Last Tab] -> Execute after
> (I hope this is right, i've only the german version here).
>
>> Will this work for WinCE also, cause this what I actually want to do?
>
> Don't know.
>
> hth
> Michael
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Florian Klämpfl
Paul schrieb:

> I have to use:
>
> C:\FPC\2.2.2\bin\i386-win32\strip.exe --strip-all
> D:\FreePascal\Projects\Test\Project1.exe,
> anything else fails.
>
> In my Dutch version here, after compling is on the top position in that
> compiler tab which is in fact before compling
> Probably a translation bug.
>
> After compling, I got "Oeps - debugger crash".
>
> Ayway, the size was still 1116 kb for and empty program (button and a
> label) and the limit for my full program (Delphi) is 1 Mb

So you get a 2 MB if you add two buttons and labels?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Vincent Snijders
In reply to this post by Paul-370
Paul schreef:

> I have to use:
>
> C:\FPC\2.2.2\bin\i386-win32\strip.exe --strip-all
> D:\FreePascal\Projects\Test\Project1.exe,
> anything else fails.
>
> In my Dutch version here, after compling is on the top position in that
> compiler tab which is in fact before compling
> Probably a translation bug.
>
> After compling, I got "Oeps - debugger crash".
>
> Ayway, the size was still 1116 kb for and empty program (button and a
> label) and the limit for my full program (Delphi) is 1 Mb
> There's still a long way to go ..

This won't get smaller unless you use UPX. So maybe you need to search
another tool or framework (KOL) if you want smaller size.

> For Windows, it's not a problem (Delphi program), but I want it for
> WinCE and I have the same restrictions there.
>

You cannot have both: a small size without debug info *and* a working
debugger.

So you have to make up your mind:
A: an executable that can be started with the debugger: enable the
debugging options (-g or -gl) and disable stripping (-Xs) in the linking
tab

or

B: an executable that has a small size and can be released: disable all
debugging options (-g, -gl, -gh) and enable string (-Xs) in the linking tab.

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Paul-370
In reply to this post by Florian Klämpfl
Actually 1,16 MMb with  1 button and 1 label and a debugger crash as a bonus
:-)

Paul


----- Original Message -----
From: "Florian Klaempfl" <[hidden email]>
To: "FPC-Pascal users discussions" <[hidden email]>
Sent: Thursday, September 04, 2008 4:39 PM
Subject: Re: [fpc-pascal] Exe size


> Paul schrieb:
>> I have to use:
>>
>> C:\FPC\2.2.2\bin\i386-win32\strip.exe --strip-all
>> D:\FreePascal\Projects\Test\Project1.exe,
>> anything else fails.
>>
>> In my Dutch version here, after compling is on the top position in that
>> compiler tab which is in fact before compling
>> Probably a translation bug.
>>
>> After compling, I got "Oeps - debugger crash".
>>
>> Ayway, the size was still 1116 kb for and empty program (button and a
>> label) and the limit for my full program (Delphi) is 1 Mb
>
> So you get a 2 MB if you add two buttons and labels?
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Vladimir Zhirov-2
In reply to this post by Paul-370
Paul wrote:
> I'm testing with FPC/Lazrus on Windows now, but a simple program results in
> 11.5 MB size.
> I have enabled -Xs, -CX, -Og, -O2 in the project->compiler options
> (Lazarus), but the size is still the same.
> Anything else I should do?

Yes, you should also disable -gl option (Display Line Numbers in
Run-time Error Backtraces). This will give the most tangible size
reduction compared to the options you have enabled.

--
Vladimir

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Marco van de Voort
In reply to this post by Paul-370
In our previous episode, Paul said:
> Actually 1,16 MMb with  1 button and 1 label :-)

http://wiki.freepascal.org/Size_Matters

Pretty normal for a lazarus app. If you want minimal size, see the winapi
demo in the examples.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Paul-370
In reply to this post by Vincent Snijders
> You cannot have both: a small size without debug info *and* a working
> debugger.

I do not need a working debugger.

> B: an executable that has a small size and can be released: disable all
> debugging options (-g, -gl, -gh) and enable string (-Xs) in the linking
> tab.

I've done that and also (-Og, -O2 ), same result (also the debugger crash)

Paul

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Vincent Snijders
Paul schreef:

>> You cannot have both: a small size without debug info *and* a working
>> debugger.
>
> I do not need a working debugger.
>
>> B: an executable that has a small size and can be released: disable
>> all debugging options (-g, -gl, -gh) and enable string (-Xs) in the
>> linking tab.
>
> I've done that and also (-Og, -O2 ), same result (also the debugger crash)

OK, you have a small size and a debuger crash. The debugger crash is ok,
because you "do not need a working debugger".

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Paul-370
In reply to this post by Marco van de Voort
> http://wiki.freepascal.org/Size_Matters
>
> Pretty normal for a lazarus app. If you want minimal size, see the winapi
> demo in the examples.

I have this doc printed and it wont be a problen on Windows for which I have
the Delphi program.
I have not installed the WinCe version or crosscompiler, but it's the same
there: if the size is always the same, I can't use FPC/Lazarus.

UPX is not an option, because our package is already packed with the exe,
dll's and other files and the package has to be < 1Mb
To have this, the program itself can have a max size of 1 MB.


Paul

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Paul-370
In reply to this post by Vincent Snijders

----- Original Message -----
From: "Vincent Snijders" <[hidden email]>
> OK, you have a small size and a debuger crash. The debugger crash is ok,
> because you "do not need a working debugger".
>
Indeed, only needed for testing but annoying though

Paul
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Graeme Geldenhuys-2
In reply to this post by Marco van de Voort
On 9/4/08, Marco van de Voort <[hidden email]> wrote:
> In our previous episode, Paul said:
>  > Actually 1,16 MMb with  1 button and 1 label :-)
>
>  http://wiki.freepascal.org/Size_Matters
>
>  Pretty normal for a lazarus app. If you want minimal size, see the winapi
>  demo in the examples.

Alternatively, write your WinCE program in pure assembly language.
You should get fully function GUI apps at around 20-60 Kbytes.  :-)

Gibson Research has a template setup for you:
  http://www.grc.com/freepopular.htm

or for a more direct link
  http://www.grc.com/smgassembly.htm



Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Paul-370

----- Original Message -----
From: "Graeme Geldenhuys" <[hidden email]>
>
> Alternatively, write your WinCE program in pure assembly language.
> You should get fully function GUI apps at around 20-60 Kbytes.  :-)
>
LOL, I don't think so: my Delphi program has only very basic GUI (fi chat)
which is rarely used, it's mostly running without GUI,
It has a pretty lage source code

Paul

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Paul-370

If I understand correcly, it's the lcl that adds a huge part to the exe.
Since I only use 1 small form, I could create it with api calls.
But FPC for WinCE uses a crosscompiler, how do I have to implement this ?
Are Windows api calls translated to ARM-calls ?

Paul
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Exe size

Leonardo M. Ramé
Take a look at http://wiki.freepascal.org/KOL-CE, this project was specially started to create a "framework" for creating very small .exe applications using Delphi and FPC.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Thu, 9/4/08, Paul <[hidden email]> wrote:

> From: Paul <[hidden email]>
> Subject: Re: [fpc-pascal] Exe size
> To: "FPC-Pascal users discussions" <[hidden email]>
> Date: Thursday, September 4, 2008, 4:03 PM
> If I understand correcly, it's the lcl that adds a huge
> part to the exe.
> Since I only use 1 small form, I could create it with api
> calls.
> But FPC for WinCE uses a crosscompiler, how do I have to
> implement this ?
> Are Windows api calls translated to ARM-calls ?
>
> Paul
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
12