Hacking on Phobos

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Tue Apr 17 11:10:51 PDT 2012


Hello all,

As per earlier discussion I'm trying to hack on Phobos to update the random 
sampling code.

To do this I've just copied random.d into a new file, randomsample.d, which I'm 
modifying and messing around with; I'm trying to build against a local copy of 
the GitHub Phobos sources.

When I try and compile,

    gdc -nophoboslib -I../phobos/ -o randomsample randomsample.d

I get a huge list of errors, beginning with:

/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 0 has invalid symbol index 10
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 1 has invalid symbol index 11
/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 10
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 5 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 6 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 7 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 8 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): 
relocation 9 has invalid symbol index 2

... and continuing on with a huge number of undefined reference errors.

To check if it was the source of the problem, I tried downloading and building a 
local copy of the latest druntime, but the build process fails:

$ make -f posix.mak MODEL=64

[lots of successful stuff, followed by ...]

src/object_.d(237): Error: function object.TypeInfo.toHash of type @trusted 
ulong() overrides but is not covariant with object.Object.toHash of type nothrow 
@trusted ulong()
src/object_.d(237): Error: function object.TypeInfo.toHash does not override any 
function
src/object_.d(347): Error: function object.TypeInfo_Vector.getHash of type 
ulong(const(void*) p) overrides but is not covariant with 
object.TypeInfo.getHash of type nothrow @trusted ulong(const(void*) p)
src/object_.d(347): Error: function object.TypeInfo_Vector.getHash does not 
override any function

I can't find any easy or friendly "get started hacking on Phobos" page, so can 
anyone advise how to get set up correctly?

Thanks & best wishes,

     -- Joe


More information about the Digitalmars-d-learn mailing list