www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD and LD

reply Lethalman <Lethalman_member pathlink.com> writes:
Hi, i made a simple object of the sample 'hello' by typing:

$ dmd -c hello.d

So i got hello.o
Now i want to link it by using ld and it returns an error:

$ ld -lc -lm -lpthread -lphobos hello.o -o hello
ld: warning: cannot find entry symbol _start; defaulting to 00000000080481a0
hello.o(.gnu.linkonce.t_assert_5hello+0x11): In function `_assert_5hello':
: undefined reference to `_d_assert'
hello.o(.gnu.linkonce.t_array_5hello+0x11): In function `_array_5hello':
: undefined reference to `_d_array_bounds

It works fine down here:

$ gcc -lm -lpthread -lphobos hello.o -o hello

But i need to compile it with ld, any suggestions?
Nov 06 2004
next sibling parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Lethalman wrote:

 Hi, i made a simple object of the sample 'hello' by typing:
 
 $ dmd -c hello.d
 
 So i got hello.o
 Now i want to link it by using ld and it returns an error:
 
 $ ld -lc -lm -lpthread -lphobos hello.o -o hello
 ld: warning: cannot find entry symbol _start; defaulting to 00000000080481a0
 hello.o(.gnu.linkonce.t_assert_5hello+0x11): In function `_assert_5hello':
 : undefined reference to `_d_assert'
 hello.o(.gnu.linkonce.t_array_5hello+0x11): In function `_array_5hello':
 : undefined reference to `_d_array_bounds
 
 It works fine down here:
 
 $ gcc -lm -lpthread -lphobos hello.o -o hello
 
 But i need to compile it with ld, any suggestions?
 
 

Have you tried compiling with gdc? Lars Ivar Igesund
Nov 06 2004
parent reply Lethalman <Lethalman_member pathlink.com> writes:
In article <cmiv5l$246s$1 digitaldaemon.com>, Lars Ivar Igesund says...
Lethalman wrote:

 Hi, i made a simple object of the sample 'hello' by typing:
 
 $ dmd -c hello.d
 
 So i got hello.o
 Now i want to link it by using ld and it returns an error:
 
 $ ld -lc -lm -lpthread -lphobos hello.o -o hello
 ld: warning: cannot find entry symbol _start; defaulting to 00000000080481a0
 hello.o(.gnu.linkonce.t_assert_5hello+0x11): In function `_assert_5hello':
 : undefined reference to `_d_assert'
 hello.o(.gnu.linkonce.t_array_5hello+0x11): In function `_array_5hello':
 : undefined reference to `_d_array_bounds
 
 It works fine down here:
 
 $ gcc -lm -lpthread -lphobos hello.o -o hello
 
 But i need to compile it with ld, any suggestions?
 
 

Have you tried compiling with gdc? Lars Ivar Igesund

about a day to download GCC and compile it with GDC... Do you know it works fine with GDC?
Nov 07 2004
parent Lars Ivar Igesund <larsivar igesund.net> writes:
Lethalman wrote:
 In article <cmiv5l$246s$1 digitaldaemon.com>, Lars Ivar Igesund says...
 
Lethalman wrote:


Hi, i made a simple object of the sample 'hello' by typing:

$ dmd -c hello.d

So i got hello.o
Now i want to link it by using ld and it returns an error:

$ ld -lc -lm -lpthread -lphobos hello.o -o hello
ld: warning: cannot find entry symbol _start; defaulting to 00000000080481a0
hello.o(.gnu.linkonce.t_assert_5hello+0x11): In function `_assert_5hello':
: undefined reference to `_d_assert'
hello.o(.gnu.linkonce.t_array_5hello+0x11): In function `_array_5hello':
: undefined reference to `_d_array_bounds

It works fine down here:

$ gcc -lm -lpthread -lphobos hello.o -o hello

But i need to compile it with ld, any suggestions?

Have you tried compiling with gdc? Lars Ivar Igesund

I can't do it right now! I've a poor 56k and a really poor computer, i need about a day to download GCC and compile it with GDC... Do you know it works fine with GDC?

No idea :) Check out the D.gnu NG. Lars Ivar Igesund
Nov 07 2004
prev sibling parent Ben Hinkle <bhinkle4 juno.com> writes:
Lethalman wrote:

 Hi, i made a simple object of the sample 'hello' by typing:
 
 $ dmd -c hello.d
 
 So i got hello.o
 Now i want to link it by using ld and it returns an error:
 
 $ ld -lc -lm -lpthread -lphobos hello.o -o hello
 ld: warning: cannot find entry symbol _start; defaulting to
 00000000080481a0 hello.o(.gnu.linkonce.t_assert_5hello+0x11): In function
 `_assert_5hello':
 : undefined reference to `_d_assert'
 hello.o(.gnu.linkonce.t_array_5hello+0x11): In function `_array_5hello':
 : undefined reference to `_d_array_bounds
 
 It works fine down here:
 
 $ gcc -lm -lpthread -lphobos hello.o -o hello
 
 But i need to compile it with ld, any suggestions?

looks like it couldn't find phobos since that is where _d_assert and _d_assert_bounds are located. I'm also not sure how to tell it what main to use.
Nov 07 2004