Loading ...
Sorry, an error occurred while loading the content.

Need help with link error

Expand Messages
  • cubedweller16117
    Hi, Hopefully, someone will be able to help me with this issue. I cross- compiled mpatrol and I m trying to link a tiny program to test my work. When I
    Message 1 of 2 , May 22, 2003
    View Source
    • 0 Attachment
      Hi,

      Hopefully, someone will be able to help me with this issue. I cross-
      compiled mpatrol and I'm trying to link a tiny program to test my
      work. When I compile, I'm doing the following:

      i586-linux-gcc -I${MPATROL_SRC} \
      -L${RFS}/usr/lib \
      -L${MPATROL_BUILD} \
      -lmpatrol -lbfd -liberty \
      test.c -o test

      MPATROL points to the mpatrol/src folder, RFS is the root file system
      used by the target and MPATROL build is the mpatrol/build/unix
      directory where I did my compilation.

      I get this error when I link:

      /opt/timesys/linux/4.0/x86bsp/rfs/usr/lib/libbfd.a(elf-strtab.o): In
      function `_bfd_elf_strtab_finalize':
      /home/build/Src/rfstools/packages/binutils/binutils-
      build/bfd/../../package/bfd/elf-strtab.c:355: undefined reference to
      `htab_create_alloc'
      /opt/timesys/linux/4.0/x86bsp/rfs/usr/lib/libbfd.a(merge.o): In
      function `merge_strings':
      /home/build/Src/rfstools/packages/binutils/binutils-
      build/bfd/../../package/bfd/merge.c:646: undefined reference to
      `htab_create_alloc'
      /home/build/Src/rfstools/packages/binutils/binutils-
      build/bfd/../../package/bfd/merge.c:648: undefined reference to
      `htab_create_alloc'
      collect2: ld returned 1 exit status
      make: *** [test] Error 1

      Here's the contents of my program:

      #include "mpatrol.h"

      int main(int argc, char* argv[]) {
      int* pInt = (int*) malloc(sizeof(int)); /* leak */
      return 0;
      }

      So in order reduce complexity, I tried linking with -static and I got
      this error:

      /tmp/ccUSt26T.o: In function `main':
      /tmp/ccUSt26T.o(.text+0x2c): undefined reference to `__mp_alloc'
      collect2: ld returned 1 exit status

      I don't understand this error because it looks like __mp_alloc is a
      public symbol (or at least nm says it is!) in libmpatrol.a

      At this point I'm stumpted. The linker is finding the right library
      files, I linked with --verbose to double-check. Can anyone offer
      assistance or advice?

      TIA
      gene
    • Greg Chicares
      ... See http://groups.yahoo.com/group/mpatrol/message/789 Try a different libiberty.a, or copy the libiberty sources into your mpatrol sources and build them
      Message 2 of 2 , May 22, 2003
      View Source
      • 0 Attachment
        cubedweller16117 wrote:
        >
        > /opt/timesys/linux/4.0/x86bsp/rfs/usr/lib/libbfd.a(elf-strtab.o): In
        > function `_bfd_elf_strtab_finalize':
        > /home/build/Src/rfstools/packages/binutils/binutils-
        > build/bfd/../../package/bfd/elf-strtab.c:355: undefined reference to
        > `htab_create_alloc'

        See
        http://groups.yahoo.com/group/mpatrol/message/789
        Try a different libiberty.a, or copy the libiberty
        sources into your mpatrol sources and build them
        along with mpatrol.
      Your message has been successfully submitted and would be delivered to recipients shortly.