gpt4 book ai didi

c - 如何从源代码编译readline?

转载 作者:行者123 更新时间:2023-11-30 19:18:30 25 4
gpt4 key购买 nike

当我按照指示将 readline 编译到我的目录/mypath 时(./configure --prefix=/mypath; make; make install),我在其中得到以下未解析的符号:

ldd -r /mypath/lib/libreadline.so.6.2
linux-vdso.so.1 => (0x00007ffffb186000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f450c62f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f450cc07000)
undefined symbol: UP (/mypath/lib/libreadline.so.6.2)
undefined symbol: PC (/mypath/lib/libreadline.so.6.2)
undefined symbol: BC (/mypath/lib/libreadline.so.6.2)

当我阅读 readline 的自述文件时,这似乎是一个功能而不是一个错误:

`--with-curses'
This tells readline that it can find the termcap library functions
(tgetent, et al.) in the curses library, rather than a separate
termcap library. Readline uses the termcap functions, but does not
link with the termcap or curses library itself, allowing applications
which link with readline the to choose an appropriate library.
This option tells readline to link the example programs with the
curses library rather than libtermcap.

我当然用 --with-curses 尝试过,但这并没有改变任何东西,这并不奇怪,因为它似乎是一个只影响 readline 中的一些测试程序的设置。

然而,我的发行版(debian)有一个没有 undefined symbol 的阅读行,因此显然是可以做到的。

如何创建没有未解析符号的 readline 库?

编辑:

我已将 ncurses 编译并安装到同一目录中,并且还尝试使用 CFLAGS="-Wl,-rpath=/mypath"和 --enable-static 配置 readline,但没有成功。

最佳答案

我认为这些符号是由 libncurses 定义的。您可能可以这样确认:

env LD_PRELOAD=/usr/lib/libncurses.so ldd -r /mypath/lib/libreadline.so.6.2

(我认为 ldd 在检查符号时会考虑预加载,但可能不会。)

Arch Linux 使用的构建脚本是 here 。看来诀窍是使用:

make SHLIB_LIBS=/mypath/libncurses.so

构建文件中的 -rpath 选项还有一些其他调整,因此您可能也需要这些调整。

关于c - 如何从源代码编译readline?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26670417/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com