Re: D tools build problem

2014-03-01 Thread Joseph Rushton Wakeling

On 02/03/14 00:07, Joseph Rushton Wakeling wrote:

config/etc/dmd.conf


This is interesting.  My system doesn't have an /etc/dmd.conf file: I always 
place dmd.conf in the same directory as the dmd binary.


Could it be that people not seeing my linker errors are doing so because the 
tools build is picking up on flags in an /etc/dmd.conf introduced with an 
earlier install?




Re: D tools build problem

2014-03-01 Thread Joseph Rushton Wakeling

On 01/03/14 23:35, Martin Nowak wrote:

What are the actual gcc arguments?


Thanks for the advice here -- I appreciate it :-)


For me running

../dmd/src/dmd -m64 -I../druntime/import -I../phobos
-L-L../phobos/generated/linux/release/64  -w -v -ofgenerated/linux/64/dget
generated/linux/64/dget.o 2>/dev/null | grep '\-Xlinker'

prints

gcc generated/linux/64/dget.o -o generated/linux/64/dget -m64
-L../phobos/generated/linux/release/64 -L/usr/lib64 -Xlinker --export-dynamic
-l:libphobos2.a -lpthread -lm -lrt.


For me:

$ ../dmd/src/dmd -m64 -I../druntime/import -I../phobos 
-L-L../phobos/generated/linux/release/64  -w -v -ofgenerated/linux/64/dget 
generated/linux/64/dget.o

binary../dmd/src/dmd
version   v2.065-devel-0d01545
config/etc/dmd.conf
gcc generated/linux/64/dget.o -o generated/linux/64/dget -m64 
-L../phobos/generated/linux/release/64 -l:libphobos2.a -lpthread -lm -lrt


If I try literally using the statement you posted, I get no output at all.


Also check wheter the dget.o object has a D main.

nm generated/linux/64/changed.o | grep _Dmain

 T _Dmain


$ nm generated/linux/64/dget.o | grep _Dmain
 T _Dmain
 U _Dmain




Re: D tools build problem

2014-03-01 Thread Martin Nowak
On Tuesday, 11 February 2014 at 23:06:27 UTC, Joseph Rushton 
Wakeling wrote:
With these flags in place, the following error message is 
produced:


(../dmd/src/dmd -m64 -I../druntime/import -I../phobos
-L-L../phobos/generated/linux/release/64  -w -v 
-ofgenerated/linux/64/dget
generated/linux/64/dget.o 2>/dev/null | grep '\-Xlinker' | cut 
-f2- -d' ' ; echo

-lcurl  ) | xargs gcc


What are the actual gcc arguments?
For me running

../dmd/src/dmd -m64 -I../druntime/import -I../phobos 
-L-L../phobos/generated/linux/release/64  -w -v 
-ofgenerated/linux/64/dget generated/linux/64/dget.o 2>/dev/null 
| grep '\-Xlinker'


prints

gcc generated/linux/64/dget.o -o generated/linux/64/dget -m64 
-L../phobos/generated/linux/release/64 -L/usr/lib64 -Xlinker 
--export-dynamic -l:libphobos2.a -lpthread -lm -lrt.


Also check wheter the dget.o object has a D main.

nm generated/linux/64/changed.o | grep _Dmain

 T _Dmain


Re: D tools build problem

2014-02-20 Thread Joseph Rushton Wakeling

On 12/02/14 00:06, Joseph Rushton Wakeling wrote:

I've attached my current patch.  It should be possible to apply this to master,
if anyone wants to test it.


I fixed my patch :-)

https://github.com/D-Programming-Language/tools/pull/117



Re: D tools build problem

2014-02-11 Thread Joseph Rushton Wakeling

On 11/02/14 23:33, Joseph Rushton Wakeling wrote:

On 11/02/14 23:18, Dicebot wrote:

On Tuesday, 11 February 2014 at 22:10:21 UTC, Joseph Rushton Wakeling wrote:

Exactly what I thought, but they _have_ been built and they are located in the
right places.  That's why I was baffled by the error message.


../dmd/src/dmd -I../druntime/src -I../phobos rdmd.d


Yeah, yeah. :-P  I mean I was baffled that the error was occurring and at first
glance assumed it must be something weirder.  Didn't anybody test this?

I'll see if I can knock up a patch ... :-)


I've attached my current patch.  It should be possible to apply this to master, 
if anyone wants to test it.


It works for everything except the CURL_TOOLS which invariably fail to link with 
the error described at the bottom of this email.  It looks like a main() 
function is absent where one is expected, but my make-fu is not good enough to 
understand what's wrong with the relevant lines in the makefile:




#dreadful custom step because of libcurl dmd linking problem (Bugzilla 7044)
$(CURL_TOOLS): $(ROOT)/%: %.d
$(DMD) $(MODEL_FLAG) $(DFLAGS) -c -of$(@).o $(<)
($(DMD) $(MODEL_FLAG) $(DFLAGS) -v -of$(@) $(@).o 2>/dev/null | grep 
'\-Xlinker' | cut -f2- -d' ' ; echo -lcurl  ) | xargs $(CC)




Note that the $(MODEL_FLAG) $(DFLAGS) entries here are my addition.  Absent the 
$(DFLAGS) entry the build will fail with the same issue of being unable to find 
object.d.


With these flags in place, the following error message is produced:

(../dmd/src/dmd -m64 -I../druntime/import -I../phobos 
-L-L../phobos/generated/linux/release/64  -w -v -ofgenerated/linux/64/dget 
generated/linux/64/dget.o 2>/dev/null | grep '\-Xlinker' | cut -f2- -d' ' ; echo 
-lcurl  ) | xargs gcc
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 8 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 9 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 10 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 11 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 12 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 13 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 14 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 15 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 16 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 17 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 18 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 19 has invalid symbol index 21
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): 
relocation 0 has invalid symbol index 2
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function 
`_start':

(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [generated/linux/64/dget] Error 123

>From 35cf26e7104b7b7975bf16f795600a4644236c36 Mon Sep 17 00:00:00 2001
From: Joseph Rushton Wakeling 
Date: Tue, 11 Feb 2014 23:59:28 +0100
Subject: [PATCH] Update posix.mak to use local, recently-built druntime and
 phobos.

---
 posix.mak | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/posix.mak b/posix.mak
index 5f8926a..126c786 100644
--- a/posix.mak
+++ b/posix.m

Re: D tools build problem

2014-02-11 Thread Joseph Rushton Wakeling

On 11/02/14 23:18, Dicebot wrote:

On Tuesday, 11 February 2014 at 22:10:21 UTC, Joseph Rushton Wakeling wrote:

Exactly what I thought, but they _have_ been built and they are located in the
right places.  That's why I was baffled by the error message.


../dmd/src/dmd -I../druntime/src -I../phobos rdmd.d


Yeah, yeah. :-P  I mean I was baffled that the error was occurring and at first 
glance assumed it must be something weirder.  Didn't anybody test this?


I'll see if I can knock up a patch ... :-)


Re: D tools build problem

2014-02-11 Thread Joseph Rushton Wakeling

On 11/02/14 23:10, Joseph Rushton Wakeling wrote:

On 11/02/14 22:22, Dicebot wrote:

It looks for ../druntime - this is where object.di is located, not in compiler
repo. You need all of those - dmd, druntime and phobos build before tools.


Exactly what I thought, but they _have_ been built and they are located in the
right places.  That's why I was baffled by the error message.


Actually, on looking inside the tools makefile, it's not looking for ../druntime 
at all.  The D compiler has been hardcoded to ../dmd/src/dmd but there is no 
DRUNTIME_PATH defined as there is in e.g. the phobos posix.mak.


Re: D tools build problem

2014-02-11 Thread Dicebot
On Tuesday, 11 February 2014 at 22:10:21 UTC, Joseph Rushton 
Wakeling wrote:
Exactly what I thought, but they _have_ been built and they are 
located in the right places.  That's why I was baffled by the 
error message.


../dmd/src/dmd -I../druntime/src -I../phobos rdmd.d

;)


Re: D tools build problem

2014-02-11 Thread Joseph Rushton Wakeling

On 11/02/14 22:22, Dicebot wrote:

It looks for ../druntime - this is where object.di is located, not in compiler
repo. You need all of those - dmd, druntime and phobos build before tools.


Exactly what I thought, but they _have_ been built and they are located in the 
right places.  That's why I was baffled by the error message.


Re: D tools build problem

2014-02-11 Thread Dicebot

P.S. Though I don't know if makefile is up to date for tools repo
- I have always build needed tools by manually supplying import
paths and invoking dmd directly.


Re: D tools build problem

2014-02-11 Thread Dicebot
On Tuesday, 11 February 2014 at 21:16:34 UTC, Joseph Rushton 
Wakeling wrote:
I take it the error is because the makefile tries to build 
using ../dmd/src/dmd (which exists, I've built it) but can't 
find the corresponding runtime files.


It looks for ../druntime - this is where object.di is located, 
not in compiler repo. You need all of those - dmd, druntime and 
phobos build before tools.