digitalmars.D - dmd/druntime/phobos makefile horror
- Trass3r (21/21) Dec 16 2011 I've always built my libs like that:
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (5/26) Dec 16 2011 I still wonder why druntime has to be in libphobos. It seems silly and
- Andrej Mitrovic (3/3) Dec 16 2011 Also why does druntime come with .di headers but phobos does not? OTOH
- Jonathan M Davis (6/9) Dec 16 2011 It would also kill CTFE for stuff that isn't a template. I'd sooner have...
- Andrej Mitrovic (4/5) Dec 16 2011 I never thought of that.. interesting, so if you want to hide your
- Sean Kelly (5/11) Dec 16 2011 Yup. I may have to change the build process to simply copy modules to =
- Jonathan M Davis (6/12) Dec 16 2011 Templates need to be in the .di file regardless, but for anything not in...
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (3/15) Dec 16 2011 That does seem like a major drawback for anything open source.
- Jonathan M Davis (7/25) Dec 16 2011 Why open source? I mean, if you want to use .di files, that's a problem ...
- Vladimir Panteleev (7/9) Dec 16 2011 I wonder, would it be hard to write our own make implementation
- Brad Roberts (4/13) Dec 16 2011 It'd be a lot harder than just using gnumake which already does all that...
- Vladimir Panteleev (5/23) Dec 16 2011 The answer to that question is the same one as why DMD on Windows
- Trass3r (14/15) Dec 29 2011 A quick and dirty patch would be:
- Christian Manning (34/50) Dec 30 2011 I've been using a similar patch for a while, originally from
I've always built my libs like that: cd druntime git pull -v make MODEL=64 -f posix.mak -j2 make MODEL=32 -f posix.mak -j2 cd ../phobos git pull -v make MODEL=64 -f posix.mak -j2 && mv generated/linux/release/64/libphobos2.a ../../linux/lib64 make MODEL=32 -f posix.mak -j2 && mv generated/linux/release/32/libphobos2.a ../../linux/lib32 Normally I don't need 32bit but now I tried to build an app which fails miserably with phobos2 not found. After removing -L--no-warn-search-mismatch and playing with 'ar x' and 'file' I finally found out 32bit libphobos contains the 64bit version of druntime. The reason is druntime doesn't build separate libs like phobos does. This is just an example of the incoherence of the build system. (Another really bad one is dmd's makefile not allowing to specify debug/release while the windows version sort of does) Can't we get this straight once and for all?
Dec 16 2011
On 16-12-2011 16:48, Trass3r wrote:I've always built my libs like that: cd druntime git pull -v make MODEL=64 -f posix.mak -j2 make MODEL=32 -f posix.mak -j2 cd ../phobos git pull -v make MODEL=64 -f posix.mak -j2 && mv generated/linux/release/64/libphobos2.a ../../linux/lib64 make MODEL=32 -f posix.mak -j2 && mv generated/linux/release/32/libphobos2.a ../../linux/lib32 Normally I don't need 32bit but now I tried to build an app which fails miserably with phobos2 not found. After removing -L--no-warn-search-mismatch and playing with 'ar x' and 'file' I finally found out 32bit libphobos contains the 64bit version of druntime.Ahahaha! So that explains those weird linker errors I never figured out!The reason is druntime doesn't build separate libs like phobos does. This is just an example of the incoherence of the build system. (Another really bad one is dmd's makefile not allowing to specify debug/release while the windows version sort of does) Can't we get this straight once and for all?I still wonder why druntime has to be in libphobos. It seems silly and error-prone to me. - Alex
Dec 16 2011
Also why does druntime come with .di headers but phobos does not? OTOH I doubt it would save much on compilation time since virtually everything in phobos is a template..
Dec 16 2011
On Friday, December 16, 2011 17:41:13 Andrej Mitrovic wrote:Also why does druntime come with .di headers but phobos does not? OTOH I doubt it would save much on compilation time since virtually everything in phobos is a template..It would also kill CTFE for stuff that isn't a template. I'd sooner have druntime _not_ use .di files than have Phobos use them. However, I believe that one of the reasons that druntime does is so that compilation time is saved for the garbage collector. - Jonathan M Davis
Dec 16 2011
On 12/16/11, Jonathan M Davis <jmdavisProg gmx.com> wrote:It would also kill CTFE for stuff that isn't a template.I never thought of that.. interesting, so if you want to hide your sources your users won't be able to use CTFE. (I don't mind that, idc about any closed-source D /libraries/).
Dec 16 2011
On Dec 16, 2011, at 8:45 AM, Jonathan M Davis wrote:On Friday, December 16, 2011 17:41:13 Andrej Mitrovic wrote:OTOHAlso why does druntime come with .di headers but phobos does not? =Yup. I may have to change the build process to simply copy modules to = the import directory so CTFE works. It just stinks that this would be = necessary.=I doubt it would save much on compilation time since virtually everything in phobos is a template..=20 It would also kill CTFE for stuff that isn't a template.
Dec 16 2011
On Friday, December 16, 2011 18:45:01 Andrej Mitrovic wrote:On 12/16/11, Jonathan M Davis <jmdavisProg gmx.com> wrote:Templates need to be in the .di file regardless, but for anything not in the .di file, you can't inline it or use it in CTFE. As such, I'm generally very much against the use of .di files. We've actually had some issues with stuff not being CTFEable because its source wasn't in druntime's .di files. - Jonathan M DavisIt would also kill CTFE for stuff that isn't a template.I never thought of that.. interesting, so if you want to hide your sources your users won't be able to use CTFE. (I don't mind that, idc about any closed-source D /libraries/).
Dec 16 2011
On 16-12-2011 19:27, Jonathan M Davis wrote:On Friday, December 16, 2011 18:45:01 Andrej Mitrovic wrote:That does seem like a major drawback for anything open source. - AlexOn 12/16/11, Jonathan M Davis<jmdavisProg gmx.com> wrote:Templates need to be in the .di file regardless, but for anything not in the .di file, you can't inline it or use it in CTFE. As such, I'm generally very much against the use of .di files. We've actually had some issues with stuff not being CTFEable because its source wasn't in druntime's .di files. - Jonathan M DavisIt would also kill CTFE for stuff that isn't a template.I never thought of that.. interesting, so if you want to hide your sources your users won't be able to use CTFE. (I don't mind that, idc about any closed-source D /libraries/).
Dec 16 2011
On Friday, December 16, 2011 18:55:29 Alex Rønne Petersen wrote:On 16-12-2011 19:27, Jonathan M Davis wrote:Why open source? I mean, if you want to use .di files, that's a problem in general, but what's worse about open source? Usually, I'd expect someone to say that it's worse for closed source, since it makes it harder to give the equivalent of a header file when dealing with 3rd parties you don't want to give all of your code to. - Jonathan M DavisOn Friday, December 16, 2011 18:45:01 Andrej Mitrovic wrote:That does seem like a major drawback for anything open source.On 12/16/11, Jonathan M Davis<jmdavisProg gmx.com> wrote:Templates need to be in the .di file regardless, but for anything not in the .di file, you can't inline it or use it in CTFE. As such, I'm generally very much against the use of .di files. We've actually had some issues with stuff not being CTFEable because its source wasn't in druntime's .di files. - Jonathan M DavisIt would also kill CTFE for stuff that isn't a template.I never thought of that.. interesting, so if you want to hide your sources your users won't be able to use CTFE. (I don't mind that, idc about any closed-source D /libraries/).
Dec 16 2011
On Friday, 16 December 2011 at 15:48:50 UTC, Trass3r wrote:(Another really bad one is dmd's makefile not allowing to specify debug/release while the windows version sort of does)I wonder, would it be hard to write our own make implementation (in D) to replace the DigitalMars one? The goal would be to add support for all the GNU extensions that the posix makefiles use (and the win32 ones make up for with metric tons of copy-pasta), perhaps add built-ins for common POSIX commands, and unify the makefiles.
Dec 16 2011
On Fri, 16 Dec 2011, Vladimir Panteleev wrote:On Friday, 16 December 2011 at 15:48:50 UTC, Trass3r wrote:It'd be a lot harder than just using gnumake which already does all that. Why invest all the time it'd take when a very workable solution already exists?(Another really bad one is dmd's makefile not allowing to specify debug/release while the windows version sort of does)I wonder, would it be hard to write our own make implementation (in D) to replace the DigitalMars one? The goal would be to add support for all the GNU extensions that the posix makefiles use (and the win32 ones make up for with metric tons of copy-pasta), perhaps add built-ins for common POSIX commands, and unify the makefiles.
Dec 16 2011
On Friday, 16 December 2011 at 21:18:45 UTC, Brad Roberts wrote:On Fri, 16 Dec 2011, Vladimir Panteleev wrote:The answer to that question is the same one as why DMD on Windows doesn't use GNU make already. If the reason is significant (e.g. lots of dependencies, sub-par native Windows support, licensing), writing a make implementation doesn't seem too hard.On Friday, 16 December 2011 at 15:48:50 UTC, Trass3r wrote:It'd be a lot harder than just using gnumake which already does all that. Why invest all the time it'd take when a very workable solution already exists?(Another really bad one is dmd's makefile not allowing to specify debug/release while the windows version sort of does)I wonder, would it be hard to write our own make implementation (in D) to replace the DigitalMars one? The goal would be to add support for all the GNU extensions that the posix makefiles use (and the win32 ones make up for with metric tons of copy-pasta), perhaps add built-ins for common POSIX commands, and unify the makefiles.
Dec 16 2011
The reason is druntime doesn't build separate libs like phobos does.A quick and dirty patch would be: diff --git a/posix.mak b/posix.mak index 5fd7fee..9ed2004 100644 --- a/posix.mak +++ b/posix.mak -32,9 +32,9 UDFLAGS=-m$(MODEL) -O -release -nofloat -w -d -Isrc -Iimport -property CFLAGS=-m$(MODEL) -O -OBJDIR=obj +OBJDIR=obj/$(MODEL) DRUNTIME_BASE=druntime -DRUNTIME=lib/lib$(DRUNTIME_BASE).a +DRUNTIME=lib/$(MODEL)/lib$(DRUNTIME_BASE).a DOCFMT=
Dec 29 2011
On Friday, 30 December 2011 at 00:34:13 UTC, Trass3r wrote:I've been using a similar patch for a while, originally from https://bugs.gentoo.org/show_bug.cgi?id=355527 but less of those changes are needed now so it's been stripped down a lot. Would be nice to have this upstream so a proper multilib d toolchain can be built out of the box --- a/src/druntime/posix.mak 2011-06-25 01:39:28.000000000 +0100 +++ b/src/druntime/posix.mak 2011-07-13 16:27:21.307999841 +0100 -25,16 +25,16 DOCDIR=doc IMPDIR=import -MODEL=32 +MODEL?=32 DFLAGS=-m$(MODEL) -O -release -inline -nofloat -w -d -Isrc -Iimport -property UDFLAGS=-m$(MODEL) -O -release -nofloat -w -d -Isrc -Iimport -property CFLAGS=-m$(MODEL) -O -OBJDIR=obj +OBJDIR=obj$(MODEL) DRUNTIME_BASE=druntime -DRUNTIME=lib/lib$(DRUNTIME_BASE).a +DRUNTIME=lib$(MODEL)/lib$(DRUNTIME_BASE).a DOCFMT= --- a/src/phobos/posix.mak 2011-07-10 21:19:30.000000000 +0100 +++ b/src/phobos/posix.mak 2011-07-13 16:27:11.585999804 +0100 -75,7 +75,7 ifeq (,$(findstring win,$(OS))) - DRUNTIME = $(DRUNTIME_PATH)/lib/libdruntime.a + DRUNTIME = $(DRUNTIME_PATH)/lib$(MODEL)/libdruntime.a else DRUNTIME = $(DRUNTIME_PATH)/lib/druntime.lib endifThe reason is druntime doesn't build separate libs like phobos does.A quick and dirty patch would be: diff --git a/posix.mak b/posix.mak index 5fd7fee..9ed2004 100644 --- a/posix.mak +++ b/posix.mak -32,9 +32,9 UDFLAGS=-m$(MODEL) -O -release -nofloat -w -d -Isrc -Iimport -property CFLAGS=-m$(MODEL) -O -OBJDIR=obj +OBJDIR=obj/$(MODEL) DRUNTIME_BASE=druntime -DRUNTIME=lib/lib$(DRUNTIME_BASE).a +DRUNTIME=lib/$(MODEL)/lib$(DRUNTIME_BASE).a DOCFMT=
Dec 30 2011