Thread overview
Dub generates a library file that is larger in size than the one built on command line.
Dec 17, 2017
Venkat
Dec 17, 2017
Jonathan M Davis
Dec 17, 2017
Venkat
Dec 17, 2017
Mike Parker
Dec 17, 2017
Venkat
Dec 17, 2017
Ivan Trombley
December 17, 2017
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-7BB682AB55F152616E128DD715E887DF/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 ?
December 16, 2017
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

December 17, 2017
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
December 17, 2017
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
December 17, 2017
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.
December 17, 2017
TY Mike, that explains it.

Thanks Ivan.