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 <j...@webdrake.net>
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.mak
@@ -1,6 +1,8 @@
DMD = ../dmd/src/dmd
CC = gcc
INSTALL_DIR = ../install
+DRUNTIME_PATH = ../druntime
+PHOBOS_PATH = ../phobos
WITH_DOC = no
DOC = ../dlang.org/web
@@ -48,6 +50,23 @@ MODEL_FLAG=-m$(MODEL)
ROOT_OF_THEM_ALL = generated
ROOT = $(ROOT_OF_THEM_ALL)/$(OS)/$(MODEL)
+# Set DRUNTIME name and full path
+ifeq (,$(findstring win,$(OS)))
+ DRUNTIME = $(DRUNTIME_PATH)/lib/libdruntime-$(OS)$(MODEL).a
+ DRUNTIMESO = $(DRUNTIME_PATH)/lib/libdruntime-$(OS)$(MODEL).so.a
+else
+ DRUNTIME = $(DRUNTIME_PATH)/lib/druntime.lib
+endif
+
+# Set PHOBOS name and full path
+ifeq (,$(findstring win,$(OS)))
+ PHOBOS = $(PHOBOS_PATH)/generated/$(OS)/release/$(MODEL)/libphobos2.a
+ PHOBOSSO = $(PHOBOS_PATH)/generated/$(OS)/release/$(MODEL)/libphobos2.so
+endif
+
+# Set DFLAGS
+DFLAGS = -I$(DRUNTIME_PATH)/import -I$(PHOBOS_PATH) -L-L$(PHOBOS_PATH)/generated/$(OS)/release/$(MODEL) $(DMDEXTRAFLAGS) -w
+
TOOLS = \
$(ROOT)/rdmd \
$(ROOT)/ddemangle \
@@ -97,12 +116,12 @@ dman: $(ROOT)/dman
dustmite: $(ROOT)/dustmite
$(ROOT)/dustmite: DustMite/dustmite.d DustMite/dsplit.d
- $(DMD) $(MODEL_FLAG) DustMite/dustmite.d DustMite/dsplit.d -of$(@)
+ $(DMD) $(MODEL_FLAG) $(DFLAGS) DustMite/dustmite.d DustMite/dsplit.d -of$(@)
#dreadful custom step because of libcurl dmd linking problem (Bugzilla 7044)
$(CURL_TOOLS): $(ROOT)/%: %.d
- $(DMD) -c -of$(@).o $(<)
- ($(DMD) -v -of$(@) $(@).o 2>/dev/null | grep '\-Xlinker' | cut -f2- -d' ' ; echo -lcurl ) | xargs $(CC)
+ $(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)
$(TOOLS) $(DOC_TOOLS): $(ROOT)/%: %.d
$(DMD) $(MODEL_FLAG) $(DFLAGS) -of$(@) $(<)
--
1.9.rc1