我正在尝试构建GDB,并且从这里签出了源代码:
https://secure-web.cisco.com/1gNMaTaLSpyPf04-64vyJyKpMnhYszFwToxEd5acy6VS3P271v2Vw2kWu-o5O16GAU92fTpsG5ezF48gddoDV7Adx8PaRyVUyENTYoGhf4DAL5SCpsboaD9mL8rtLqTcK7yirl321lqD9Cfnoz5vju88CQIffq80iTEn4g5SSY7g/https%3A%2F%2Fandroid.googlesource.com%2Ftoolchain%2Fgdb.git
我正在使用用于编译NDK应用程序的相同工具链,将bin文件夹添加到我的路径并运行config脚本:
./configure --host = arm-linux-androideabi
我收到此构建错误:
.././libiberty/getpagesize.c:64:1:错误:“ getpagesize”的重新定义
/home/xxxxx/android-ndk/arm_a14_tools/bin/../sysroot/usr/include/unistd.h:174:23:注意:此处“ getpagesize”的先前定义在此处
Makefile:679:目标“ getpagesize.o”的配方失败
make [2]:*** [getpagesize.o]错误1
你有什么主意吗 ?
最佳答案
我也遇到了我找到了两种解决方案。
1 diff --git a/libiberty/configure b/libiberty/configure
index d8890a1..720dc5e 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -6248,6 +6248,12 @@ if test -z "${setobjs}"; then
case "${host}" in
+ *-*-android*)
+ # On android, getpagesize is defined in unistd.h as a static inline
+ # function, which AC_CHECK_FUNCS does not handle properly.
+ ac_cv_func_getpagesize=yes
+ ;;
+
*-*-mingw32*)
# Under mingw32, sys_nerr and sys_errlist exist, but they are
# macros, so the test below won't find them.
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index 868be8e..e21e3aa 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -600,6 +600,12 @@ if test -z "${setobjs}"; then
case "${host}" in
+ *-*-android*)
+ # On android, getpagesize is defined in unistd.h as a static inline
+ # function, which AC_CHECK_FUNCS does not handle properly.
+ ac_cv_func_getpagesize=yes
+ ;;
+
*-*-mingw32*)
# Under mingw32, sys_nerr and sys_errlist exist, but they are
# macros, so the test below won't find them.
参考:https://patchwork.ozlabs.org/patch/541034/
2作为快速修复的技巧,暂时将本节注释掉
在unistd.h中:
#if 0
static __inline__ int getpagesize(void) {
extern unsigned int __page_size;
return __page_size;
}
#endif
参考:http://permalink.gmane.org/gmane.comp.gdb.devel/33166