gugod / App-perlbrew

Manage perl installations in your $HOME
https://perlbrew.pl
Other
719 stars 216 forks source link

Problems to install perl with Perlbrew. #572

Open a-velt opened 7 years ago

a-velt commented 7 years ago

Dear developers,

I encountered some problems to install perl with Perlbrew.

If I type "perlbrew install perl-5.20.3", I got the following error:

/usr/local/lib/libutil.so: undefined reference to std::__detail::_List_node_base::_M_unhook()@GLIBCXX_3.4.15' /usr/local/lib/libutil.so: undefined reference tostd::detail::_List_node_base::_M_hook(std::detail::_List_node_base*)@GLIBCXX_3.4.15' /usr/local/lib/libutil.so: undefined reference to `std::detail::_List_node_base::swap(std::detail::_List_node_base&, std::detail::_List_node_base&)@GLIBCXX_3.4.15' /usr/local/lib/libutil.so: undefined reference to `std::detail::_List_node_base::_M_transfer(std::__detail::_List_node_base, std::__detail::_List_node_base)@GLIBCXX_3.4.15' collect2: error: ld returned 1 exit status I can't compile the test program. (The supplied flags or libraries might be incorrect.)

You have a BIG problem. Shall I abort Configure [y] Ok. Stopping Configure.

Brew Failed

Because, by default, Perlbrew take "/usr/local/lib" as ld flags, and it's not this path that I exported before launching perlbrew.

So, I go to the folder build/perl-5.20.3/, and I type ./Configure, I respond at all the questions, giving the good lib and include path. I perform the make, make test and make install without problems. But when I type :

perlbrew use perl-5.20.3

I got

ERROR: The installation "perl-5.20.3" is unknown.

The same if I type : perlbrew switch perl-5.20.3

I don't know how to allow to perlbrew to see the installed perl ... This perl is in the bin of perlbrew so I don't know. Or, is it a possibility to give a configuration file to perlbrew install, in order to it uses the good lib and include path ?

Thank you very much, Amandine

gugod commented 6 years ago

The way perlbrew discover perl installation is simply by scanning the path~/perl5/perlbrew/perls, or $ENV{PERLBREW_ROOT}/perls if $ENV{PERLBREW_ROOT} is defined.

The perlbrew install command does munge the default prefix value for Configure in order to let it be installed under $ENV{PERLBREW_ROOT}. In case you manually run Configure, do something like this:

    ./Configure -de -Dprefix=/Users/gugod/perl5/perlbrew/perls/perl-5.22.0 -Aeval:scriptdir=/Users/gugod/perl5/perlbrew/perls/perl-5.22.0/bin

In fact, the abovementioned 3 arguments of Configure are the only default args that perlbrew passed to Configure. It appears that you might want to surpress -de, but you'll need the other 2. One for letting perlbrew discover the installations, and the other is the destination for "scripts" from cpan.

a-velt commented 6 years ago

Ok, I launched ./Configure with these two options, then I launched the make and make install and now, "perlbrew use" command works !

Thank you very much and have a nice day, Amandine

a-velt commented 6 years ago

Sorry to write again, but I have installed cpanminus :

curl -L https://cpanmin.us | perl - App::cpanminus

And when I type "perlbrew list-modules", I have:

/cm/shared/apps/Perl_environment/bin/perlbrew: Perl lib version (5.24.1) doesn't match executable '/usr/bin/perl' version (5.10.1) at /cm/shared/apps/Perl_environment/perls/perl-5.24.1/lib/5.24.1//x86_64-linux-thread-multi/Config.pm line 62. Compilation failed in require at /cm/shared/apps/Perl_environment/bin/perlbrew line 3. BEGIN failed--compilation aborted at /cm/shared/apps/Perl_environment/bin/perlbrew line 3.

I don't understand why, because during the installation, I told to configuration file to not use /usr/bin/perl, which is the perl of the system and I don't want to touch it and its configuration ... It is why I choose to use perlbrew.

Thank you for your help. Best, Amandine

EDIT :

More informations :

To reproduce this error I type :

source /cm/shared/apps/Perl_environment/etc/bashrc PERL5LIB=/cm/shared/apps/Perl_environment/perls/perl-5.24.1/lib/5.24.1/:$PERL5LIB

perlbrew list-modules

/cm/shared/apps/Perl_environment/bin/perlbrew: Perl lib version (5.24.1) doesn't match executable '/usr/bin/perl' version (5.10.1) at /cm/shared/apps/Perl_environment/perls/perl-5.24.1/lib/5.24.1//x86_64-linux-thread-multi/Config.pm line 62. Compilation failed in require at /cm/shared/apps/Perl_environment/bin/perlbrew line 3. BEGIN failed--compilation aborted at /cm/shared/apps/Perl_environment/bin/perlbrew line 3.

If I don't modify the PERL5LIB variable I have :

perlbrew list-modules

Perl lib version (5.10.1) doesn't match executable version (v5.24.1) at /cm/images/default-image/usr/lib64/perl5/Config.pm line 50. Compilation failed in require at /cm/shared/apps/Perl_environment/perls/perl-5.24.1/lib/5.24.1/ExtUtils/Packlist.pm line 6. BEGIN failed--compilation aborted at /cm/shared/apps/Perl_environment/perls/perl-5.24.1/lib/5.24.1/ExtUtils/Packlist.pm line 6. Compilation failed in require at /cm/shared/apps/Perl_environment/perls/perl-5.24.1/lib/5.24.1/ExtUtils/Installed.pm line 7. BEGIN failed--compilation aborted at /cm/shared/apps/Perl_environment/perls/perl-5.24.1/lib/5.24.1/ExtUtils/Installed.pm line 7. Compilation failed in require. BEGIN failed--compilation aborted.

In all the case, if I type which perl I have :

/cm/shared/apps/Perl_environment/perls/perl-5.24.1/bin/perl

echo $PERL5LIB

/cm/shared/apps/vcftools_0.1.12b/lib/perl5/site_perl:/cm/images/default-image/usr/local/share/perl5:/cm/images/default-image/usr/lib64/perl5:/usr/local/share/perl5/auto:/usr/lib64/perl5/auto:/cm/images/default-image/usr/lib64/perl5/auto:/usr/local/lib64/perl5/auto/

I have no no link to my new perl librairies path if I don't modify the PERL5LIB.

gugod commented 6 years ago

Hi @a-velt

It appears to me that your "current perl" is somehow detected to be /usr/bin/perl, which leads to this output. This is crucial since the list-module command is just a wrapper around "current perl". You may exaime this information by running perlbrew info. In your case, I'm guesssing that it'll just display "Using system perl".

I'm guess that the following commands should "work" -- in the sens that it will list modules under one of your perl installation:

perlbrew use perl-5.24.1
perlbrew list-modules

However, I'm not exactly sure why you seems to, in PERL5LIB, list a path which seems to be a perlbrew-manged path.

This statement here is the core command that actually list modules: https://github.com/gugod/App-perlbrew/blob/develop/lib/App/perlbrew.pm#L2618 -- which translate to something like this:

perl  -MExtUtils::Installed -le 'BEGIN{@INC=grep {$_ ne q!.!} @INC} print for ExtUtils::Installed->new->modules;'

You should be able to run that after perlbrew use perl-5.24.1 and expect to see the correct result.

erickpaquin commented 1 year ago

@a-velt Is this still an issue for you? If not perhaps we should close this PR as it is now about 6 years old. Thanks.