Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 36

Thread: How to reduce FreePascal and Lazarus Exe Size...

  1. #21

    How to reduce FreePascal and Lazarus Exe Size...

    The only lesson from these stories is that perhaps default settings should change. Disable debugging info so people can no longer debug and enable smartlinking so you need to wait longer for your compiler.... But I'm sure we'll get complaints that the debugger doesn't work then.
    I would use this for releases, not development copies. I don't care how big something is when I'm debugging it.

    Exactly what are you using to "strip" the exe? I know for Windows you can remove the "reloc" section, but that only gives a 5% drop in size. Or thereabouts.

    And I wasn't saying that you were talking BS, I was just asking for it to be posted. Not source or the like, since I uninstalled FPC, but the process.

  2. #22

    How to reduce FreePascal and Lazarus Exe Size...

    Quote Originally Posted by dmantione
    Howto for small Hello World:

    * Install Free Pascal 2.0.2
    * Start up the IDE.
    * [pascal]program hello;
    begin
    writeln('Hello world');
    end.[/pascal]
    * Select options->mode->release.
    * Compiler.
    * I have a file that is 133 kb.
    * Go to Dos prompt.
    * 'strip hello.exe'
    * A have a file that is 28 kb.
    How to for Lazarus will follow later. Don't know yet if it will be Linux or Windows, but with the hand on my heart: there is no difference.
    And you posted this because [...] ?

    When you are developing an LCL application in Lazarus/FPC, the generated EXE (Win32) size is surprisingly big, especially if the application itself is rather simple (button + edit box). Of course, you enable smartlinking, strip all debug information and after all the effort, you get an application that is around 1 Megabyte big. Now am I making sense here?

    Basically, with a lot of effort, you get an oversized application when compared to its Delphi counterpart. If you find a way to create smaller LCL applications - please post it. Just don't go again for Linux-based apps as you continuously do, since Delphi and any other Win32 executable won't run there, unless you use WINE, as Savage said.

  3. #23

    How to reduce FreePascal and Lazarus Exe Size...

    Quote Originally Posted by Lifepower
    And you posted this because [...] ?
    Someone asked for it.... Free Pascal developers are helpfull.

    [quote="Lifepower"]
    When you are developing an LCL application in Lazarus/FPC, the generated EXE (Win32) size is surprisingly big, especially if the application itself is rather simple (button + edit box). Of course, you enable smart]

    You were claiming that FPC generates multi-megabyte executables. I said that is due to inexperience of you. I was right, because we're now talking about 1 megabyte.

    When you want to compare executable sizes you must configure the compiler into a configuration suitable for release exes. Otherwise no comparison is possible. That is true for any compiler. You should know that, if you don't that is lack of knowledge on your side.

    You cannot claim FPC is usuable because it generates multi-megabyte executables. You can claim Delphi has an advantage here because a 400k executable is smaller than the 1014k executable from Lazarus, that is telling the truth. You can go smaller by changing the optimalisation options and recompile the FCL/LCL, propably to around 900k, but that is irrelevant for the matter.

    Quote Originally Posted by Lifepower
    Basically, with a lot of effort, you get an oversized application when compared to its Delphi counterpart. If you find a way to create smaller LCL applications - please post it. Just don't go again for Linux-based apps as you continuously do, since Delphi and any other Win32 executable won't run there, unless you use WINE, as Savage said.
    That is stupborn. If I say the in size between Linux and Windows is nihil, then it is so. Compile the MSGUI app I gave you, the exe is as big as on Windows. Indeed, Delphi applications don't run under Linux, but you are reversing it: That is a problem for Delphi, not for FPC.

    Lastly, the LCL is has little to do with games. This site is about games. It would be more appropriate to compare the sizes of JEDI-SDL applications.

  4. #24

    How to reduce FreePascal and Lazarus Exe Size...

    Quote Originally Posted by dmantione
    When you want to compare executable sizes you must configure the compiler into a configuration suitable for release exes. Otherwise no comparison is possible. That is true for any compiler. You should know that, if you don't that is lack of knowledge on your side.
    Actually, making such great claim about all compilers only shows YOUR inexperience and lack of maturity in the matter.

    Quote Originally Posted by dmantione
    That is stupborn. If I say the in size between Linux and Windows is nihil, then it is so.
    My grandmother says that she is ill because someone has put an evil eye on her. When I asked why, she said: "Don't ask stupid questions. If I say I'm ill because someone has put an evil eye on me, then it is so!" Dude, we have a problem! :lol:

    Quote Originally Posted by dmantione
    Indeed, Delphi applications don't run under Linux, but you are reversing it: That is a problem for Delphi, not for FPC.
    "My piece of pie is not bad! Your piece of pie is better, but it's your problem!" -> from a humour show. I guess there is nothing to discuss here.

    Quote Originally Posted by dmantione
    Lastly, the LCL is has little to do with games. This site is about games. It would be more appropriate to compare the sizes of JEDI-SDL applications.
    First, if LCL has little to do with games, then please tell me, how in earth are you going to make a map/scenario editor without making user-interface? Second, the fact that this site is about developing games has nothing to do with LCL, so *this* looks more like a "nonsense" to me.

  5. #25

    How to reduce FreePascal and Lazarus Exe Size...

    Last time I tried Lazarus on a linux comp, i got a 11 Megabyte hello world form (on fedora core 4, latest version of fpc and lazarus, 2 month ago).

    Maybe there is some cool options to decrease it, but they weren't obvious for me at this time.

    @ Lifepower : the reason you get such big exe (in delphi and lazarus) is, for what I understand, the VCl (and it's lazarus version). It's like a "delphi framework" your exe get with them. It's the same for every language with such runtimes, Visual basic has it's runtimes, .net has it's framework.
    The point is that delphi's application always include them into the exe, but yo ucan, into the option, select to use the package out of the exe, and then you have a small exe but you must provide the corresponding .bpl (delphi give you the list).
    It's just like having to give VB runtimes with your application, or the .net framework.
    It's even better if you plan to update it, as you won't have to update a big exe but rather a small one (as i don't think you will be updating borland's vcl package ).

    What we may see has a disadvantage right now is in fact an advantage for delphi, as your program are released to work without any other installation (wich VB didn't support with his first version [i think the latest support it], and wich .net support only with some obfuscators like xenocode wich adds the framework to your exe, and belive me then the delphi exe looks like smalls ones).

    Hope i made it clearer.

  6. #26

    How to reduce FreePascal and Lazarus Exe Size...

    Quote Originally Posted by dmantione
    How to for Lazarus will follow later.
    I'm still kean to see the Lazarus version.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  7. #27

    How to reduce FreePascal and Lazarus Exe Size...

    Lifepower,

    I think the trouble started in your first post in this thread when you wrote:

    Quote Originally Posted by Lifepower
    Few days ago I checked the latest version of Free Pascal, but it's still not as half as good as Delphi. In fact, I disliked Delphi for creating large EXEs (~400 Kb; KOL can be a nice alternative though), but when I saw FreePascal's empty application take several megabytes :shock:
    The thing is that an empty FreePascal application is not "several megabytes" but only about 20KB, as dmantione said. What you meant to say, which you subsequently made clear, was that an empty-window Lazarus application took up several MB. In light of this, perhaps you will understand the vigorousness of dmantione's initial response. He wanted to disabuse uninformed folk of the notion that empty FreePascal applications take up several megabytes. I'll just add that I have no desire to defend any subsequent posts by dmantione or anyone else.

    As to the question of the size of empty-window Lazarus applications, I haven't been able to get it under 2MB (in Linux), but then I haven't really looked very closely at the matter. One thing I think I'm right about: the relatively large size of Lazarus executables is entirely due to Lazarus, and has nothing to do with FreePascal.
    [size=10px]&quot;In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it&#39;s the exact opposite.&quot; -- Paul Dirac[/size]

  8. #28

    How to reduce FreePascal and Lazarus Exe Size...

    Quote Originally Posted by savage
    I'm still kean to see the Lazarus version.
    * Make a project.
    * Go to compiler options
    * Enable the two smartlinking options (there are 2 of them, one to generate smartlinkable code, one to actually smartlink it).
    * Compile
    * Strip the exe

    If you want to recompile the LCL for size the easiest way is to remove the lcl/units directory. Then add the source code directories and the include directory of the lcl to the compiler search paths. Modify the compiler options (register variables, optimize for size and perhaps others) I got 965 kb. It should be possible to do the same with the FCL.

  9. #29

    How to reduce FreePascal and Lazarus Exe Size...

    Quote Originally Posted by lepidosteus
    @ Lifepower : the reason you get such big exe (in delphi and lazarus) is, for what I understand, the VCl (and it's lazarus version). It's like a "delphi framework" your exe get with them. It's the same for every language with such runtimes, Visual basic has it's runtimes, .net has it's framework.
    Yes. The problem with object oriented frameworks is that the virtual method tables of objects always depend on all virtual methods, i.e. if you use an object, all of its virtual methods are included in the exe; with normal dependency analysis (which is what both Delphi and FPC do) the linker has no way to remove them. This is the reason why most OOP frameworks are reasonably large, i.e. Borland's VCL, Trolltech's QT, Microsoft's Foundation Classes are all huge. Some frameworks hide their code in DLL's, but the code is there.

    Expect some compiler tricks in the future. But do not expect that the compiler can vapourize the exes: the right way is to shrink the libraries.

  10. #30

    How to reduce FreePascal and Lazarus Exe Size...

    There's a sticky post I pasted on the FreePascal forum before the Lazarus forum was even opened, and it nicely tells you all you need to do to get minimal executable filesizes.

    I could tell you people to RTFM instead I'm going to flame you to hell so get ready.

    1. You didn't RTFM
    2. If you like delphi more, use delphi
    3. If you want integrated debugger support, use delphi
    4. If you want to help, write patches

    Unlike with Delphi or Kylix you can actualy try to help and provide enhancments and bugfixes for the compiler itself as well as various libraries. Whining about big filesizes or whatever other useless and completly irrelevant little itch you got right now is only going to keep people who actualy DO something from doing it.
    Feel the power of Open Source.
    <br />Feel the power of Free Pascal.

Page 3 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •