This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Linking always generates _dl undefines


>>>>> Dan Christian writes:
Dan> cat hello.c
Dan> #include <stdio.h>
Dan> int main (int argc, char **argv)
int main (void) is also allowed.
Dan> {
Dan>     --argc, ++argv;                     /* use them or we get warnings */
Dan>     printf ("Hello world\n");
Dan>     return 0;
Dan> }

Dan> egcs -o hello -O -I/usr/local/include hello.c -L/usr/local/lib 
Dan> /usr/local/lib/libc.so.6: undefined reference to `_dl_profile_output'
Dan> /usr/local/lib/libc.so.6: undefined reference to `__libc_stack_end'
Dan> /usr/local/lib/libc.so.6: undefined reference to `_dl_debug_impcalls'
Dan> /usr/local/lib/libc.so.6: undefined reference to `_dl_profile'
Dan> /usr/local/lib/libc.so.6: undefined reference to `_dl_check_all_versions'
Dan> /usr/local/lib/libc.so.6: undefined reference to `_dl_start_profile'
Dan> /usr/local/lib/libc.so.6: undefined reference to `_dl_mcount'
Dan> /usr/local/lib/libc.so.6: undefined reference to `_dl_debug_message'
Dan> /usr/local/lib/libc.so.6: undefined reference to `_dl_profile_map'
Dan> collect2: ld returned 1 exit status

Try: 
egcs -o hello -O -I/usr/local/include hello.c -L/usr/local/lib \
-Wl,--rpath=/usr/local/liblib \
-Wl,--dynamic-linker=/usr/local/lib/ld-linux.so.2

The important one is the dynamic-linker.  I guess you link (check with 
gcc -Wl,-v) against /lib/ld-linux.so* which is wrong.  You've got to
use the ld-linux.so.2 that comes with glibc2.0.95 together with the
libc that's part of 2.0.95.

Please check the FAQ entry 2.6 which explains the problem and gives
also another solution.

Andreas
-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]