[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
perlbrew [2014/05/21 01:27]
popel
perlbrew [2016/11/25 12:34] (current)
ufal
Line 6: Line 6:
  
 ===== How to setup the Perlbrew environment ===== ===== How to setup the Perlbrew environment =====
-Add to your ''~.bashrc'':+Add to your ''~/.bashrc'':
  
   source /net/work/projects/perlbrew/init   source /net/work/projects/perlbrew/init
   eval "$(bash-complete setup)"   eval "$(bash-complete setup)"
  
-The second line is optional, but it enables [[https://metacpan.org/pod/Bash::Completion|Bash Completion]] for [[http://perlbrew.pl/|perlbrew]], [[https://metacpan.org/pod/App::cpanminus|cpanm]] and treex.+ 
 +The second line is optional, but it enables [[https://metacpan.org/pod/Bash::Completion|Bash Completion]] for [[http://perlbrew.pl/|perlbrew]], [[https://metacpan.org/pod/App::cpanminus|cpanm]] and treex (if the respective ''Bash::Completion::Plugins::XY'' modules are installed). 
 +Make sure you have deleted (commented out) the old setup_platform setup (''source /net/work/projects/perl_repo/admin/bin/setup_platform'') from your ''~/.bashrc''
 + 
 +Also note that perlbrew (unlike ''setup_platform'') does not change your ''$PERL5LIB''. You probably add some local Perl modules to ''$PERL5LIB'' in your ''.bashrc'' (e.g. ''export PERL5LIB="/home/popel/tmt/treex/lib:$PERL5LIB"''). When you source ''.bashrc'' again, make sure you don't have duplicate paths in ''$PERL5LIB'' (e.g. ''"/home/popel/tmt/treex/lib:/home/popel/tmt/treex/lib"'') -- to prevent this add this line to the //beginning// of your ''.bashrc'': 
 + 
 +  export PERL5LIB="" 
 + 
 +To finish the Perlbrew environment setup, run (in a new bash session) 
 + 
 +  perlbrew switch perl-5.18.
  
 ===== How to use Perlbrew ===== ===== How to use Perlbrew =====
   perlbrew list               # Which perl versions are installed?   perlbrew list               # Which perl versions are installed?
-  perlbrew use perl-5.16.   # use one of these perls for the current shell +  perlbrew use perl-5.18.   # use one of these perls for the current shell 
-  perlbrew switch perl-5.16.# use this perl version permanently+  perlbrew switch perl-5.18.# use this perl version permanently 
 +  perlbrew off                # return to the system installation of perl 
 + 
 +You can read [[https://metacpan.org/pod/distribution/App-perlbrew/bin/perlbrew|the full Perlbrew documentation]] (but it should not be needed). 
 +Note that there is a separate Perlbrew environment for each architecture (32bit vs. 64bit machines) at ÚFAL, so if you switch to perl-5.18.2 on 32bit machines, you need to do it again on 64bit machines if you want to use perl-5.18.2 on both.
  
 ===== How to install missing modules from CPAN ===== ===== How to install missing modules from CPAN =====
Line 32: Line 47:
 If you did this on your machine (32bit), you still need to ssh to some 64bit machine (e.g. ''sol1'') and install it there, if you want the module to be available from the LRC cluster. If you did this on your machine (32bit), you still need to ssh to some 64bit machine (e.g. ''sol1'') and install it there, if you want the module to be available from the LRC cluster.
  
-Useful switch for ''cpanm'' is ''-n'' (notest, useful e.g. for ''cpanm -n Tk''). See ''cpanm -h'' for more (e.g. installing from github, installing to your own local-lib). +Useful switches for ''cpanm'' are ''-n'' (notest) and ''-v'' (verbose). See ''cpanm -h'' for more (e.g. installing from github, installing to your own local-lib). 
-You can install the modules also manually (''perl Build.PL && ./Build && ./Build test && ./Build install''). There is no need to set ''--prefix'' nor ''--install_base'', because you (everyone group ufal) have write access to the shared ÚFAL perlbrew repository.+You can install the modules also manually (''perl Build.PL && ./Build && ./Build test && ./Build install''). There is no need to set ''prefix'' nor ''install_base'', because you (everyone from the group ''ufal'') have write access to the shared ÚFAL perlbrew repository.
  
 ===== How to install new Perl version ===== ===== How to install new Perl version =====
Line 39: Line 54:
   perlbrew available                    # list perl versions available for download   perlbrew available                    # list perl versions available for download
   perlbrew install perl-5.16.3          # install this older version   perlbrew install perl-5.16.3          # install this older version
-  perlbrew install -Dcc=gcc perl-5.16.# on Ubuntu10.04 64bit, I had to use this switch+  perlbrew install -Dcc=gcc --thread --multi -j 4 perl-5.20.# on Ubuntu10.04 64bit, I had to use -Dcc=gcc 
 +   
 +(Note that when trying to compile threaded perl on cluster machines I had to ignore [[http://www.nntp.perl.org/group/perl.perl5.porters/2014/05/msg214911.html|this]] error.)
  
 Now, we probably want to install all modules from the current perl to the new perl: Now, we probably want to install all modules from the current perl to the new perl:
Line 45: Line 62:
   perlbrew list-modules > list.txt   perlbrew list-modules > list.txt
   perlbrew switch perl-5.16.3   perlbrew switch perl-5.16.3
 +  #cpanm -n Tk # Tk tests are long and pop up many windows
 +  # but to get support for XFT anti-aliased fonts on newer Ubuntu, let's do:
 +  cpanm -n -v git://github.com/eserte/perl-tk.git
 +  cpanm -n PerlIO::Util # this module has (reported) errors
   cpanm < list.txt   cpanm < list.txt
 +
 +==== Tricky modules ====
 +
 +=== Tk ===
 +
 +When compiled without XFT support, the fonts are ugly and some fonts (Cyrillic, Arabic,...) are completely unreadable.
 +First, you need some packages (which should be installed by default, so the following command is not needed)
 +
 +  sudo apt-get install libx11-dev libfreetype6-dev libxft-dev libpng-dev libz-dev
 +
 +However, new Debian and Ubuntu (14.04) changed location of some files (freetype.h, libXft.so,...) which is fixed only in the github repository of Tk (it is not on CPAN yet). Luckily, cpanm can install directly from github:
 +
 +  cpanm -n -v git://github.com/eserte/perl-tk.git
 +  
 +Last time, I found some tests failing, so I add ''-n'' to skip tests (which pop up many windows for several minutes). To test Tk, run
 +
 +  widget
 +
 +and you should see a window with nice anti-aliased font.
 +
 +=== Algorithm::SVM ===
 +In ''bindings.h'' after #include <assert.h> [[https://rt.cpan.org/Ticket/Display.html?id=43669|add these two lines]]:
 +
 +  #include <cstdlib>
 +  #include <string.h>
 +
 +=== Algorithm::FuzzyCmeans ===
 +[[https://rt.cpan.org/Ticket/Display.html?id=76248|Delete]] ''use_test_base;'' from ''Makefile.PL''.
 +
 +=== ÚFAL modules unreleased on CPAN ===
 +
 +  * ''Treex::External::NADA'': cd $TMT_ROOT/install/tool_installation/NADA && perl Makefile.PL && make && make install
 +  * ''Morce::English'': cd $TMT_ROOT/libs/packaged/Morce-English && perl Build.PL && ./Build && ./Build test && ./Build install
 +  * ''CzechMorpho'': cd $TMT_ROOT/libs/packaged/CzechMorpho && perl Build.PL && ./Build && ./Build test && ./Build install
 +  * ''Morce::Czech'': cd $TMT_ROOT/libs/packaged/Morce-Czech && perl Build.PL && ./Build && ./Build test && ./Build install
 +  * ''Featurama::Perc'': cd $TMT_ROOT/libs/packaged/Featurama && bash install.sh
 +
 +===== How to install Perlbrew for a new architecture ===== 
 +
 +  source /net/work/projects/perlbrew/init
 +
 +(You probably have this in your ''~/.bashrc'', so you don't need to run it again.) This will issue some warnings because perlbrew is not installed, but it will set the variables PERLBREW_ROOT and PERLBREW_HOME, so the following installation goes to the shared directory (''/net/work/projects/perlbrew/$ARCHITECTURE''). We need to source it once again below, so ''$PERLBREW_ROOT/etc/bashrc'' is sourced after perlbrew is installed.
 +
 +  wget -O - http://install.perlbrew.pl | bash
 +  source /net/work/projects/perlbrew/init
 +  perlbrew install-cpanm
 +
 +That's all! Now, install some perl, as described [[perlbrew#how-to-install-new-perl-version|above]].
 +
 +  perlbrew available
 +  perlbrew install -j 4 perl-5.18.2
 +  # If this fails as mentioned above, finish the installation with something like
 +  # cd /net/work/projects/perlbrew/Ubuntu/14.04/x86_64/build/perl-5.18.2; make install
 +  perlbrew switch perl-5.18.2
  

[ Back to the navigation ] [ Back to the content ]