D.gnu - Create a self contained object file like fat jars from java
- pizza_dox_9999 (6/6) Jan 05 Hi, I am trying with gdc to create the equivalent of a fat jar.
- Renato (5/11) Jan 07 Did you try using dub and specifying `targetType="staticLibrary"`?
- pizza_dox_9999 (5/17) Jan 14 Thank you for the information. Sadly nothing for gdc directly.
- Renato (9/31) Jan 14 I think you misunderstood me. `dub` is the D's build system and
- Richard (Rikki) Andrew Cattermole (5/18) Jan 14 Dub's static library target type does not include dependencies or
- pizza_dox_9999 (3/20) Jan 14 But thats what I need and want.
- Richard (Rikki) Andrew Cattermole (5/25) Jan 14 Combining of static libraries is not specific to D.
- pizza_dox_9999 (6/6) Jan 14 OK to make it clear. I wanted to call d from c so that I can
- Richard (Rikki) Andrew Cattermole (10/15) Jan 14 My understanding is druntime is not ported to that platform.
- pizza_dox_9999 (6/23) Jan 14 Thank you for the clarification.
- Richard (Rikki) Andrew Cattermole (8/35) Jan 14 A string in D is a slice. A pointer + length. This is entirely platform
Hi, I am trying with gdc to create the equivalent of a fat jar. So for that I would need the standard dlang library included in the object or library file. Does somebody know the needed gdc flags? I am using mips64-linux-gnuabi64-gdc-12. pizza_dox_9999
Jan 05
On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_9999 wrote:Hi, I am trying with gdc to create the equivalent of a fat jar. So for that I would need the standard dlang library included in the object or library file. Does somebody know the needed gdc flags? I am using mips64-linux-gnuabi64-gdc-12. pizza_dox_9999Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`.
Jan 07
On Sunday, 7 January 2024 at 18:14:12 UTC, Renato wrote:On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_9999 wrote:Thank you for the information. Sadly nothing for gdc directly. But how is dub solving my problem? Is the buildstep creating a "fat jar". So instead of compiling multiple .d files with gdc I would only compile the "fat jar" from dub?Hi, I am trying with gdc to create the equivalent of a fat jar. So for that I would need the standard dlang library included in the object or library file. Does somebody know the needed gdc flags? I am using mips64-linux-gnuabi64-gdc-12. pizza_dox_9999Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`.
Jan 14
On Sunday, 14 January 2024 at 09:36:16 UTC, pizza_dox_9999 wrote:On Sunday, 7 January 2024 at 18:14:12 UTC, Renato wrote:I think you misunderstood me. `dub` is the D's build system and it "knows" how to call the D compilers, including gdc. When you tell dub to build a static library (equivalent to "fat jar" for D) it will use whatever compiler options are needed to do so... you can run `dub build -v -release --compiler=gdc` to see which compiler options it's using to invoke gdc, and then you can just drop dub if you don't need it (though it's very useful to have).On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_9999 wrote:Thank you for the information. Sadly nothing for gdc directly. But how is dub solving my problem? Is the buildstep creating a "fat jar". So instead of compiling multiple .d files with gdc I would only compile the "fat jar" from dub?Hi, I am trying with gdc to create the equivalent of a fat jar. So for that I would need the standard dlang library included in the object or library file. Does somebody know the needed gdc flags? I am using mips64-linux-gnuabi64-gdc-12. pizza_dox_9999Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`.
Jan 14
On 08/01/2024 7:14 AM, Renato wrote:On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_9999 wrote:Dub's static library target type does not include dependencies or druntime/phobos. Typically static libraries do not combine to produce a bigger static library.Hi, I am trying with gdc to create the equivalent of a fat jar. So for that I would need the standard dlang library included in the object or library file. Does somebody know the needed gdc flags? I am using mips64-linux-gnuabi64-gdc-12. pizza_dox_9999Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`.
Jan 14
On Sunday, 14 January 2024 at 10:05:12 UTC, Richard (Rikki) Andrew Cattermole wrote:On 08/01/2024 7:14 AM, Renato wrote:But thats what I need and want.On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_9999 wrote:Dub's static library target type does not include dependencies or druntime/phobos. Typically static libraries do not combine to produce a bigger static library.[...]Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`.
Jan 14
On 15/01/2024 12:42 AM, pizza_dox_9999 wrote:On Sunday, 14 January 2024 at 10:05:12 UTC, Richard (Rikki) Andrew Cattermole wrote:Combining of static libraries is not specific to D. Although you're going to need to figure out how to get a list of all the static libraries you want to combine. The actual combination should be pretty standard.On 08/01/2024 7:14 AM, Renato wrote:But thats what I need and want.On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_9999 wrote:Dub's static library target type does not include dependencies or druntime/phobos. Typically static libraries do not combine to produce a bigger static library.[...]Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`.
Jan 14
OK to make it clear. I wanted to call d from c so that I can write a n64 game with d. But compiling the d object files while using higher features like classes, resulted in missing dependencys. So because GCC doesnt understands d I need an object file which has everything included d needs to run. Thats my understanding of this situation.
Jan 14
On 15/01/2024 12:47 AM, pizza_dox_9999 wrote:OK to make it clear. I wanted to call d from c so that I can write a n64 game with d. But compiling the d object files while using higher features like classes, resulted in missing dependencys. So because GCC doesnt understands d I need an object file which has everything included d needs to run. Thats my understanding of this situation.My understanding is druntime is not ported to that platform. Too limited in resources. Getting a static library with all dependencies would not help you here. But yes, GCC does understand D, using GDC which is built on top (same frontend as DMD and LDC). You are either stuck using -betterC which does not support ``extern(D)`` classes, but does have ``extern(C++)`` classes. Or by using a custom runtime which you will likely have to write yourself and will likely break between compiler releases.
Jan 14
On Sunday, 14 January 2024 at 11:54:09 UTC, Richard (Rikki) Andrew Cattermole wrote:On 15/01/2024 12:47 AM, pizza_dox_9999 wrote:Thank you for the clarification. Are such things as string so platform dependent in d or the stuff for the class and interface declarations that they aren't cross platform? I meant the gcc used by the n64 toolchain (libdragon).OK to make it clear. I wanted to call d from c so that I can write a n64 game with d. But compiling the d object files while using higher features like classes, resulted in missing dependencys. So because GCC doesnt understands d I need an object file which has everything included d needs to run. Thats my understanding of this situation.My understanding is druntime is not ported to that platform. Too limited in resources. Getting a static library with all dependencies would not help you here. But yes, GCC does understand D, using GDC which is built on top (same frontend as DMD and LDC). You are either stuck using -betterC which does not support ``extern(D)`` classes, but does have ``extern(C++)`` classes. Or by using a custom runtime which you will likely have to write yourself and will likely break between compiler releases.
Jan 14
On 15/01/2024 1:23 AM, pizza_dox_9999 wrote:On Sunday, 14 January 2024 at 11:54:09 UTC, Richard (Rikki) Andrew Cattermole wrote:A string in D is a slice. A pointer + length. This is entirely platform agnostic. A dynamic array, is a slice, backed by the GC. This requires the GC and with that druntime. Which means you cannot append to a slice without druntime. Classes require a ton of infrastructure to work. They are not purely a compilation construct.On 15/01/2024 12:47 AM, pizza_dox_9999 wrote:Thank you for the clarification. Are such things as string so platform dependent in d or the stuff for the class and interface declarations that they aren't cross platform? I meant the gcc used by the n64 toolchain (libdragon).OK to make it clear. I wanted to call d from c so that I can write a n64 game with d. But compiling the d object files while using higher features like classes, resulted in missing dependencys. So because GCC doesnt understands d I need an object file which has everything included d needs to run. Thats my understanding of this situation.My understanding is druntime is not ported to that platform. Too limited in resources. Getting a static library with all dependencies would not help you here. But yes, GCC does understand D, using GDC which is built on top (same frontend as DMD and LDC). You are either stuck using -betterC which does not support ``extern(D)`` classes, but does have ``extern(C++)`` classes. Or by using a custom runtime which you will likely have to write yourself and will likely break between compiler releases.
Jan 14