www.digitalmars.com         C & C++   DMDScript  

D - BUG: undefined references, DMD

reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
I ran across this on RH 7.2, gcc 2.96 (same as you Walter)

I get "undefined reference" errors when I compile the following code:



int main(char[][] argv)
{
  switch(argv[0])
  {
  case "asdf":
  case "jkl":
    return 1;

  case "qwerty":
    return 2;

  default:
    return 0;
  }
}



I compiled it with:
    dmd -c dmd_bug2
    cc -lphobos -lpthread dmd_bug2.o -o dmd_bug2



--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
May 12 2003
parent reply "Walter" <walter digitalmars.com> writes:
What is the undefined reference to?
May 12 2003
parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
_d_switch_string and _d_array_bounds.

I originally came across this error when I tried to link my large app
(ported from DLI) and got to the linking phase.  In that larger app, I
have lots (100 or more) of such errors, many of which seem to be link
problems to phobos.  Some other ones seem to be internally implemented
functions, like _aaIn _aaGet _init_TypeInfo_Aa and such.

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
May 12 2003
parent reply "Walter" <walter digitalmars.com> writes:
I don't get it. They're in the library, and they're found on my system.

"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3EC01FA9.59C444B6 deming-os.org...
 _d_switch_string and _d_array_bounds.

 I originally came across this error when I tried to link my large app
 (ported from DLI) and got to the linking phase.  In that larger app, I
 have lots (100 or more) of such errors, many of which seem to be link
 problems to phobos.  Some other ones seem to be internally implemented
 functions, like _aaIn _aaGet _init_TypeInfo_Aa and such.

 --
 The Villagers are Online! villagersonline.com

 .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
 .[ (a version.of(English).(precise.more)) is(possible) ]
 ?[ you want.to(help(develop(it))) ]
May 13 2003
parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
I'm confused, too.  I can find the symbols with grep.  I do get "bad
relocation symbol" warnings, as well.  (sigh)  I guess I'll copy it all (by
hand, unfortunately).

On RH7.2, gcc 2.96, I get these errors:



dmd_bug2.o: In function '_Dmain':
dmd_bug2.o(.gnu.linkonce.t_dmain+0x30): undefined reference to
'_d_switch_string'
dmd_bug2.o: In function '_array_dmd_bug2':
dmd_bug2.o(.gnu.linkonce.t_array_dmd_bug2+0x14): undefined reference to
'_d_array_bounds'
collect2: ld returned 1 exit status



On RH9, gcc 3.2.2, I also get this error (first, before the others):



/usr/bin/ld:
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libphobos.a(gc.o): bad
relocation section name '.rel.gnu.linkonce.t_d_new? '




BTW, /etc/dmd.conf doesn't seem to work for me so far...so I'm having to add
-I<phobosPath> to my dmd commands.



Walter wrote:

 I don't get it. They're in the library, and they're found on my system.

 "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
 news:3EC01FA9.59C444B6 deming-os.org...
 _d_switch_string and _d_array_bounds.

 I originally came across this error when I tried to link my large app
 (ported from DLI) and got to the linking phase.  In that larger app, I
 have lots (100 or more) of such errors, many of which seem to be link
 problems to phobos.  Some other ones seem to be internally implemented
 functions, like _aaIn _aaGet _init_TypeInfo_Aa and such.

 --
 The Villagers are Online! villagersonline.com

 .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
 .[ (a version.of(English).(precise.more)) is(possible) ]
 ?[ you want.to(help(develop(it))) ]
-- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
May 13 2003
parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
I've tried to build a new libphobos.a from the sources, t osee if that would
clear up the problem.  I ran into a couple of problems.

* FIXED: the makefile mentions "deh2.d", which doesn't exist, so I deleted it
* FIXED: the makefile has the wrong location for DMD, so I changed that to just
"dmd"
* COULDN'T FIX: outbuffer.d calls vsnprintf, which doesn't seem to be defined in
any source file I can find

I'm really appreciating your continued hard work, Walter.
Russ



Russ Lewis wrote:

 I'm confused, too.  I can find the symbols with grep.  I do get "bad
 relocation symbol" warnings, as well.  (sigh)  I guess I'll copy it all (by
 hand, unfortunately).

 On RH7.2, gcc 2.96, I get these errors:

 dmd_bug2.o: In function '_Dmain':
 dmd_bug2.o(.gnu.linkonce.t_dmain+0x30): undefined reference to
 '_d_switch_string'
 dmd_bug2.o: In function '_array_dmd_bug2':
 dmd_bug2.o(.gnu.linkonce.t_array_dmd_bug2+0x14): undefined reference to
 '_d_array_bounds'
 collect2: ld returned 1 exit status

 On RH9, gcc 3.2.2, I also get this error (first, before the others):

 /usr/bin/ld:
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libphobos.a(gc.o): bad
 relocation section name '.rel.gnu.linkonce.t_d_new? '

 BTW, /etc/dmd.conf doesn't seem to work for me so far...so I'm having to add
 -I<phobosPath> to my dmd commands.

 Walter wrote:

 I don't get it. They're in the library, and they're found on my system.

 "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
 news:3EC01FA9.59C444B6 deming-os.org...
 _d_switch_string and _d_array_bounds.

 I originally came across this error when I tried to link my large app
 (ported from DLI) and got to the linking phase.  In that larger app, I
 have lots (100 or more) of such errors, many of which seem to be link
 problems to phobos.  Some other ones seem to be internally implemented
 functions, like _aaIn _aaGet _init_TypeInfo_Aa and such.

 --
 The Villagers are Online! villagersonline.com

 .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
 .[ (a version.of(English).(precise.more)) is(possible) ]
 ?[ you want.to(help(develop(it))) ]
-- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
-- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
May 14 2003
parent reply "Walter" <walter digitalmars.com> writes:
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3EC28DFD.81BF2EE9 deming-os.org...
 I've tried to build a new libphobos.a from the sources, t osee if that
would
 clear up the problem.  I ran into a couple of problems.

 * FIXED: the makefile mentions "deh2.d", which doesn't exist, so I deleted
it All right, but it never tries to add it to libphobos.a!
 * FIXED: the makefile has the wrong location for DMD, so I changed that to
just
 "dmd"
Ok.
 * COULDN'T FIX: outbuffer.d calls vsnprintf, which doesn't seem to be
defined in
 any source file I can find
vnsprintf is part of the C runtime library. It should be in c.stdio.d
 I'm really appreciating your continued hard work, Walter.
Thanks!
May 14 2003
parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Ok, I've been stepping through this thing, trying to link something together.
Walter, is this src/phobos the directory you built libphobos.a from?  I'm having
a heck of a time trying to get things to work.

Right now, I'm stuck on deh.c, line 528.  I'm getting a few errors.  First of
all, gcc seems to gripe about that __stdcall modifier; I tried commenting it out
and got a little further, but I don't know if we need to leave it in.

Then, on line 535, I get "'_EBP' undeclared"

Any fixes for these?

Thanks again,
    Russ



Walter wrote:

 "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
 news:3EC28DFD.81BF2EE9 deming-os.org...
 I've tried to build a new libphobos.a from the sources, t osee if that
would
 clear up the problem.  I ran into a couple of problems.

 * FIXED: the makefile mentions "deh2.d", which doesn't exist, so I deleted
it All right, but it never tries to add it to libphobos.a!
 * FIXED: the makefile has the wrong location for DMD, so I changed that to
just
 "dmd"
Ok.
 * COULDN'T FIX: outbuffer.d calls vsnprintf, which doesn't seem to be
defined in
 any source file I can find
vnsprintf is part of the C runtime library. It should be in c.stdio.d
 I'm really appreciating your continued hard work, Walter.
Thanks!
-- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
May 15 2003
parent "Walter" <walter digitalmars.com> writes:
Oops, I think that's the wrong file. I'll try & get the right one.

"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3EC3B859.373C4273 deming-os.org...
 Ok, I've been stepping through this thing, trying to link something
together.
 Walter, is this src/phobos the directory you built libphobos.a from?  I'm
having
 a heck of a time trying to get things to work.

 Right now, I'm stuck on deh.c, line 528.  I'm getting a few errors.  First
of
 all, gcc seems to gripe about that __stdcall modifier; I tried commenting
it out
 and got a little further, but I don't know if we need to leave it in.

 Then, on line 535, I get "'_EBP' undeclared"

 Any fixes for these?

 Thanks again,
     Russ
May 15 2003