【问题标题】:Not able to install Linux::Inotify2 on freeBSD无法在 freeBSD 上安装 Linux::Inotify2
【发布时间】:2020-02-12 00:28:41
【问题描述】:

我正在尝试在 freeBSD 上安装 Inotify2,但测试步骤抛出错误。

cpan install Linux::Inotify2

它会抛出以下错误:

root@freebsd12sabin:~/.cpan/build/Linux-Inotify2-2.1-6 # make test
"/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Inotify2.bs blib/arch/auto/Linux/Inotify2/Inotify2.bs 644
PERL_DL_NONLAZY=1 "/usr/local/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00_load.t ..... Can't load '/root/.cpan/build/Linux-Inotify2-2.1-6/blib/arch/auto/Linux/Inotify2/Inotify2.so' for module Linux::Inotify2: /root/.cpan/build/Linux-Inotify2-2.1-6/blib/arch/auto/Linux/Inotify2/Inotify2.so: Undefined symbol "inotify_init" at /usr/local/lib/perl5/5.30/mach/DynaLoader.pm line 193.
 at /root/.cpan/build/Linux-Inotify2-2.1-6/blib/lib/Linux/Inotify2.pm line 97.
BEGIN failed--compilation aborted at /root/.cpan/build/Linux-Inotify2-2.1-6/blib/lib/Linux/Inotify2.pm line 97.

我还能继续吗?

【问题讨论】:

  • cpan -T Linux::Inotify2 安装 Inotify2,但抛出错误:未定义符号“inotify_init”

标签: linux perl freebsd cpan inotify


【解决方案1】:

您需要使用适用于操作系统的替代方案。

【讨论】:

    【解决方案2】:

    Inotify 是 Linux 特定的 API。您不能在 FreeBSD(或任何其他不使用 Linux 内核的操作系统)上使用它,因为该内核不提供这些系统调用。

    【讨论】:

      【解决方案3】:

      其实有devel/libinotify库,它通过kevent API在FreeBSD上实现inotify接口。所以,可能有可能构建这个扩展。

      如果你到了Undefined symbol "inotify_init" 阶段,剩下的就是安装libinotify 包,然后添加适当的-l 标志来构建命令行。我不熟悉 Perl 构建系统,所以我无法建议如何去做。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-06-27
        • 1970-01-01
        • 2015-06-16
        • 2019-11-21
        • 2021-12-26
        • 2011-02-26
        • 2012-08-18
        相关资源
        最近更新 更多