www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Building GtkD app on Win32 results in 111 MiB file mostly from zeroes

reply Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
AFAIK GtkD is the only mature crossplatform GUI for D. So the question 
is: 111 MiB *.exe file mostly from zeroes is good/acceptable? Is it a 
bug or it's how dmd2+OPTLINK works? It looks like dmd1 hasn't this issue.

Files (dmd 2.054 compiled) are here:
http://deoma-cmd.ru/files/other/huge-build.zip
Aug 04 2011
next sibling parent reply "Marco Leise" <Marco.Leise gmx.de> writes:
Am 04.08.2011, 11:07 Uhr, schrieb Denis Shelomovskij  
<verylonglogin.reg gmail.com>:

 AFAIK GtkD is the only mature crossplatform GUI for D. So the question  
 is: 111 MiB *.exe file mostly from zeroes is good/acceptable? Is it a  
 bug or it's how dmd2+OPTLINK works? It looks like dmd1 hasn't this issue.

 Files (dmd 2.054 compiled) are here:
 http://deoma-cmd.ru/files/other/huge-build.zip

I don't know who helped me with a similar problem once, but in my case I was compiling code that contained classes with large static arrays. As I understood it, their .init blob was making up most of my file. A GtkD application I wrote on Linux 32-bit varies in size (depending on compile/link options) from several 100 KB to a few MB. If noone else knows from the top of their head what is happening, could you post your compile and link options including dmd.conf. That way someone on Windows is able to check and probably find differences in the setup. Also, what size are the compiled .o files before linking? If the object files are small, but the executable are large I would suspect you compile against GtkD statically to avoid shipping Gtk and GtkD with your application. Could you double check that the linker options for DMD1 and DMD2 stayed the same?
Aug 04 2011
parent reply Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
I use dmd with default configuration.

Files from huge-build.zip:

zeroCount.exe: counts zero bytes

main.d:
module main;
import gtk.Main;
void main(string[] args) {
     Main.init(args);
}

doCompile.bat:
dmd -c -release -IgtkD-1.4.1-release\headers main.d

doLink.bat:
link 
main,"testGtkD.exe",,"gtkD-1.4.1-release\library.lib"+user32+kernel32/noi;


library.lib:  Zero bytes:   3_505_980 of  16_175_616 (21.67%)
main.obj:     Zero bytes:         248 of         832 (29.81%)
testGtkD.exe: Zero bytes: 115_666_207 of 116_759_068 (99.06%)
Aug 04 2011
parent reply Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
04.08.2011 15:33, Trass3r пишет:
 doCompile.bat:
 dmd -c -release -IgtkD-1.4.1-release\headers main.d

 doLink.bat:
 link
 main,"testGtkD.exe",,"gtkD-1.4.1-release\library.lib"+user32+kernel32/noi;

Don't invoke optlink directly like that. Just use something like 'dmd -release main.obj gtkD-1.4.1-release\library.lib -oftestGtkD' for linking. (though I don't know why you separate compilation and linking here, a simple 'dmd -release main.d gtkD-1.4.1-release\library.lib -oftestGtkD' is enough)

I did it just to make it simpler. dmd -oftestGtkD.exe -release -IgtkD-1.4.1-release\headers main.d gtkD-1.4.1-release\library.lib Gives the same result.
Aug 04 2011
parent Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
04.08.2011 17:57, Trass3r пишет:
 dmd -oftestGtkD.exe -release -IgtkD-1.4.1-release\headers main.d
 gtkD-1.4.1-release\library.lib

 Gives the same result.

Ok, could you try with Unilink to see if it's a linker problem? ftp://ftp.styx.cabel.net/pub/UniLink/ http://www.digitalmars.com/d/archives/digitalmars/D/learn/Need_OMF_MySQL_lib_that_actually_f_works..._28375.html#N28389

Have no idea how to work with UniLink: ulink.cfg: -LD:\D\dmd2\windows\lib -zlibrary;phobos;kernel32;user32;snn -Go ulink main.obj: UniLink v1.07 [beta] (build 3.19) Error: Invalid OMF file (12) 'library.lib|gtk.d'
Aug 04 2011
prev sibling next sibling parent Trass3r <un known.com> writes:
 doCompile.bat:
 dmd -c -release -IgtkD-1.4.1-release\headers main.d

 doLink.bat:
 link  
 main,"testGtkD.exe",,"gtkD-1.4.1-release\library.lib"+user32+kernel32/noi;

Don't invoke optlink directly like that. Just use something like 'dmd -release main.obj gtkD-1.4.1-release\library.lib -oftestGtkD' for linking. (though I don't know why you separate compilation and linking here, a simple 'dmd -release main.d gtkD-1.4.1-release\library.lib -oftestGtkD' is enough)
Aug 04 2011
prev sibling parent Trass3r <un known.com> writes:
 dmd -oftestGtkD.exe -release -IgtkD-1.4.1-release\headers main.d  
 gtkD-1.4.1-release\library.lib

 Gives the same result.

Ok, could you try with Unilink to see if it's a linker problem? ftp://ftp.styx.cabel.net/pub/UniLink/ http://www.digitalmars.com/d/archives/digitalmars/D/learn/Need_OMF_MySQL_lib_that_actually_f_works..._28375.html#N28389
Aug 04 2011