Results 1 to 4 of 4

Thread: How to reduce Lazarus 0.9.30 project exe file size?

  1. #1

    How to reduce Lazarus 0.9.30 project exe file size?

    Hi all,
    I have a Lazarus project that I converted over from Delphi automatically (pas2c64) and it is produce a huge .exe file!!

    It only uses 1 form (with 2 SynEdit components, 2 groupbox, 1 splitter, and two buttons) and some custom units, but the .exe file is 17.9MB in size....WTF!?!

    I am sure that I have turned on smart-linking and optimization to make it smaller, not faster, but to no avail

    Any ideas?

    I am wondering if I might have to create a new project manually and copy over the used units, etc. from my current one to see if it shrinks down?

    cheers,
    Paul

  2. #2
    Quote Originally Posted by paul_nicholls View Post
    Hi all,
    I have a Lazarus project that I converted over from Delphi automatically (pas2c64) and it is produce a huge .exe file!!

    It only uses 1 form (with 2 SynEdit components, 2 groupbox, 1 splitter, and two buttons) and some custom units, but the .exe file is 17.9MB in size....WTF!?!

    I am sure that I have turned on smart-linking and optimization to make it smaller, not faster, but to no avail

    Any ideas?

    I am wondering if I might have to create a new project manually and copy over the used units, etc. from my current one to see if it shrinks down?

    cheers,
    Paul
    If you are ready to create a release build of your application:
    Go to Project -> Project Options
    Under Compiler Options / Linking -> check -Xs
    Under Compiler Options / Code Generation you may want to check Level 3 optimizations

    The executables are big due to the debugging information, so I say only check -Xs when you are ready to release or you'll have a hard time debugging. Even after this step, your executables will be significantly larger with Lazarus than Delphi and many other languages, but that is the nature of the beast. 1-4MB sure beats 17MB though. (On Windows you could also look into using UPX, but many virus scanners seem to detect UPX'd executables as potential viruses)

    (Also under linking if you have other debugging related options set, such as -g you might want to remove them as well. I haven't done a lot of testing with it though [as to whether or not strip will remove them as well])

    In related news, the stripping is its own executable which you can use without Lazarus, should the need arise
    Last edited by dazappa; 16-06-2011 at 04:28 AM.

  3. #3
    ...and Under Compiler Options / Linking -> uncheck -gl

  4. #4
    Thanks guys

    I will see how I go...I'm not ready to do a release build yet, but I will note the info

    cheers,
    Paul

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
  •