View previous topic :: View next topic |
Author |
Message |
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Wed Feb 23, 2005 7:14 pm Post subject: Requests for Build ... |
|
|
When using the dmd compiler, all object files are placed into one directory. With really large projects, it's quite easy to end up with two files of the same name ~ whereupon one object file silently overwrites another and the link fails with a mysterious message.
One can try to use the -od switch, but that just changes the location where all those files are written (and fails if the directory does not exist).
We need a way to retain coherence between object files and the packages they belong to. One might consider prefixing the package-name onto the objectfile name?
Perhaps a better solution would be for a tool to create a subdirectory (perhaps two: one for build and one for debug) within each package involved, invoke the compiler for each said package, and construct an indirect "input file" for the linker to tell it where all the appropriate files are.
Something like that would be truly helpful. |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Wed Feb 23, 2005 7:52 pm Post subject: |
|
|
I believe the -op switch on the DMD command line causes each object file to be created in the same directory as its source file.
Build always uses the -op switch. This means that object files are not always ending up in the same directory.
Does this help? _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Wed Feb 23, 2005 8:01 pm Post subject: |
|
|
Derek Parnell wrote: | I believe the -op switch on the DMD command line causes each object file to be created in the same directory as its source file.
Build always uses the -op switch. This means that object files are not always ending up in the same directory.
Does this help? |
It will if the linker is then instructed as to where those myriad object files reside
Is that the case?
If so, then it would still be better to place object files in a seperate subdir (so debug and optimized builds don't get confused). If Build is already doing the hard work in hooking up these disparate files to the linker, could it also provide an option to -op into a subdir instead? |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Wed Feb 23, 2005 9:52 pm Post subject: |
|
|
kris wrote: | Is that the case? |
It is in the Windows version of dmd. I really don't know what dmd does to call the linker in linux.
Note that Build does not explicitly call any linker. It lets DMD do its stuff with regards to that. What build does do is pass full path names for each of the source files (and object files that don't need recompiling) to DMD.
kris wrote: | If so, then it would still be better to place object files in a seperate subdir (so debug and optimized builds don't get confused). If Build is already doing the hard work in hooking up these disparate files to the linker, could it also provide an option to -op into a subdir instead? |
I can't think of an efficient way to do this. The DMD command line allows you to specify a single output directory, and presumably then all the object files end up in that directory. If you are trying to avoid name clashes then this idea won't work, unless you invoke DMD for each source file to be compiled (with its own output directory) and then again to link in all the object files scattered about.
Currently, to make DMD run as fast as possible, I just invoke it once, giving it multiple files to work on.
I wanted to get away from the make/SCons model.
The model I have in mind is one in which the developer would be normally creating 'debug' edition of the application and do testing with that. Only when ready to produce a edition for release testing, would the developer need to create a production edition of the application. And this would require a full compile of all sources with the -release switch and no unittests, and no debugs.
I'll think about how to keep the various editions of an application separate. _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Sat Mar 12, 2005 12:22 pm Post subject: |
|
|
OK; Build does the "right" thing in terms of isolating namespaces. Thanks.
I have another request: the -nounittest can get in the way when using 3rd-party classes. That is ~ unless you first compile the 3rd-party into a .lib (or whatever) you can easily end up with a bunch of 3rd-party unittests running instead of your own.
I understand the model you're following with Build, but then dmd is so damn fast that it's actually easier for the user to avoid the "build the library first" step, have Build figure out all the dependencies, and just compile the whole thing.
Specifically; compiling mango.example.Servlets with a -full and -clean takes about a second -- that includes compiling most of Mango too.
I also understand the conflict therein: how does one get their own unittest running without also tripping the 3rd-party ones too? The obvious answer would be for the user to take a two-stage approach, and compile the 3rd party into a lib first (where 3rd-party could mean the person sitting next to you, or perhaps some of your own, older, code).
It's just that this is not so convenient, and there just might be a better way? I'm bringing this up to prompt some thought on the subject, and to tentatively suggest the enabling of unittest is perhaps not the best default state?
That is, without unittest, you get the executable and nothing but the executable. If you /do/ want unittest, then there are potentially some considerations to make regarding 3rd-party software. Making the user 'think' should perhaps not be the default?
- Kris |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Tue Mar 15, 2005 7:54 pm Post subject: |
|
|
kris wrote: | OK; Build does the "right" thing in terms of isolating namespaces. Thanks.
I have another request: the -nounittest can get in the way when using 3rd-party classes. That is ~ unless you first compile the 3rd-party into a .lib (or whatever) you can easily end up with a bunch of 3rd-party unittests running instead of your own.
|
[SNIP]
kris wrote: | That is, without unittest, you get the executable and nothing but the executable. If you /do/ want unittest, then there are potentially some considerations to make regarding 3rd-party software. Making the user 'think' should perhaps not be the default? |
A fair call, and well argued. Yes, I will change it so that unittest is not the default. If one does want it to be the default, they can add it to their DMD configuration file anyway. _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Tue Mar 15, 2005 9:07 pm Post subject: |
|
|
Ah ~ good on ya mate. Reckon I owe you a frothy one. |
|
Back to top |
|
|
|