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

标签 c debian

当我按照指示将 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/

相关文章:

c - 如何使用 scanf 函数获取具有 50 或更多数字的大输入

c - C语言从String中读取数据

linux - debian 错误 : Dependency is not satisfiable: libqt4-network (>= 4:4. 8.0)

c++ - C/C++ 程序的最大堆栈大小?

c - 将结构类型转换为整数时出错

linux - 是否有可能在 linux 中找到哪个进程正在使用 OPENSSL?

linux - 安装 Git 时出现 Debian Squeeze apt-get 错误?

python - 为什么我的 mysqldb 代码不工作?没有错误信息,没有数据

c++ - 如何使用这个单链表?

swing - openjdk 8 : error - No public or protected classes found to document