Jump to page: 1 2
Thread overview
The dmd.conf rant
Apr 01, 2015
Martin Nowak
Apr 01, 2015
deadalnix
Apr 01, 2015
ketmar
Apr 01, 2015
Daniel Murphy
Apr 01, 2015
ketmar
Apr 01, 2015
Daniel Murphy
Apr 01, 2015
ketmar
Apr 01, 2015
Martin Nowak
Apr 02, 2015
Martin Nowak
Apr 01, 2015
H. S. Teoh
Apr 01, 2015
Jacob Carlborg
Apr 01, 2015
Daniel Murphy
Apr 01, 2015
Oren Tirosh
Apr 01, 2015
Martin Krejcirik
Apr 01, 2015
Dicebot
Apr 02, 2015
Martin Nowak
Apr 02, 2015
Jacob Carlborg
April 01, 2015
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.
April 01, 2015
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

April 01, 2015
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.
April 01, 2015
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
April 01, 2015
On Wed, 01 Apr 2015 03:19:07 +0000, 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!

April 01, 2015
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.
April 01, 2015
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
April 01, 2015
"ketmar"  wrote in message news:mfft3m$2uuc$66@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. 

April 01, 2015
"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. 

April 01, 2015
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.
« First   ‹ Prev
1 2