Jump to page: 1 2
Thread overview
D tools build problem
Feb 11, 2014
Dicebot
Feb 11, 2014
Dicebot
Feb 11, 2014
Dicebot
Mar 01, 2014
Martin Nowak
February 11, 2014
Hello all,

I've started encountering a problem recently when building the D tools (i.e. rdmd et al.).

$ make -f posix.mak
../dmd/src/dmd -m64  -ofgenerated/linux/64/rdmd rdmd.d
Error: cannot find source code for runtime library file 'object.d'
       dmd might not be correctly installed. Run 'dmd -man' for installation instructions.
Specify path to file 'object.d' with -I switch
make: *** [generated/linux/64/rdmd] Error 1

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.

There's an easy workaround -- use

    make -f posix.mak DMD=/opt/bin/dmd

(i.e. using the just-installed-2-minutes-before dmd), but it's annoying.  Is this a known issue?  Is there something I need to change about my build setup that I've missed?

Thanks & best wishes,

    -- Joe
February 11, 2014
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.
February 11, 2014
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.
February 11, 2014
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.
February 11, 2014
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

;)
February 11, 2014
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.
February 11, 2014
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 ... :-)
February 11, 2014
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



February 20, 2014
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

March 01, 2014
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

0000000000000000 T _Dmain
« First   ‹ Prev
1 2