Fatal error "Executable image size is too big for wince target" lazarus / 35-Windows CE ---------------------------------------------------------------------- DRIGUS · 2011-04-27 13:50 Hi *.*.   We need some advice with the above mentioned error.   We run into this problem with our largest Windows CE application after adding a new, very simple dialog. Even if we only added it to the uses statement - the compiler gave us the hint "unit not used" - we got this error. Of course we adapted the settings in order to minimize the exe size. Normally we use the following settings:   -CX   -O1   -g   -gl   -Xs   -Xg   Compiling the project without the additional dialog we receive the following file sizes:   *.dbg  29.732 k   *.exe  4.870 k   In order to compile the project with the new dialog we removed -g and -gl and got the following file sizes:   *.dbg  12.670 k   *.exe  4.864 k   Of course we are not able to debug it anymore.   I can't believe that the size of the exe is the problem. Perhaps a resource limit? It also compiled well with -g and -gl when we replace an older dialog with the new one. So the problem couldn't be related to this specific dialog. Edited: Lazarus 0.9.31 r30406 FPC 2.4.3 i386-win32-win32/win64 Greetings ---------------------------------------------------------------------- felipemdc · 2011-04-27 15:04 Have you already tried to use arm-wince-strip.exe --strip-all ? Does it make the executable smaller? ---------------------------------------------------------------------- DRIGUS · 2011-04-27 15:08 Hi Felipe.   There is no chance to run strip because the linker doesn't produce an exe . The mentioned error message appears while linking in the IDE.   Edited: While using Google I found the following fpc linker message, but no further info:  http://www.freepascal.org/docs- html/user/userse68.html Greetings ---------------------------------------------------------------------- felipemdc · 2011-04-27 15:31 Aha, I thought that it was an error when running the application ... Very wierd. Free Pascal simply packages the GNU Linker and GNU Assembler and uses that. I can think of a couple of possibilities: 1> The most probably one: The linker is too old and contain some kind of obsolete limitation. The fix would be obtaining a new GNU Linker for wince and use that instead. 2> You need to use a special option of the linker ... one would need to type in the command line arm-wince-ld.exe and read the possible options of how to use it. 3> A real OS limitation, although I doubt it. ---------------------------------------------------------------------- felipemdc · 2011-04-27 15:33 Aha, that's a message from the internal linker ... I never knew we had one for wince ... Try using the option -Xe which should force the external linker to be used. ---------------------------------------------------------------------- DRIGUS · 2011-04-27 15:46 Hi Felipe.   That doesn't seems to work:   C:\Programme\lazarus\fpc\2.4.3\bin\i386-win32\arm-wince-ld.exe: unrecognised emulation mode: arm_wince_pe   Supported emulations: armpe   Project1.lpr(18,43) Error: Error while linking Greetings ---------------------------------------------------------------------- felipemdc · 2011-04-27 15:58 Then try to call arm-wince-ld.exe manually to execute the link process. I suppose that the object files are assembled, correct? It should be something like: C:\Programme\lazarus\fpc\2.4.3\bin\i386-win32\arm-wince-ld.exe -o myprogram.exe C:\Programme\myprogram\*.o If you run FPC with -s and -Xe it should create a batch script which shows how FPC is calling the linker, then you can copy the options. ---------------------------------------------------------------------- DRIGUS · 2011-04-28 08:31 I tried   C:\Programme\lazarus\fpc\2.4.3\bin\i386-win32\arm-wince-ld.exe -m armpe      --gc-sections  -s --subsystem wince --entry=_WinMainCRTStartup    -o     ...   which seems to work - no error message. The produced exe is nearly twice large.   But the compiled exe does nothing when opening on the Windows CE 6.0 device. I found the line   arm-wince-postw32.exe --subsystem gui --input ... --stack 262144    in the batch file right after calling the linker, but I can't find arm-wince-postw32.exe on my system. Therefore I tried postw32.exe but without luck. Greetings ---------------------------------------------------------------------- felipemdc · 2011-04-29 08:46 Umm, it should be better to try first with a hello world project. Try linking a hello world project manually and see if it runs correctly. Also it might be better to take the discussion to the fpc-devel mailling list where FPC developers are more active. ---------------------------------------------------------------------- kamischi · 2011-05-05 11:01 Re: armpe vs arm-wince-pe I asked for the change from armpe to arm-wince-peAs bevause this has been changed in the binutils about 3 years ago. Maybe getting recent binutils might be a good idea. MiSchi