解决 dyninst-9.3.2 编译过程报错问题

dyninst-9.3.2 编译报错

GCC 9 + 编译 elfutils 报错属性声明问题

1
error: ‘__elf32_msize’ specifies less restrictive attribute than its target ‘elf32_fsize’: ‘const’ [-Werror=missing-attributes]

解决方法:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/libelf/elf32_fsize.c b/libelf/elf32_fsize.c
index 0f468de52c382135a099d97d3842f224ee16e8b1..139f4a91ce78406210378bd9ef3657610b64ea4d 100644 (file)
--- a/libelf/elf32_fsize.c
+++ b/libelf/elf32_fsize.c
@@ -58,5 +58,3 @@ elfw2(LIBELFBITS, fsize) (Elf_Type type, size_t count, unsigned int version)

return (count * __libelf_type_sizes[ELFW(ELFCLASS,LIBELFBITS) - 1][type]);
}
-#define local_strong_alias(n1, n2) strong_alias (n1, n2)
-local_strong_alias (elfw2(LIBELFBITS, fsize), __elfw2(LIBELFBITS, msize))
diff --git a/libelf/libelfP.h b/libelf/libelfP.h
index bc9a404d56778720b9f923f76a040afcc1e89eca..3a96a3b01075df46945a61a68d8b6ce3340fbb4c 100644 (file)
--- a/libelf/libelfP.h
+++ b/libelf/libelfP.h
@@ -444,16 +444,6 @@ extern const uint_fast8_t __libelf_type_aligns[ELFCLASSNUM - 1][ELF_T_NUM]
extern Elf_Type __libelf_data_type (Elf *elf, int sh_type, GElf_Xword align)
internal_function;

-/* The libelf API does not have such a function but it is still useful.
- Get the memory size for the given type.
-
- These functions cannot be marked internal since they are aliases
- of the export elfXX_fsize functions.*/
-extern size_t __elf32_msize (Elf_Type __type, size_t __count,
- unsigned int __version) __const_attribute__;
-extern size_t __elf64_msize (Elf_Type __type, size_t __count,
- unsigned int __version) __const_attribute__;
-

/* Create Elf descriptor from memory image. */
extern Elf *__libelf_read_mmaped_file (int fildes, void *map_address,

报错找不到 boost 头文件

1
2
3
4
/home/lhx/dyninst/dyninst-9.3.2/common/h/dyn_regs.h:36:10: fatal error: boost/shared_ptr.hpp: 没有那个文件或目录
36 | #include "boost/shared_ptr.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

解决方法:
先去安装 boost 库:
./bootstrap.sh
./b2
sudo ./b2 install

报错找不到 zlib

1
error: zlib not found but is required

解决方法:
安装 zlib 库:

1
2
sudo apt install zlib1g
sudo apt-get install zlib1g-dev