【问题标题】:Can't get libpcap to compile under Dell SUSE Enterprise在 Dell SUSE Enterprise 下无法编译 libpcap
【发布时间】:2012-10-16 22:03:12
【问题描述】:

我们正在使用 Dell SUSE Enterprise。别无选择。

SUSE 在 zypper 存储库中没有 libpcap-devel 或任何类似的东西。

我已经从 GIT 存储库下载并安装了 libpcap。 libpcap 需要编译 flex 和 bison。 flex 版本 2.5.35 在 repo 中,bison 也是。

但是,使用 libpcap-devel 编译时,我不会遇到任何问题。 autoconf 脚本在尝试链接 libpcap.so 时失败:

configure:3633: $? = 1
configure:3636: checking whether we are using the GNU C++ compiler
configure:3665: g++ -c   conftest.cpp >&5
configure:3672: $? = 0
configure:3689: result: yes
configure:3698: checking whether g++ accepts -g
configure:3728: g++ -c -g  conftest.cpp >&5
configure:3735: $? = 0
configure:3836: result: yes
configure:3861: checking dependency style of g++
configure:3952: result: gcc3
configure:3981: checking for a BSD-compatible install
configure:4049: result: /usr/bin/install -c
configure:4067: checking for pcap_lookupdev in -lpcap
configure:4102: gcc -o conftest -g -O2   conftest.c -lpcap   >&5
/usr/local/lib/libpcap.so: undefined reference to `pcap_lex'
collect2: ld returned 1 exit status
configure:4109: $? = 1
configure: failed program was:

在存档上运行 nm,我发现:

$ nm /usr/local/lib/libpcap.so | grep pcap_lex
                 U pcap_lex

当然,pcap_lex 确实是来自 yylex 的#define。

我不在这里。我试图弄清楚为什么这些东西都不能在 Suse 上正确编译。有人知道吗?

【问题讨论】:

    标签: libpcap suse


    【解决方案1】:

    不知何故,无论你为编译 libpcap 所做的一切都会导致它无法正确构建。

    没有:

    1. libpcap 目录中的config.log 文件;
    2. libpcap 目录中的 Makefile;
    3. libpcap 目录中构建的输出;

    无法确定那是什么,因此无法修复该过程以正确构建 libpcap。我从来没有看到在 Linux 上构建的 libpcaps 存在问题,所以我无法确定这里发生了什么。

    (如果您提供此信息,您不仅可以帮助您自己,还可以帮助所有报告了类似问题但拒绝回答类似问题并因此没有提供任何相关信息的人。)

    【讨论】:

    • 虽然您在技术上是正确的,但事实证明,更好的方法是从tcpdump.org 下载 libpcap 1.2.1 源代码。该版本编译没有问题。所以真正的答案是不要从 github 随机发布。
    • 好吧,至少有其他一些报告了这些问题的人报告了从 tcpdump.org 下载的标准版本存在问题,因此这不一定是有保证的修复。
    • 或者在我的情况下,使用 tcpdump.org 文件,成功构建了库,但是当我尝试将它链接到项目时,我得到了这个错误。
    猜你喜欢
    • 2011-02-07
    • 2015-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-03
    • 1970-01-01
    • 2022-08-06
    • 2012-06-12
    相关资源
    最近更新 更多