Web lists-archives.com

[Mingw-users] libaddr2line.a: dependencies of libbfd.a?




Hi,

 

my ultimate goal is to have a library libaddr2line.a for MinGW compilation. If my understanding is correct, then the library bfd is required for this.

 

To start with, compiling the mini test program

<main.c>

#define PACKAGE "test"

#define PACKAGE_VERSION "x.y.z"

 

#include <stdio.h>

#include <bfd.h>

 

int main(int argc, char** argv)

{

    bfd_init();

 

    char* fn=argv[0];

    printf("exe: '%s'\n", fn);

 

    bfd* file = bfd_openr(fn, 0);

 

    if (!file)

        return 1;

 

    if (bfd_check_format(file, bfd_object))

        printf("object file\n");

    else

        printf("not object file\n");

 

    bfd_close(file);

 

    return 0;

}

</main.c>

 

with

              mingw32-g++.exe -o t.exe main.c -lbfd -lintl -liberty -lz

 

should be fine, in principle, i.e. MinGW’s bfd appears to depend on the libraries intl, (l)iberty and z, at least. For MinGW compilation gcc needs -LC:\MinGW\msys\1.0\lib for linking. But still, the MinGW compiler is complaining:

 

c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libbfd.a(archive.o):(.text+0x3f4): undefined reference to `filename_ncmp'

c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libbfd.a(archive.o):(.text+0x1e48): undefined reference to `filename_ncmp'

c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libbfd.a(archive.o):(.text+0x1ecc): undefined reference to `filename_ncmp'

c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libbfd.a(syms.o):(.text+0x735): undefined reference to `filename_ncmp'

C:\MinGW\msys\1.0\lib\libiberty.a(getpwd.o):getpwd.c:(.text+0x2c): undefined reference to `__errno'

C:\MinGW\msys\1.0\lib\libiberty.a(getpwd.o):getpwd.c:(.text+0x61): undefined reference to `__errno'

C:\MinGW\msys\1.0\lib\libiberty.a(getpwd.o):getpwd.c:(.text+0xe3): undefined reference to `__errno'

C:\MinGW\msys\1.0\lib\libiberty.a(hashtab.o):hashtab.c:(.text+0x10c): undefined reference to `_impure_ptr'

C:\MinGW\msys\1.0\lib\libiberty.a(hashtab.o):hashtab.c:(.text+0x20c): undefined reference to `_impure_ptr'

C:\MinGW\msys\1.0\lib\libiberty.a(hashtab.o):hashtab.c:(.text+0x323): undefined reference to `_impure_ptr'

C:\MinGW\msys\1.0\lib\libiberty.a(hashtab.o):hashtab.c:(.text+0x403): undefined reference to `_impure_ptr'

C:\MinGW\msys\1.0\lib\libiberty.a(hashtab.o):hashtab.c:(.text+0x9f9): undefined reference to `_impure_ptr'

C:\MinGW\msys\1.0\lib\libiberty.a(hashtab.o):hashtab.c:(.text+0xc26): more undefined references to `_impure_ptr' follow

C:\MinGW\msys\1.0\lib\libiberty.a(lrealpath.o):lrealpath.c:(.text+0x1b): undefined reference to `realpath'

C:\MinGW\msys\1.0\lib\libiberty.a(unlink-if-ordinary.o):unlink-if-ordinary.c:(.text+0x15): undefined reference to `lstat'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x28): undefined reference to `sbrk'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x57): undefined reference to `sbrk'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x88): undefined reference to `_impure_ptr'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0xb8): undefined reference to `sbrk'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0xbd): undefined reference to `environ'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x107): undefined reference to `sbrk'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x135): undefined reference to `_impure_ptr'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x165): undefined reference to `sbrk'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x16a): undefined reference to `environ'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x1cb): undefined reference to `sbrk'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x1f8): undefined reference to `_impure_ptr'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x228): undefined reference to `sbrk'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x22d): undefined reference to `environ'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x28c): undefined reference to `sbrk'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x2ba): undefined reference to `_impure_ptr'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x2ea): undefined reference to `sbrk'

C:\MinGW\msys\1.0\lib\libiberty.a(xmalloc.o):xmalloc.c:(.text+0x2ef): undefined reference to `environ'

 

Am I missing another library available in the MinGW collection and to be linked with – or is there some other easy way to produce/download the library (lib)addr2line.a?

 

Living on Win10 with mingw32-g++ 5.3.0. Happy to provide additional information if needed.

 

Many thanks,

J.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe