April 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7044


Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@dawg.eu


--- Comment #10 from Martin Nowak <code@dawg.eu> 2013-04-11 16:18:03 PDT ---
I think link flags should not be hardcoded in the compiler. They are platform dependent and belong into a configuration file so that package maintainers can easily patch them.

I don't see why we need defaultlib/debuglib if one can specify link flags.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7044



--- Comment #11 from Leandro Lucarella <leandro.lucarella@sociomantic.com> 2013-04-12 03:33:40 PDT ---
(In reply to comment #10)
> I think link flags should not be hardcoded in the compiler. They are platform dependent and belong into a configuration file so that package maintainers can easily patch them.
> 
> I don't see why we need defaultlib/debuglib if one can specify link flags.

Is need to allow changing easily between a "normal" and a "debug" build with -debug or -g (I don't remember which one triggers switching to debuglib instead of using defaultlib). Projects can't do that by themselves because they don't need to know where the runtime is installed and how can they switch between a library compiled with debug symbols (and maybe assertions, contracts, etc.) and the normal one.

I think what I proposed is general enough to support all that, even having the debug library need to link to different libraries than the normal library.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7044



--- Comment #12 from Martin Nowak <code@dawg.eu> 2013-04-12 07:34:47 PDT ---
(In reply to comment #11)
> Is need to allow changing easily between a "normal" and a "debug" build with -debug or -g (I don't remember which one triggers switching to debuglib instead of using defaultlib).

You can do by supporting configurations in the config file, e.g.
Environment32/Environment64 [1] or dub packages [2][3].
One could also use different config files and introduce a -conf argument.

[1]: https://github.com/D-Programming-Language/dmd/pull/1220 [2]: http://registry.vibed.org/package-format#build-settings [3]: http://registry.vibed.org/package-format#configurations

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7044



--- Comment #13 from Leandro Lucarella <leandro.lucarella@sociomantic.com> 2013-04-15 04:48:39 PDT ---
(In reply to comment #12)
> (In reply to comment #11)
> > Is need to allow changing easily between a "normal" and a "debug" build with -debug or -g (I don't remember which one triggers switching to debuglib instead of using defaultlib).
> 
> You can do by supporting configurations in the config file, e.g.
> Environment32/Environment64 [1] or dub packages [2][3].
> One could also use different config files and introduce a -conf argument.
> 
> [1]: https://github.com/D-Programming-Language/dmd/pull/1220 [2]: http://registry.vibed.org/package-format#build-settings [3]: http://registry.vibed.org/package-format#configurations

I still can see how that could help changing the runtime library and all its dependencies while linking with -debug (or -gc). Could you provide a concrete example on how would you achieve that?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 26, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7044


Ellery Newcomer <ellery-newcomer@utulsa.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ellery-newcomer@utulsa.edu


--- Comment #14 from Ellery Newcomer <ellery-newcomer@utulsa.edu> 2013-05-26 08:45:55 PDT ---
Since the fixup to the link command in this case is quite simple, how about a flag in dmd that performs a dry run and just prints out the link command?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 27, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7044



--- Comment #15 from Leandro Lucarella <leandro.lucarella@sociomantic.com> 2013-05-27 09:28:43 PDT ---
(In reply to comment #14)
> Since the fixup to the link command in this case is quite simple, how about a flag in dmd that performs a dry run and just prints out the link command?

I think that's just an ugly hack. What's wrong with the solution I proposed which I think solves the problem from the root?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7044



--- Comment #16 from Martin Nowak <code@dawg.eu> 2013-05-29 06:52:53 PDT ---
(In reply to comment #15)
> I think that's just an ugly hack. What's wrong with the solution I proposed which I think solves the problem from the root?

It would be the fourth compiler flag that alters the link flags.

There are two problems:
The runtime dependencies are hardcoded in the compiler.
The flags -debuglib and -defaultlib make linking more complicated even though
they are almost redundant and can be replaced with -L-l.

What we could do IMHO is to allow sections in dmd.conf for certain build settings.

[Environment]
DFLAGS=-w -g

[Environment-X86]
DFLAGS+=-L-L/usr/lib32

[Environment-X86_64]
DFLAGS+=-L-L/usr/lib64

[Environment-release]
DFLAGS+=-L-lphobos

[Environment-debug]
DFLAGS+=-L-lphobos_d

[Environment-linux]
DFLAGS+=-L-lrt -L-lpthread -L-ldl

[Environment-myversion]
DFLAGS=

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7044



--- Comment #17 from Leandro Lucarella <leandro.lucarella@sociomantic.com> 2013-05-29 07:01:53 PDT ---
(In reply to comment #16)
> (In reply to comment #15)
> > I think that's just an ugly hack. What's wrong with the solution I proposed which I think solves the problem from the root?
> 
> It would be the fourth compiler flag that alters the link flags.
> 
> There are two problems:
> The runtime dependencies are hardcoded in the compiler.

Agreed

> The flags -debuglib and -defaultlib make linking more complicated even though they are almost redundant and can be replaced with -L-l.

I don't agree with this, because you need to change a whole set of flags depending on which runtime you are using. -L-l is just not good enough.

> What we could do IMHO is to allow sections in dmd.conf for certain build settings.
> 
> [Environment]
> DFLAGS=-w -g
> 
> [Environment-X86]
> DFLAGS+=-L-L/usr/lib32
> 
> [Environment-X86_64]
> DFLAGS+=-L-L/usr/lib64
> 
> [Environment-release]
> DFLAGS+=-L-lphobos
> 
> [Environment-debug]
> DFLAGS+=-L-lphobos_d
> 
> [Environment-linux]
> DFLAGS+=-L-lrt -L-lpthread -L-ldl
> 
> [Environment-myversion]
> DFLAGS=

This will fix the debug vs. normal runtime, true, but it doesn't help to *easily* use a different runtime library, you have to mess with the config file, but I want a way to do it from the command line, so it can be integrated in the build system.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7044



--- Comment #18 from Martin Nowak <code@dawg.eu> 2013-05-29 07:33:53 PDT ---
(In reply to comment #17)
> I don't agree with this, because you need to change a whole set of flags depending on which runtime you are using. -L-l is just not good enough.
> 
True, but that's not what the compiler does at the moment.

> This will fix the debug vs. normal runtime, true, but it doesn't help to *easily* use a different runtime library, you have to mess with the config file, but I want a way to do it from the command line, so it can be integrated in the build system.

[Environment-tango-X86_64]
...

dmd -m64 -version=tango ...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7044



--- Comment #19 from Leandro Lucarella <leandro.lucarella@sociomantic.com> 2013-05-29 07:51:03 PDT ---
(In reply to comment #18)
> (In reply to comment #17)
> > I don't agree with this, because you need to change a whole set of flags depending on which runtime you are using. -L-l is just not good enough.
> > 
> True, but that's not what the compiler does at the moment.
> 
> > This will fix the debug vs. normal runtime, true, but it doesn't help to *easily* use a different runtime library, you have to mess with the config file, but I want a way to do it from the command line, so it can be integrated in the build system.
> 
> [Environment-tango-X86_64]
> ...
> 
> dmd -m64 -version=tango ...

Mmmm, I don't like the idea of having to mess with the config file, but since you can actually create one even in your home, I think I ran out of technical arguments, so my only objection about that solution is purely aesthetic.

Summary: I'm sold.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------