digitalmars.D - Cross Compiler
- Jeroen Bollen (4/4) Mar 02 2014 Is there a DMD cross compiler, or am I forced to use the GDC? I
- Mathias LANG (6/10) Mar 02 2014 I never tried for myself, but DMD is supposed to be able to be a
- Jeroen Bollen (2/12) Mar 02 2014 Am I correct saying no special flags are required?
- Dicebot (3/16) Mar 02 2014 -m32 / -m64 control target platform for DMD. For ARM + GDC/LDC
- Jeroen Bollen (2/19) Mar 02 2014 Al right, thanks!
- Adam D. Ruppe (2/2) Mar 02 2014 If you want to build a Windows exe on Linux, you can also just
- Jeroen Bollen (2/16) Mar 03 2014
- Jeroen Bollen (3/19) Mar 03 2014 I'm guessing this is caused by the presence of the main method.
- Daniel Murphy (4/6) Mar 03 2014 The easiest way is to link yourself. You can run dmd with -v to get the...
- Jeroen Bollen (2/8) Mar 03 2014 Cheers
- Dicebot (3/14) Mar 03 2014 Please be aware of
- Jeroen Bollen (2/17) Mar 03 2014 Is any sort of static linkage really necessary though?
- Jeroen Bollen (7/12) Mar 03 2014 Seems like it is, without specifying the libraries I get an error:
- Jeroen Bollen (2/2) Mar 03 2014 Just realized that's probably the missing runtime. Why does it
- Adam D. Ruppe (23/25) Mar 03 2014 There's some hidden references to the runtime outputted,
- Jeroen Bollen (2/27) Mar 04 2014 What does the runtime actually do?
Is there a DMD cross compiler, or am I forced to use the GDC? I don't really mind using GDC, but I've always preferred DMD for some odd reason. I guess it has some good point, like faster compilation time and more up-to-date.
Mar 02 2014
On Sunday, 2 March 2014 at 21:08:38 UTC, Jeroen Bollen wrote:Is there a DMD cross compiler, or am I forced to use the GDC? I don't really mind using GDC, but I've always preferred DMD for some odd reason. I guess it has some good point, like faster compilation time and more up-to-date.I never tried for myself, but DMD is supposed to be able to be a cross compiler (see src/mars.h). Of course this apply only if you are targeting x86 / x86_64. If you want an ARM cross compiler you have to stick with LDC / GDC AFAIK.
Mar 02 2014
On Sunday, 2 March 2014 at 21:39:11 UTC, Mathias LANG wrote:On Sunday, 2 March 2014 at 21:08:38 UTC, Jeroen Bollen wrote:Am I correct saying no special flags are required?Is there a DMD cross compiler, or am I forced to use the GDC? I don't really mind using GDC, but I've always preferred DMD for some odd reason. I guess it has some good point, like faster compilation time and more up-to-date.I never tried for myself, but DMD is supposed to be able to be a cross compiler (see src/mars.h). Of course this apply only if you are targeting x86 / x86_64. If you want an ARM cross compiler you have to stick with LDC / GDC AFAIK.
Mar 02 2014
On Sunday, 2 March 2014 at 21:40:50 UTC, Jeroen Bollen wrote:On Sunday, 2 March 2014 at 21:39:11 UTC, Mathias LANG wrote:-m32 / -m64 control target platform for DMD. For ARM + GDC/LDC you should check their wiki's / manuals.On Sunday, 2 March 2014 at 21:08:38 UTC, Jeroen Bollen wrote:Am I correct saying no special flags are required?Is there a DMD cross compiler, or am I forced to use the GDC? I don't really mind using GDC, but I've always preferred DMD for some odd reason. I guess it has some good point, like faster compilation time and more up-to-date.I never tried for myself, but DMD is supposed to be able to be a cross compiler (see src/mars.h). Of course this apply only if you are targeting x86 / x86_64. If you want an ARM cross compiler you have to stick with LDC / GDC AFAIK.
Mar 02 2014
On Sunday, 2 March 2014 at 21:49:28 UTC, Dicebot wrote:On Sunday, 2 March 2014 at 21:40:50 UTC, Jeroen Bollen wrote:Al right, thanks!On Sunday, 2 March 2014 at 21:39:11 UTC, Mathias LANG wrote:-m32 / -m64 control target platform for DMD. For ARM + GDC/LDC you should check their wiki's / manuals.On Sunday, 2 March 2014 at 21:08:38 UTC, Jeroen Bollen wrote:Am I correct saying no special flags are required?Is there a DMD cross compiler, or am I forced to use the GDC? I don't really mind using GDC, but I've always preferred DMD for some odd reason. I guess it has some good point, like faster compilation time and more up-to-date.I never tried for myself, but DMD is supposed to be able to be a cross compiler (see src/mars.h). Of course this apply only if you are targeting x86 / x86_64. If you want an ARM cross compiler you have to stick with LDC / GDC AFAIK.
Mar 02 2014
If you want to build a Windows exe on Linux, you can also just run the windows version of dmd in wine.
Mar 02 2014
How to stop DMD from linking against any libraries? A simple program like this already links to quite a few libraries:void main() { return; }linux-vdso.so.1 => (0x00007fffdf5fe000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3ba9433000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3ba912f000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3ba8f26000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3ba8b5e000) /lib64/ld-linux-x86-64.so.2 (0x00007f3ba9679000)
Mar 03 2014
On Monday, 3 March 2014 at 14:31:09 UTC, Jeroen Bollen wrote:How to stop DMD from linking against any libraries? A simple program like this already links to quite a few libraries:I'm guessing this is caused by the presence of the main method. Why would a single method require all those libraries though?void main() { return; }linux-vdso.so.1 => (0x00007fffdf5fe000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3ba9433000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3ba912f000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3ba8f26000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3ba8b5e000) /lib64/ld-linux-x86-64.so.2 (0x00007f3ba9679000)
Mar 03 2014
"Jeroen Bollen" wrote in message news:unvhloslmpxvxhawypoq forum.dlang.org...How to stop DMD from linking against any libraries? A simple program like this already links to quite a few libraries:The easiest way is to link yourself. You can run dmd with -v to get the link command and start from there.
Mar 03 2014
On Monday, 3 March 2014 at 15:36:02 UTC, Daniel Murphy wrote:"Jeroen Bollen" wrote in message news:unvhloslmpxvxhawypoq forum.dlang.org...CheersHow to stop DMD from linking against any libraries? A simple program like this already links to quite a few libraries:The easiest way is to link yourself. You can run dmd with -v to get the link command and start from there.
Mar 03 2014
On Monday, 3 March 2014 at 15:44:30 UTC, Jeroen Bollen wrote:On Monday, 3 March 2014 at 15:36:02 UTC, Daniel Murphy wrote:Please be aware of https://d.puremagic.com/issues/show_bug.cgi?id=12268 though"Jeroen Bollen" wrote in message news:unvhloslmpxvxhawypoq forum.dlang.org...CheersHow to stop DMD from linking against any libraries? A simple program like this already links to quite a few libraries:The easiest way is to link yourself. You can run dmd with -v to get the link command and start from there.
Mar 03 2014
On Monday, 3 March 2014 at 16:21:25 UTC, Dicebot wrote:On Monday, 3 March 2014 at 15:44:30 UTC, Jeroen Bollen wrote:Is any sort of static linkage really necessary though?On Monday, 3 March 2014 at 15:36:02 UTC, Daniel Murphy wrote:Please be aware of https://d.puremagic.com/issues/show_bug.cgi?id=12268 though"Jeroen Bollen" wrote in message news:unvhloslmpxvxhawypoq forum.dlang.org...CheersHow to stop DMD from linking against any libraries? A simple program like this already links to quite a few libraries:The easiest way is to link yourself. You can run dmd with -v to get the link command and start from there.
Mar 03 2014
On Monday, 3 March 2014 at 17:21:50 UTC, Jeroen Bollen wrote:On Monday, 3 March 2014 at 16:21:25 UTC, Dicebot wrote:Seems like it is, without specifying the libraries I get an error: app.o: In function `main': app.d:(.text.main+0x13): undefined reference to `_d_run_main' app.o:(.text.d_dso_init[.data.d_dso_rec]+0x32): undefined reference to `_d_dso_registry' collect2: error: ld returned 1 exit statusPlease be aware of https://d.puremagic.com/issues/show_bug.cgi?id=12268 thoughIs any sort of static linkage really necessary though?
Mar 03 2014
Just realized that's probably the missing runtime. Why does it need a runtime though? It's just returning.
Mar 03 2014
On Monday, 3 March 2014 at 19:03:20 UTC, Jeroen Bollen wrote:Just realized that's probably the missing runtime. Why does it need a runtime though? It's just returning.There's some hidden references to the runtime outputted, especially when you write a D main, which adds references to d_run_main and other such stuff. If you make it an extern(C) main instead of a regular D main, it gets rid of some of that, but it will still complain about the d_dso_registry thing (at least on Linux). You can add a dummy "extern(C) void _d_dso_registry() {}" to it to hack past that too, but you probably shouldn't - going without the runtime is a fair amount of work for little practical benefit, though it can be pretty educational. The definition of this function in druntime is src/rt/sections_linux.d From that file: /* For each shared library and executable, the compiler generates code that * sets up CompilerDSOData and calls _d_dso_registry(). * A pointer to that code is inserted into both the .ctors and .dtors * segment so it gets called by the loader on startup and shutdown. */ extern(C) void _d_dso_registry(CompilerDSOData* data)
Mar 03 2014
On Tuesday, 4 March 2014 at 01:22:15 UTC, Adam D. Ruppe wrote:On Monday, 3 March 2014 at 19:03:20 UTC, Jeroen Bollen wrote:What does the runtime actually do?Just realized that's probably the missing runtime. Why does it need a runtime though? It's just returning.There's some hidden references to the runtime outputted, especially when you write a D main, which adds references to d_run_main and other such stuff. If you make it an extern(C) main instead of a regular D main, it gets rid of some of that, but it will still complain about the d_dso_registry thing (at least on Linux). You can add a dummy "extern(C) void _d_dso_registry() {}" to it to hack past that too, but you probably shouldn't - going without the runtime is a fair amount of work for little practical benefit, though it can be pretty educational. The definition of this function in druntime is src/rt/sections_linux.d From that file: /* For each shared library and executable, the compiler generates code that * sets up CompilerDSOData and calls _d_dso_registry(). * A pointer to that code is inserted into both the .ctors and .dtors * segment so it gets called by the loader on startup and shutdown. */ extern(C) void _d_dso_registry(CompilerDSOData* data)
Mar 04 2014