Search code examples
perldebiancpancpanmperlcc

Installing B::C with cpanm hangs?


When I install B::C with cpanm, it hangs

$ 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

Solution

  • First you'll want to try to check the install by using the verbose flag cpanm -v B::C, after which you should see a lot of looping like

    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
    

    This is because ld can't find libperl.so. If you're on Debian you'll need to run,

    sudo apt install libperl-dev