为什么我构建 gdb 时找不到 termcap 库?

为什么我构建 gdb 时找不到 termcap 库?

make然后失败了:

配置:错误:未找到 termcap 库,但是 termcap 库就在那里,为什么找不到它?

checking for library containing zlibVersion... -lz
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for library containing dlgetmodinfo... no
checking for iconv... yes
checking for iconv declaration... install-shextern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for library containing waddstr... no
configure: WARNING: no enhanced curses library found; disabling TUI
checking for library containing tgetent... no
configure: error: no termcap library found
make[1]: *** [configure-gdb] Error 1
make[1]: Leaving directory `/var/lib/gforge/chroot/home/users/mirror/tmp/gdb-7.5'
make: *** [all] Error 2

我使用以下命令配置 gdb:

[mirror@hugemeow gdb-7.5]$ ./configure --libdir=/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/lib/


checking where to find the target readelf... host tool
checking where to find the target strip... host tool
checking where to find the target windres... host tool
checking where to find the target windmc... host tool
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether -fkeep-inline-functions is supported... yes
configure: creating ./config.status
config.status: creating Makefile

当我配置 gdb 时,tempcap 库就在那里

[mirror@hugemeow gdb-7.5]$ ls /var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/lib/
libtermcap.a
[mirror@hugemeow gdb-7.5]$ ls /var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/include/
termcap.h

编辑1:即使使用 --includedir 和 --libdir 选项,也失败了……

[mirror@hugemeow gdb-7.5]$ ./configure --includedir=/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/include/  --libdir=/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/lib/
make
    checking for library containing tgetent... no
configure: error: no termcap library found
make[1]: *** [configure-gdb] Error 1
make[1]: Leaving directory `/var/lib/gforge/chroot/home/users/mirror/tmp/gdb-7.5'
make: *** [all] Error 2

编辑2:现在我按照 Patrice Tisserand 所说的进行构建,但也失败了,并出现了如下不同的错误消息。

[mirror@hugemeow gdb-7.5]$ CFLAGS="-I /var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/include/" LDFLAGS="-L /var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/lib/" ./configure && make

make[1]: Entering directory `/var/lib/gforge/chroot/home/users/mirror/tmp/gdb-7.5'
Configuring in ./intl
configure: loading cache ./config.cache
configure: error: `CFLAGS' has changed since the previous run:
configure:   former value:  `-g -O2'
configure:   current value: `-I/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/include/'
configure: error: `LDFLAGS' has changed since the previous run:
configure:   former value:  ` '
configure:   current value: ` -L/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/lib/'
configure: error: in `/var/lib/gforge/chroot/home/users/mirror/tmp/gdb-7.5/intl':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ./config.cache' and start over
make[1]: *** [configure-intl] Error 1
make[1]: Leaving directory `/var/lib/gforge/chroot/home/users/mirror/tmp/gdb-7.5'
make: *** [all] Error 2

答案1

安装 libncurses 将解决您的问题。如果您使用任何 Debian 操作系统,请尝试此操作: sudo apt-get install libncurses5-dev

答案2

./configure --includedir=/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/include/  --libdir=/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/lib/

--includedir--libdir是选项安装目錄。

为了使用来自其他目录的库,您可以尝试执行以下操作:

CFLAGS="-I/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/include/" LDFLAGS="-L/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/lib/" ./configure 

答案3

这非常有帮助:http://archive09.linux.com/feature/121735

此示例显示了当您发现缺少目标本机 termcap 库时如何成功(这里的交叉构建略有不同 - 如有疑问,请使用 ./configure --help):

cd ~/work/cross/gdb/downloads
wget ftp://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
cd ..
tar xvzf downloads/termcap-1.3.1.tar.gz
mkdir -p ~/work/cross/gdb/build/termcap
cd ~/work/cross/gdb/build/termcap

export CC=powerpc-7450-linux-gnu-gcc
export RANLIB=powerpc-7450-linux-gnu-ranlib
../../termcap-1.3.1/configure --host=powerpc-7450-linux-gnu --prefix=$HOME/work/cross/termcap
make
make install

答案4

对于最后一个错误編輯2

$ mkdir newbuild
$ CFLAGS="-I/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/include/" LDFLAGS="-L/var/lib/gforge/chroot/home/users/mirror/ins/ins-gdb/lib/" ../configure
$ make

或者您可以先运行以前的配置命令,make distclean然后重试。

相关内容