www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Dub generates a library file that is larger in size than the one built

reply Venkat <venkatram.akkineni gmail.com> writes:
The following is the command output by dub with --vverbose 
switch. It generates a file which is 6094400 bytes in size

dmd -lib 
-of.dub/build/library-debug-linux.posix-x86_64-dmd_2077-7BB682AB55F152616E128D
715E887DF/libdjni.a -debug -g -w -version=Have_djni -Isource/ source/app.d
source/jni/JavaArray.d source/jni/JavaClass.d source/jni/JavaEnv.d
source/jni/JavaField.d source/jni/JavaMethod.d source/jni/JavaObject.d
source/jni/JavaString.d source/jni/JavaVM.d source/jni/JniHelper.d
source/jni/JniProxy.d source/jni/jni.d source/jni/package.d -vcolumns


The below command generates a library file of size 3586152 bytes.

dmd -oflibDJni.a -lib -H -Hdimport/jni source/jni/*.d

so the file generated by dub is almost twice in size. Why such a 
difference ? What does dub include in the generated file ?
Dec 16 2017
parent reply Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Sunday, December 17, 2017 02:08:00 Venkat via Digitalmars-d-learn wrote:
 The following is the command output by dub with --vverbose
 switch. It generates a file which is 6094400 bytes in size

 dmd -lib
 -of.dub/build/library-debug-linux.posix-x86_64-dmd_2077-7BB682AB55F152616E
 128DD715E887DF/libdjni.a -debug -g -w -version=Have_djni -Isource/
 source/app.d source/jni/JavaArray.d source/jni/JavaClass.d
 source/jni/JavaEnv.d source/jni/JavaField.d source/jni/JavaMethod.d
 source/jni/JavaObject.d source/jni/JavaString.d source/jni/JavaVM.d
 source/jni/JniHelper.d source/jni/JniProxy.d source/jni/jni.d
 source/jni/package.d -vcolumns


 The below command generates a library file of size 3586152 bytes.

 dmd -oflibDJni.a -lib -H -Hdimport/jni source/jni/*.d

 so the file generated by dub is almost twice in size. Why such a
 difference ? What does dub include in the generated file ?
The most likely culprit would be -g, which adds symbolic debug info. - Jonathan M Davis
Dec 16 2017
parent reply Venkat <venkatram.akkineni gmail.com> writes:
dub build --vverbose

That is the command I used. Would it be right to assume that -g 
is being added because --vverbose ? The reason I ask is the file 
size is about the same when I run the below command.

dub build
Dec 16 2017
next sibling parent reply Mike Parker <aldacron gmail.com> writes:
On Sunday, 17 December 2017 at 02:42:44 UTC, Venkat wrote:
 dub build --vverbose

 That is the command I used. Would it be right to assume that -g 
 is being added because --vverbose ? The reason I ask is the 
 file size is about the same when I run the below command.

 dub build
It's because debug builds are the default. See: https://code.dlang.org/docs/commandline#buildI
Dec 16 2017
parent Venkat <venkatram.akkineni gmail.com> writes:
TY Mike, that explains it.

Thanks Ivan.
Dec 16 2017
prev sibling parent Ivan Trombley <itrombley dot-borg.org> writes:
On Sunday, 17 December 2017 at 02:42:44 UTC, Venkat wrote:
 dub build --vverbose

 That is the command I used. Would it be right to assume that -g 
 is being added because --vverbose ? The reason I ask is the 
 file size is about the same when I run the below command.

 dub build
You need to add "--build=release", otherwise dub will build debug by default.
Dec 16 2017