powerperl has asked for the wisdom of the Perl Monks concerning the following question:

perl -V Can't locate in @INC BEGIN failed--compilation aborted.

Replies are listed 'Best First'.
Re: Can't locate Config.pm in @INC
by LanX (Saint) on Jun 21, 2022 at 21:14 UTC
    > @INC has paths of two versions of perl.

    This is an open invite for a multitude of problems.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      It works fine with recompiled perl
Re: Can't locate Config.pm in @INC
by syphilis (Archbishop) on Jun 22, 2022 at 10:21 UTC
    perl -V Can't locate Config.pm in @INC (you may need to install the Config module) (@INC contains: …).

    powerperl, were there any directories listed there ? Or did it actually specify (@INC contains:) - in which case @INC is definitely empty.

    Oddly enough, I've just been building various configurations of unthreaded perl-5.37.1 on Windows. They've all built, tested and installed without any errors but they all have an empty @INC:
    >perl -V Can't locate Config.pm in @INC (you may need to install the Config mod +ule) (@INC contains:). BEGIN failed--compilation aborted.
    No such problem with the threaded builds of perl-5.37.1.
    I've never seen the like of it before !!

    However, if your @INC is not empty, then you and I are almost certainly facing different issues.

    Cheers,
    Rob
      @INC is not empty so we are on different paths
Re: Can't locate Config.pm in @INC
by ikegami (Patriarch) on Jun 21, 2022 at 20:11 UTC

    Path mentioned in @INC has Config.pm

    If so, then the process has insufficient permissions to read both the directory and the file.

      It works fine when perl recompiled

        In the OP, you said the paths were in @INC. But since PERL5LIB simply adds to @INC, it appears that you were mistaken, and that was I operating under incorrect information.

        So, ignore that bit about permissions. What you have is a very broken installation of Perl. You shouldn't have to tell Perl where to find Config. You should reinstall it; you shouldn't be applying hacks like using PERL5LIB.

Re: Can't locate Config.pm in @INC
by Anonymous Monk on Jun 22, 2022 at 08:28 UTC
    Are you on Linux? Use strace -e trace=%file perl -V to see which files Perl is trying to open and why it fails. There will be a lot of output, so make sure to read Writeup Formatting Tips and format it correctly using <code> tags.