I'm trying to install the Perl module Linux::Inotify2. The installation requires some C compiling.

Which compiler CPAN uses is the same one Perl was compiled with. Which one that is can be seen with:

perl -MConfig -le 'print "@Config{ qw/cc ccflags/ }"'

Which comes up:

gcc-4.7 -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

Now that seems to be a big problem for me because the latest gcc included in raspbian is 4.6!

As a result, when I try to install Linux::Inotify2, I get failures simply because:

/bin/sh: 1: gcc-4.7: not found

How can I get around this? Shouldn't Perl have been compiled with gcc-4.6 for raspbian if a newer version wasn't included? Do I have to install gcc-4.7 on my Pi?


Just making a symlink for gcc-4.7 that points to gcc-4.6 seems to be a decent workaround. Though I know this isn't ideal.

  • 1
    You mean you did symlink from gcc-4.7 to gcc-4.6? Sep 17 '12 at 7:24
  • Yes, thanks for noticing the typo. Should be fixed now.
    – User7391
    Sep 19 '12 at 17:30

It's in the Raspbian repository, so you can install it with

sudo apt-get install liblinux-inotify2-perl

Bringing in modules from CPAN can affect the stability of a Debian distribution (they have conflicting policies on file modifications), so I don't recommend it unless you absolutely have to.

  • you can however install a seperate perl for experamenting using perlbrew Mar 20 '13 at 14:14

gcc-4.6 is the default compiler in Debian 6.0; Raspian is a port of Debian 6.0. It is not the only version available, though. You can install different versions, including 4.7 with apt-get install gcc-4.7.

Now, you said that CPAN modules are compiled with the same version perl was compiled with. It is very possible that perl on Raspbian was compiled with gcc-4.7, then. Raspbian developers tend to use this workaround - using a newer version of gcc - when they get some compilers errors building the package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.