【问题标题】:Build GDB android构建 GDB 安卓
【发布时间】:2015-03-02 18:09:02
【问题描述】:

我正在尝试构建 GDB,我已经从这里查看了源代码:

https://secure-web.cisco.com/1gNMaTaLSpyPf04-64vyJyKpMnhYszFwToxEd5acy6VS3P271v2Vw2kWu-o5O16GAU92fTpsG5ezF48gddoDV7Adx8PaRyVUyENTYoGhf4DAL5SCpsboaD9mL8rtLqTcK7yirl321lqD9Cfnoz5vju88CQIffq80iTEn4g5SSY7g/https%3A%2F%2Fandroid.googlesource.com%2Ftoolchain%2Fgdb.git

我正在使用与编译我的 NDK 应用程序相同的工具链,将 bin 文件夹添加到我的路径并运行配置脚本:

./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 你有什么想法吗?

【问题讨论】:

    标签: android linux android-ndk gdb cross-platform


    【解决方案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

    【讨论】:

      猜你喜欢
      • 2013-04-23
      • 2014-11-14
      • 2020-05-13
      • 2021-03-29
      • 2013-09-16
      • 1970-01-01
      • 2012-11-30
      • 2012-06-20
      • 1970-01-01
      相关资源
      最近更新 更多