使用 cpanm 安装 B::C 挂起?

Installing B::C with cpanm hangs?

当我用 cpanm 安装 B::C 时,它挂起

$ sudo cpanm B::C
--> Working on B::C
Fetching http://www.cpan.org/authors/id/R/RU/RURBAN/B-C-1.57.tar.gz ... OK
Configuring B-C-1.57 ... OK
Building and testing B-C-1.57 ... ^C

首先您要尝试使用详细标志 cpanm -v B::C 检查安装,之后您应该会看到很多循环,例如

x86_64-linux-gnu-gcc  -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/lib/x86_64-linux-gnu/perl/5.28/CORE  -o cccode1_o1 cccode1_o1.c  -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.28/CORE -lperl -ldl -lm -lpthread -lc -lcrypt 2>/dev/null 2>&1
# /usr/bin/ld: cannot find -lperl
collect2: error: ld returned 1 exit status

这是因为ld找不到libperl.so。如果您使用的是 Debian,则需要 运行、

sudo apt install libperl-dev