The dmd.conf rant
tl;dr, please reconsider changing the conf order or splitting the conf file https://github.com/D-Programming-Language/dmd/pull/4256#issuecomment-88316771 That dmd.conf is driving me crazy. I need a dmd.conf in my dmd repo, so that I can use dmd-master. It wouldn't work without a config and putting `dmd.conf` anywhere but near dmd itself overrides my system dmd.conf. That setup worked nicely for me although some of you guys seem to have a dmd.conf in your home dir (why?). Now that we require a host D compiler to build dmd it no longer works, because the dmd.conf for my dmd-master overrides the system wide dmd.conf of my host dmd. Why would my system dmd need a different configuration just because __I__ am in a different folder? It doesn't, it still uses the same phobos (the system wide) and still requires the same linker switches. Setting HOST_DC is a workaround but is impractical, because it requires an awkward `env HOST_DC='dmd -conf=/etc/dmd.conf' make -f posix.mak` to work. Requiring `dmd -conf=/etc/dmd.conf` in order to not pickup some random conf file is crazy. It's not portable either, because the config is somewhere else on each platform. We learned the same from dlang.org https://github.com/D-Programming-Language/dlang.org/pull/758#issuecomment-74294012, adding the `-conf=` switch didn't solve the actual problem and created new ones. It might seem intuitive, that a local configuration should override a global one, but it's a false friend here, because the configuration should be local from the perspective of the compiler, not from the perspective of the user. In fact the config is so tied to the compiler that we could almost compile it __into__ the compiler (like gcc does with it's spec). At best it's something package maintainers need to touch to accomodate platform differences, but it's not a user configuration file. If people use it to configure DFLAGS and such project dependent stuff, then we need to split the configuration file, into one part that tells the compiler where to find druntime/phobos and how to link, and one part that can be used for per-project configuration of compiler arguments and env variables. IMO the latter is better kept in makefiles/dub.json though. ### conclusion The lookup order for the config file should be changed to the following. - next to dmd binary (highest precedence so that I can have multiple installations) - per-user conf folder (HOME) (to override the system-wide config) - system-wide conf folder (to allow package installations .deb/.rpm) The current situation is unmaintainable.
Re: The dmd.conf rant
On 3/31/15 7:28 PM, Martin Nowak wrote: That dmd.conf is driving me crazy. Me too! We learned the same from dlang.org https://github.com/D-Programming-Language/dlang.org/pull/758#issuecomment-74294012, adding the `-conf=` switch didn't solve the actual problem and created new ones. I don't understand this part. -conf= should essentially remove all notion of .conf files whatsoever. Andrei
Re: The dmd.conf rant
On Wednesday, 1 April 2015 at 02:54:27 UTC, Andrei Alexandrescu wrote: On 3/31/15 7:28 PM, Martin Nowak wrote: That dmd.conf is driving me crazy. Me too! I made the complaint some time ago and was told my setup was wrong. I stopped using master since then, I have no time to fix my build now, and I'm not sure when I would be able to. Happy to see this is bugging others. This needs to be fixed.
Re: The dmd.conf rant
On 04/01/2015 04:54 AM, Andrei Alexandrescu wrote: >> > > I don't understand this part. -conf= should essentially remove all > notion of .conf files whatsoever. That's only half of the story, because without a config dmd doesn't know where to find druntime/phobos or how to link a binary. You really want one dmd.conf for each installed compiler/druntime/phobos triplet. To have something that works independent of the environment I have to use this on my Fedora installation. dmd -conf=/etc/dmd.conf # library dir not needed because libphobos2.a is in /usr/lib64 dmd -conf= -I/usr/include/dmd/druntime/import/ -I/usr/include/dmd/phobos/ -L--export-dynamic If I wanted to use my dmd-master I'd have to use one of these. /home/dawg/Code/D/DPL/dmd/src/dmd -conf=/home/dawg/Code/D/DPL/dmd/src/dmd.conf /home/dawg/Code/D/DPL/dmd/src/dmd -conf= -I/home/dawg/Code/D/DPL/druntime/import/ -I/home/dawg/Code/D/DPL/phobos -L-L/home/dawg/Code/D/DPL/phobos/generated/linux/release/64/ -L--export-dynamic
Re: The dmd.conf rant
On Wed, 01 Apr 2015 03:19:07 +, deadalnix wrote: > On Wednesday, 1 April 2015 at 02:54:27 UTC, Andrei Alexandrescu wrote: >> On 3/31/15 7:28 PM, Martin Nowak wrote: >>> That dmd.conf is driving me crazy. >> >> Me too! >> >> > I made the complaint some time ago and was told my setup was wrong. I > stopped using master since then, I have no time to fix my build now, and > I'm not sure when I would be able to. > > Happy to see this is bugging others. This needs to be fixed. actually, the fix is very easy: ditch "idgen.d" in favor of old "idgen.c", and patch makefile. both can be done automatically (i did). whoa, i can build DMD without problems again! signature.asc Description: PGP signature
Re: The dmd.conf rant
On Wed, Apr 01, 2015 at 04:28:43AM +0200, Martin Nowak via Digitalmars-d wrote: [...] > That dmd.conf is driving me crazy. No kidding, after idgen.d got merged, I had to spend about an *hour* trying to figure out how to get things to build with the right conf files. [...] > ### conclusion > > The lookup order for the config file should be changed to the following. > - next to dmd binary (highest precedence so that I can have multiple > installations) > - per-user conf folder (HOME) (to override the system-wide config) > - system-wide conf folder (to allow package installations .deb/.rpm) > > The current situation is unmaintainable. +1. This is the order that makes the most sense. I'm astonished it wasn't implemented this way from the start. T -- People say I'm arrogant, and I'm proud of it.
Re: The dmd.conf rant
On 3/31/15 9:43 PM, Martin Nowak wrote: That's only half of the story, because without a config dmd doesn't know where to find druntime/phobos or how to link a binary. Everything can be specified in the command line. -- Andrei
Re: The dmd.conf rant
"ketmar" wrote in message news:mfft3m$2uuc$6...@digitalmars.com... actually, the fix is very easy: ditch "idgen.d" in favor of old "idgen.c", and patch makefile. both can be done automatically (i did). whoa, i can build DMD without problems again! Not exactly a long-term solution.
Re: The dmd.conf rant
"Martin Nowak" wrote in message news:mffl5h$107q$1...@digitalmars.com... ### conclusion The lookup order for the config file should be changed to the following. - next to dmd binary (highest precedence so that I can have multiple installations) - per-user conf folder (HOME) (to override the system-wide config) - system-wide conf folder (to allow package installations .deb/.rpm) The current situation is unmaintainable. I agree, although I'm pleased that it's at least _possible_ to manually choose a specific dmd.conf now. Another thing that seems to be missing is a way to say "only look at the dmd.conf in the same dir as the binary". That wouldn't be perfect, but would make it a lot easier.
Re: The dmd.conf rant
On Wednesday, 1 April 2015 at 02:29:05 UTC, Martin Nowak wrote: [...] ### conclusion The lookup order for the config file should be changed to the following. - next to dmd binary (highest precedence so that I can have multiple installations) - per-user conf folder (HOME) (to override the system-wide config) - system-wide conf folder (to allow package installations .deb/.rpm) The current situation is unmaintainable. How about a sensible default that makes the configuration file unnecessary in most cases? This should be similar to the way %@P% is handled, but relative to the path of the compiler executable rather than the conf file The default for unix-like systems could be: [Environment32] DFLAGS=-I%@E%/../include/dmd/phobos -I@%E@/../include/dmd/druntime/import -L-L@%E@/../lib -L--export-dynamic [Environment64] DFLAGS=-I@%E@/../include/dmd/phobos -I@%E@/../include/dmd/druntime/import -L-L@%E@/../lib64 -L--export-dynamic This should work for both global configurations (/usr/, /usr/local/) and private configurations under your work directory as long as they maintain the same general structure. It would be nice if the default could some also be made to work for a side-by-side checkout of the dmd and druntime repositories with a strategically-placed symlink or some other minimal change. Using dmd.conf should be reserved for exceptions, not the rule.
Re: The dmd.conf rant
On Wed, 01 Apr 2015 19:16:09 +1100, Daniel Murphy wrote: > "ketmar" wrote in message news:mfft3m$2uuc$6...@digitalmars.com... > >> actually, the fix is very easy: ditch "idgen.d" in favor of old >> "idgen.c", >> and patch makefile. both can be done automatically (i did). whoa, i can >> build DMD without problems again! > > Not exactly a long-term solution. sure, but it works for now, and will work for a long time, as DDMD transition is a lenghty process. this will not fix the problem, of course, but it provides working workaround for those who don't have a time/desire to fix it properly. besides, it allows to build DMD without DMD. ;-) signature.asc Description: PGP signature
Re: The dmd.conf rant
On Wednesday, 1 April 2015 at 02:29:05 UTC, Martin Nowak wrote: The lookup order for the config file should be changed to the following. - next to dmd binary (highest precedence so that I can have multiple installations) - per-user conf folder (HOME) (to override the system-wide config) - system-wide conf folder (to allow package installations .deb/.rpm) I've always thought it worked like this :-) So I'm in favour of this change.
Re: The dmd.conf rant
"ketmar" wrote in message news:mfgdjf$2uuc$6...@digitalmars.com... sure, but it works for now, and will work for a long time, as DDMD transition is a lenghty process. Hopefully not too lengthy!
Re: The dmd.conf rant
On 2015-04-01 07:00, H. S. Teoh via Digitalmars-d wrote: On Wed, Apr 01, 2015 at 04:28:43AM +0200, Martin Nowak via Digitalmars-d wrote: The lookup order for the config file should be changed to the following. - next to dmd binary (highest precedence so that I can have multiple installations) - per-user conf folder (HOME) (to override the system-wide config) - system-wide conf folder (to allow package installations .deb/.rpm) The current situation is unmaintainable. +1. This is the order that makes the most sense. I'm astonished it wasn't implemented this way from the start. It isn't implemented like that? Then how is it implemented? -- /Jacob Carlborg
Re: The dmd.conf rant
On Wed, 01 Apr 2015 22:36:39 +1100, Daniel Murphy wrote: > "ketmar" wrote in message news:mfgdjf$2uuc$6...@digitalmars.com... > >> sure, but it works for now, and will work for a long time, as DDMD >> transition is a lenghty process. > > Hopefully not too lengthy! i hope too, as i really want to work on my compiler branch with D! ;-) signature.asc Description: PGP signature
Re: The dmd.conf rant
The way I have set it up personally, there is a single /etc/dmd.conf for latest released package and bunch of ~/devel/dlang-X/bin folders, each with own dmd binary and own dmd.conf side by side with that dmd binary - all added to PATH. Seems to pick up the matching one depending on which binary I actually call.
Re: The dmd.conf rant
On Wednesday, 1 April 2015 at 07:10:20 UTC, Andrei Alexandrescu wrote: Everything can be specified in the command line. -- Andrei This might be a feasible approach for dlang.org or phobos (it's already tedious there), but this doesn't work when you actually want to use a compiler from the command line.
Re: The dmd.conf rant
On Wednesday, 1 April 2015 at 19:20:14 UTC, Dicebot wrote: The way I have set it up personally, there is a single /etc/dmd.conf for latest released package and bunch of ~/devel/dlang-X/bin folders, each with own dmd binary and own dmd.conf side by side with that dmd binary - all added to PATH. Seems to pick up the matching one depending on which binary I actually call. Yes, that's what I used for years. but it doesn't work when you need to use the system-wide dmd in ~/devel/dlang-X. That's the current order, the culprit is current directory which overrides anything else and home directory which overrides exe dir. o current directory o home directory o exe directory (windows) o directory off of argv0 o SYSCONFDIR (default=/etc/) (non-windows) == This is what it should be IMHO. o exe directory (windows) o directory off of argv0 o home directory o SYSCONFDIR (default=/etc/) (non-windows) Take the conf from next to the compiler, or look in the home dir which can override the system-wide conf, or look at the system-wide conf. I guess this might be used completely different on Windows, especially considering that the dmd.conf contains VCDIR variables and such. Any info would be welcome.
Re: The dmd.conf rant
On 2015-04-02 02:33, Martin Nowak wrote: o current directory o home directory o exe directory (windows) o directory off of argv0 o SYSCONFDIR (default=/etc/) (non-windows) This sucks. -- /Jacob Carlborg