web-dev-qa-db-fra.com

Impossible de construire libdwarf

Je télécharge la version la plus récente de libdwarf dans un fichier archive. Extrayez les fichiers et exécutez la commande suivante

cd dwarf-2013-02-07/libdwarf

./configure --enable-shared

make

J'ai eu l'erreur de compilation suivante. Je ne sais pas pourquoi. J'ai essayé de nombreuses autres versions et j'ai eu la même erreur.

cd libdwarf && make
make[1]: Entering directory `/home/lihao/Downloads/dwarf-20151114/libdwarf'
echo "do nothing " none
do nothing  none
gcc  -g -O2 -I. -I.      -c -o dwarf_elf_access.o dwarf_elf_access.c
dwarf_elf_access.c: In function ‘dwarf_elf_object_access_internals_init’:
dwarf_elf_access.c:238:21: warning: assignment makes pointer from integer without a cast [enabled by default]
     if ((ehdr_ident = elf_getident(elf, NULL)) == NULL) {
                     ^
dwarf_elf_access.c:267:21: warning: assignment makes pointer from integer without a cast [enabled by default]
         obj->ehdr32 = elf32_getehdr(elf);
                     ^
dwarf_elf_access.c: In function ‘dwarf_elf_object_access_get_section_info’:
dwarf_elf_access.c:349:5: error: unknown type name ‘Elf_Scn’
     Elf_Scn *scn = 0;
     ^
dwarf_elf_access.c:352:9: warning: assignment makes pointer from integer without a cast [enabled by default]
     scn = elf_getscn(obj->elf, section_index);
         ^
dwarf_elf_access.c:385:17: warning: assignment makes pointer from integer without a cast [enabled by default]
     if ((shdr32 = elf32_getshdr(scn)) == NULL) {
                 ^
dwarf_elf_access.c:398:19: warning: assignment makes pointer from integer without a cast [enabled by default]
     ret_scn->name = elf_strptr(obj->elf, obj->ehdr32->e_shstrndx,
                   ^
dwarf_elf_access.c: In function ‘dwarf_elf_object_access_load_section’:
dwarf_elf_access.c:1215:9: error: unknown type name ‘Elf_Scn’
         Elf_Scn *scn = 0;
         ^
dwarf_elf_access.c:1216:9: error: unknown type name ‘Elf_Data’
         Elf_Data *data = 0;
         ^
dwarf_elf_access.c:1218:13: warning: assignment makes pointer from integer without a cast [enabled by default]
         scn = elf_getscn(obj->elf, section_index);
             ^
dwarf_elf_access.c:1230:14: warning: assignment makes pointer from integer without a cast [enabled by default]
         data = elf_getdata(scn, NULL);
              ^
dwarf_elf_access.c:1235:29: error: request for member ‘d_buf’ in something not a structure or union
         *section_data = data->d_buf;
                             ^
make[1]: *** [dwarf_elf_access.o] Error 1
make[1]: Leaving directory `/home/lihao/Downloads/dwarf-20151114/libdwarf'
make: *** [basic] Error 2
1
Hao Li

Il vous manque une dépendance, essayez d'ajouter ce qui suit:

Sudo apt-get install libelf-dev

Et puis tout ira bien. J'ai testé cela sous Trusty Tahr ...

2
andrew.46