skip to Main Content

I’m trying to build a perl program from source. The program has a Build script which installs all the many dependencies by cpan by invoking perl ./Build installdeps. However, some of the dependencies can’t be installed by cpan properly, namely Wx.

On a fresh install of Ubuntu 22.04, I’ve been able to workaround this by installing the necessary modules via apt. For Wx, for example, I can do sudo apt install libalien-wxwidgets-perl libwx-perl and then if I run perl ./Build installdeps or simply cpan -i Wx, cpan detects that Wx is already installed, and I can eventually run ./Build install and the program will work with the dependencies installed by apt. But, on my main computer, I’m unable to do this. I can install all the same dependencies by apt, but cpan still thinks they’re not installed

2

Answers


  1. You need to tell Perl where to look for modules if they are outside the default set of module search paths. Run perl -V to see what’s in @INC by default:

    $ perl -V
    Summary of my perl5 (revision 5 version 38 subversion 0) configuration:
    
    ...
    
      @INC:
        /usr/local/perls/perl-5.38.0/lib/site_perl/5.38.0/darwin-2level
        /usr/local/perls/perl-5.38.0/lib/site_perl/5.38.0
        /usr/local/perls/perl-5.38.0/lib/5.38.0/darwin-2level
        /usr/local/perls/perl-5.38.0/lib/5.38.0
    

    I’m guessing that the two systems in your question are configured differently for this. Look at all the environment variables that start with PERL and compare the lists.

    If your modules are somewhere else, you need to include those directories in @INC. See How do I add a directory to my include path (@INC) at runtime? in perlfaq8.

    Login or Signup to reply.
  2. sudo apt install libalien-wxwidgets-perl will install the module for the system perl. This is not what you intend to do. From the comments you posted and the behaviour you describe, I gather you want to install the module for a different perl. This is usually done using

    cpan Alien::wxWidgets
    

    Note that you need to use the cpan that was installed by the relevant perl. That’s how it knows for which perl to install the module, so to speak. Use the full path if necessary. That said, it sounds like you are using the correct cpan, so this paragraph isn’t applicable to you.

    Now, you say cpan Alien::wxWidgets doesn’t work for you. That may be, but that’s a problem you’ll need to address directly, not by installing the module using a different perl. One perl can’t use a module built by a different perl.[1]


    1. Unless they are sufficiently similar, including but not limited to same version and same or newer revision. But that’s surely not the case here. Why would you have two identical perl on the same system.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search