March 25, 2011 Re: Release: GDC for Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Green | Daniel Green Wrote: > On 3/24/2011 6:53 PM, Kagamin wrote: > > Is the AIX problem valid for windows too? > What is the AIX problem? https://bitbucket.org/goshawk/gdc/wiki/UserDocumentation#!known-issues writeln("hello world") compiles to 3MB exe which is approx 1/3 of libgphobos2. object file is just 3KB. or may be it's just the datetime module... |
March 25, 2011 Re: Release: GDC for Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | "Kagamin" <spam@here.lot> wrote in message news:imha5f$2tke$1@digitalmars.com... > Daniel Green Wrote: > >> On 3/24/2011 6:53 PM, Kagamin wrote: >> > Is the AIX problem valid for windows too? >> What is the AIX problem? > > https://bitbucket.org/goshawk/gdc/wiki/UserDocumentation#!known-issues > > writeln("hello world") > compiles to 3MB exe which is approx 1/3 of libgphobos2. > object file is just 3KB. > > or may be it's just the datetime module... That poor datetime module just can't catch a break! :) |
March 25, 2011 Re: Release: GDC for Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On 3/25/11, Kagamin <spam@here.lot> wrote:
> Daniel Green Wrote:
>
>> On 3/24/2011 6:53 PM, Kagamin wrote:
>> > Is the AIX problem valid for windows too?
>> What is the AIX problem?
>
> https://bitbucket.org/goshawk/gdc/wiki/UserDocumentation#!known-issues
>
> writeln("hello world")
> compiles to 3MB exe which is approx 1/3 of libgphobos2.
> object file is just 3KB.
>
The real issue here is that the GDC binaries that were just released weren't stripped. I guess Daniel forgot about that. :)
There's strip.exe that you can use on Windows. It usually comes with either TDM-GCC or MinGW binaries. Once you have it, run this batch file from GDC's main directory:
for /F %%G in ('dir /B /S *.exe;*.a;*.so') do strip --strip-unneeded %%G
Now libgphobos2 will be 3.5 megs in size, and a test project with a
writeln() will compile to 966Kb.
|
March 25, 2011 Re: Release: GDC for Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | Andrej Mitrovic Wrote:
> for /F %%G in ('dir /B /S *.exe;*.a;*.so') do strip --strip-unneeded %%G
>
> Now libgphobos2 will be 3.5 megs in size, and a test project with a
> writeln() will compile to 966Kb.
Forgot about that, thanks.
|
March 25, 2011 Re: Release: GDC for Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On 3/25/11, Kagamin<spam@here.lot> wrote: > Daniel Green Wrote: > >> On 3/24/2011 6:53 PM, Kagamin wrote: >>> Is the AIX problem valid for windows too? >> What is the AIX problem? > > https://bitbucket.org/goshawk/gdc/wiki/UserDocumentation#!known-issues > > writeln("hello world") > compiles to 3MB exe which is approx 1/3 of libgphobos2. > object file is just 3KB. It doesn't. The following sizes I think use shared libgcc. Might be a couple hundred more for a static build. A lot of the size is overhead. 856 hello.o 682,987 hello.exe 112,128 hello.exe after strip hello.exe 39,424 hello.exe upx... On 3/25/2011 11:35 AM, Andrej Mitrovic wrote: > The real issue here is that the GDC binaries that were just released > weren't stripped. I guess Daniel forgot about that. :) That was on purpose. Unless it's an actual release, I won't strip them. Also, stripping the GDC binaries won't have any effect on output file size. Stripping the phobos libraries will, but I believe you'll also permanently lose any debugging information in the process. A better solution is to strip the outputted binary when your done with it. Does GCC have something equivalent to Microsoft's PDB file? Essentially it's all the debug information stored in a separate file. |
March 25, 2011 Re: Release: GDC for Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Green | Apparently there is a way to strip the debuggin info and put it in another file, and then link the executable to the debug file so GDB can automatically load it. But this doesn't seem to work for me: gdc -g foo.d -o foo.exe objcopy --only-keep-debug foo.exe foo.debug strip -g foo.exe objcopy --add-gnu-debuglink=foo.debug foo.exe It doesn't add the .gnu_debuglink section to foo.exe, I don't know why.. |
March 26, 2011 Re: Release: GDC for Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Green | > > writeln("hello world")
> > compiles to 3MB exe which is approx 1/3 of libgphobos2.
> > object file is just 3KB.
> It doesn't. The following sizes I think use shared libgcc. Might be a couple hundred more for a static build. A lot of the size is overhead.
>
> 856 hello.o
> 682,987 hello.exe
> 112,128 hello.exe after strip hello.exe
> 39,424 hello.exe upx...
----
gdc -v2 test4.d -o test4.exe
----
dir test4*
----
26.03.2011 19:17 78 test4.d
26.03.2011 19:18 2Â 835Â 758 test4.exe
2 File(s) 2Â 835Â 836 bytes
----
copy test4.d con
----
import std.stdio;
int main()
{
writeln("hello world");
return 0;
}
1 file(s) copied.
----
with
gdc -v2 test4.d -o test4.exe -s
it's 454kb
|
March 26, 2011 Re: Release: GDC for Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On 3/26/2011 12:27 PM, Kagamin wrote: > ---- > gdc -v2 test4.d -o test4.exe > ---- > dir test4* > ---- > 26.03.2011 19:17 78 test4.d > 26.03.2011 19:18 2Â 835Â 758 test4.exe > 2 File(s) 2Â 835Â 836 bytes Apparently, I used core.std.stdio. When I retested using std.stdio I got similar numbers. About 2 megs can be removed by stripping libgphobos2.a. I'll start doing that now that I know it's possible to separate debug information. nm test4.exe | grep ModuleInfo Run for a list of included modules. The best way to tell would be compare outputs with linux. > ---- > copy test4.d con > ---- > import std.stdio; > int main() > { > writeln("hello world"); > return 0; > } > 1 file(s) copied. > ---- > > with > gdc -v2 test4.d -o test4.exe -s > it's 454kb From the GCC manual. -s Remove all symbol table and relocation information from the executable. It also looks like the AIX issue was related to the linker for the platform and applied to c++ as well. |
March 26, 2011 Re: Release: GDC for Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Green | Daniel Green Wrote: > nm test4.exe | grep ModuleInfo lol, winsock, regex, regexp, random(?) Well, std.datetime and std.complex can be understandable: they can be used by writeln... > > with > > gdc -v2 test4.d -o test4.exe -s > > it's 454kb > From the GCC manual. > -s > Remove all symbol table and relocation information from the > executable. yes, -s means strip |
March 26, 2011 Re: Release: GDC for Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Green | Daniel Green Wrote:
> nm test4.exe | grep ModuleInfo
as to std.random, in std.algorithm we have
version(unittest)
{
import std.random, std.stdio, std.string;
mixin(dummyRanges);
}
is phobos compiled with unittests enabled?
|
Copyright © 1999-2021 by the D Language Foundation