Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing instruction for Perl dependency #624

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

monperrus
Copy link
Contributor

Would have saved me 10 minutes.

Fix

Can't locate String/Interpolate.pm in @INC (you may need to install the String::Interpolate module) (@INC contains: /mnt/data/martin/defects4j/framework/lib /mnt/data/m
artin/defects4j/framework /mnt/data/martin/defects4j/framework/core /mnt/data/martin/defects4j/framework/core /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr
/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/li
b/x86_64-linux-gnu/perl-base) at /mnt/data/martin/defects4j/framework/core/Utils.pm line 45.                                                                            
BEGIN failed--compilation aborted at /mnt/data/martin/defects4j/framework/core/Utils.pm line 45.                                                                        
Compilation failed in require at /mnt/data/martin/defects4j/framework/bin/defects4j line 34.                                                                            
BEGIN failed--compilation aborted at /mnt/data/martin/defects4j/framework/bin/defects4j line 34.        

@rjust
Copy link
Owner

rjust commented Oct 23, 2024

Thanks for pointing this out.

Did you run into this issue because cpan(m) needed to be installed and configured in the terminal session used to install D4J?

IIRC cpanm, during configuration, should add/export PERL5LIB to the shell configuration file (e.g., zshrc or bashrc).

Wdyt about adding the information you provided to the "Perl dependencies" section (a note what to do if this error occurs and how to check whether PERL5LIB is exported)?

@monperrus
Copy link
Contributor Author

Did you run into this issue because cpan(m) needed to be installed and configured in the terminal session used to install D4J?

yes, in the same terminal and shell env.

Wdyt about adding the information you provided to the "Perl dependencies" section

I would have missed it. I was following the installation instructions step by step. That would work if we have a clear warning / forward ref about the issue in the step-by-step instructions.

@h4iku
Copy link
Contributor

h4iku commented Oct 31, 2024

Following the current instructions, setting export PERL5LIB=~/perl5/lib/perl5 is always necessary because cpanm (when used without sudo) installs modules in the user's home directory and doesn’t automatically configure the Perl library path. This warning appears when running cpanm --installdeps . to install modules:

$ cpanm --installdeps .
!
! Can't write to /usr/share/perl5/site_perl and /usr/bin: Installing modules to /home/reza/perl5
! To turn off this warning, you have to do one of the following:
!   - run me as a root or with --sudo option (to install to /usr/share/perl5/site_perl and /usr/bin)
!   - Configure local::lib in your existing shell to set PERL_MM_OPT etc.
!   - Install local::lib by running the following commands
!
!         cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
!
--> Working on .
Configuring /home/reza/workspace/defects4j ... OK

If you follow its recommendation to run cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib), everything will work fine in the current session. But, this configuration will not persist in a new terminal session, so adding the export command to .bashrc or .zshrc is necessary.

Another way to avoid all this is to update the instructions to use sudo to install modules globally and everything will work without additional configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants