【问题标题】:Unable to compile GDB with expat for use with remote debugging无法使用 expat 编译 GDB 以用于远程调试
【发布时间】:2023-04-05 04:19:01
【问题描述】:

我一直在尝试在 64 位 X86 Ubuntu 上编译 GDB 的副本,以用于远程调试 ARM 设备。这意味着使用 expat 编译 GDB; GDB 在连接到远程调试器时使用 XML 解析。以下是我尝试过的一些事情以及结果。

仅使用 --with-expat 编译

./configure --target=arm-none-eabi --with-expat 
make

....
checking whether to use expat... yes
checking for libexpat... (cached) no
configure: error: expat is missing or unusable
Makefile:9125: recipe for target 'configure-gdb' failed
....

使用 --with-libexpat-prefix 编译

ls -alg /usr/local/lib/*expat*
-rw-r--r-- 1 root 999128 Mar 20 23:55 /usr/local/lib/libexpat.a
-rwxr-xr-x 1 root    942 Mar 20 23:55 /usr/local/lib/libexpat.la
lrwxrwxrwx 1 root     17 Mar 20 23:55 /usr/local/lib/libexpat.so -> libexpat.so.1.6.0
lrwxrwxrwx 1 root     17 Mar 20 23:55 /usr/local/lib/libexpat.so.1 -> libexpat.so.1.6.0
-rwxr-xr-x 1 root 534224 Mar 20 23:55 /usr/local/lib/libexpat.so.1.6.0

./configure --target=arm-none-eabi --with-expat --with-libexpat-prefix=/usr/local/lib
make

....
checking whether to use expat... yes
checking for libexpat... (cached) no
configure: error: expat is missing or unusable
Makefile:9125: recipe for target 'configure-gdb' failed
....

我尝试了各种我能想到的方式来安装 expat。上述库二进制文件来自使用 make install 的 expat 本地编译;我也做过:

apt-get install libexpat1-dev
apt-get install expat

两者都已经是最新版本。结果与上述相同;只有省略 --with-expat 和 --with-libexpat-prefix 才能编译。

欢迎提出建议。我怎样才能找到更多关于失败的信息 - 我怎样才能弄清楚制作过程如何/在哪里未能找到/批准外籍人士?

各位旅行者(但我在这里没有找到有效的答案):

gdb building with expat

http://comments.gmane.org/gmane.comp.gdb.devel/29306

gdb remote cross debugging fails with "Remote 'g' packet reply is too long"

【问题讨论】:

  • 我会在 configure 中找到检查/测试 expat 的测试,然后从 cmd-line 只运行该块并查看出现哪些错误(或其他问题)。当然,这并不像听起来那么简单,因为您需要知道在configure 环境中设置了哪些变量。 (PATH、LD_LIBRARY,也许还有其他)。祝你好运。

标签: xml linux debugging gdb arm


【解决方案1】:

我进行了两项更改,使其对我有用。

首先,我的./configure 命令有点错误。而不是

./configure --target=arm-none-eabi --with-expat --with-libexpat-prefix=/usr/local/lib

应该是

./configure --target=arm-none-eabi --with-expat --with-libexpat-prefix=/usr/local/

因为前缀应该在 include 和 lib 之上。从配置文件中:

--with-expat            include expat support (auto/yes/no)
--with-libexpat-prefix[=DIR]  search for libexpat in DIR/include and DIR/lib

但我不确定这是真正的解决方案。在我不小心从 gdb 根目录中的 gdb 目录开始编译之前,我仍然遇到相同的编译错误。让我完全明确:

root@scallion:~/gdb-arm-build/gdb-7.11# ls -alg
total 5016
drwxr-xr-x 16 root    4096 Mar 21 23:48 .
drwxr-xr-x  3 root    4096 Mar 20 16:54 ..
drwxr-xr-x  7 root   20480 Mar 21 23:48 bfd
-rw-rw-rw-  1  200  492650 Feb 24 01:55 ChangeLog
-rwxrwxrwx  1  200    7333 Feb 19  2015 compile
drwxr-xr-x  2 root    4096 Mar 20 16:54 config
-rwxrwxrwx  1  200   43614 Feb  9 19:19 config.guess
-rw-rw-rw-  1  200   25713 Feb  9 19:19 config-ml.in
-rwxrwxrwx  1  200   14916 Jun 11  2014 config.rpath
-rwxr-xr-x  1 root   31637 Mar 21 23:48 config.status
-rwxrwxrwx  1  200   36139 Feb  9 19:19 config.sub
-rwxrwxrwx  1  200  486119 Feb 24 01:55 configure
-rw-rw-rw-  1  200  113771 Feb 24 01:59 configure.ac
-rw-rw-rw-  1  200   18002 Jun 11  2014 COPYING
-rw-rw-rw-  1  200   35147 Jun 11  2014 COPYING3
-rw-rw-rw-  1  200    7639 Jun 11  2014 COPYING3.LIB
-rw-rw-rw-  1  200   25291 Jun 11  2014 COPYING.LIB
drwxr-xr-x  2 root    4096 Mar 20 16:54 cpu
-rwxrwxrwx  1  200   22464 Feb 19  2015 depcomp
-rw-r--r--  1  200    1887 Feb 24 01:59 djunpack.bat
drwxr-xr-x  2 root    4096 Mar 21 23:49 etc
drwxr-xr-x 27 root   36864 Mar 21 23:51 gdb **<<<<<<<< Here**
drwxr-xr-x 12 root    4096 Mar 20 16:54 include
-rwxrwxrwx  1  200   14675 Feb 19  2015 install-sh
drwxr-xr-x  2 root    4096 Mar 21 23:48 intl
drwxr-xr-x  4 root    4096 Mar 21 23:49 libdecnumber
drwxr-xr-x  4 root   12288 Mar 21 23:48 libiberty
-rw-rw-rw-  1  200  263820 Feb  9 19:19 libtool.m4
-rw-rw-rw-  1  200    1768 Jun 11  2014 ltgcc.m4
-rw-rw-rw-  1  200  249723 Jun 11  2014 ltmain.sh
-rw-rw-rw-  1  200    6126 Jun 11  2014 lt~obsolete.m4
-rw-rw-rw-  1  200   11950 Jun 11  2014 ltoptions.m4
-rw-rw-rw-  1  200    4372 Jun 11  2014 ltsugar.m4
-rw-rw-rw-  1  200     703 Jun 11  2014 ltversion.m4
-rw-rw-rw-  1  200    3909 Feb 19  2015 MAINTAINERS
-rw-r--r--  1 root  414118 Mar 21 23:48 Makefile
-rw-rw-rw-  1  200   30110 Feb  9 19:19 Makefile.def
-rw-rw-rw-  1  200 1719859 Feb 24 01:57 Makefile.in
-rw-rw-rw-  1  200   69660 Feb 24 01:55 Makefile.tpl
-rw-r--r--  1  200  736309 Feb 24 01:59 md5.sum
-rwxrwxrwx  1  200    6872 Feb 19  2015 missing
-rwxrwxrwx  1  200    2179 Jun 11  2014 mkdep
-rwxrwxrwx  1  200    3538 Feb 19  2015 mkinstalldirs
-rwxrwxrwx  1  200    2636 Feb 19  2015 move-if-change
drwxr-xr-x  5 root   12288 Mar 21 23:49 opcodes
drwxr-xr-x  7 root    4096 Mar 21 23:49 readline
-rw-rw-rw-  1  200    1719 Jun 11  2014 README
-rw-rw-rw-  1  200     961 Jun 11  2014 README-maintainer-mode
-rw-r--r--  1 root      13 Mar 21 23:48 serdep.tmp
drwxr-xr-x 33 root    4096 Mar 21 23:49 sim
-rwxrwxrwx  1  200    9150 Feb  9 19:19 src-release.sh
-rwxrwxrwx  1  200    2265 Jun 11  2014 symlink-tree
drwxr-xr-x  2 root    4096 Mar 20 16:54 texinfo
-rwxrwxrwx  1  200    6421 Feb 19  2015 ylwrap
drwxr-xr-x 14 root    4096 Mar 21 23:48 zlib

直到我从 gdb-arm-build/gdb-7.11/gdb 目录运行 make 才成功。 使用生成的 gdb 二进制文件,我现在可以连接到目标、停止、启动、查看寄存器,符号等。如果我发现我的编译有任何不足,我会跟进,但现在我很好。

我不知道我在这里不明白什么,所以如果有人能解释我犯了什么错误,我将不胜感激。

【讨论】:

    【解决方案2】:

    在 Ubuntu 上 gdb your-program

    【讨论】:

    • 能否请您对您提供的解释添加更多描述?
    【解决方案3】:

    我遇到了完全相同的情况。虽然我不能给出麻烦的确切原因,但我相信它可能与 makeinfo 有关。在尝试从 gdb-7.6 升级到 gdb-7.11 时,我遇到了一些需要下载的东西;因此重新运行配置并在其间安装包几次 长短:我删除了 gdb-7.11 文件夹,将其重新解压,它通过与 expat 的良好链接运行:./configure --with-read-line --with-expat

    【讨论】:

      【解决方案4】:

      gdb 8.3 的版本也有同样的问题。想了很多办法,还是不行。最后我用的是10.2版本,所有问题都没有了。 上帝祝福你, 祝你好运。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-07-19
        • 2020-09-21
        • 2015-11-25
        • 2014-08-31
        • 2014-02-03
        • 2012-01-03
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多