25 January 2013

327. Installing Octave, Gnuplot, maxima etc on OSX 10.8.2 via macports

Update 7 Feb 2013: Got my hand on a Mac again and sorted out the octave forge packages.

NOTE: while on the surface this has little to do with linux, it IS in our interest to get people on other platforms to use the same tools we do. Or at least compatible ones. So knowing about macports will help even the most die-hard linux user. In fact, it will help especially those.


I'm no friend of Apple, Mac or OS X for many reasons (restrictive environment, weird mouse, their typical target audience), but pragmatism will make you happier than zealotry. What doesn't work for me obviously works for other people.

Students (and professors) at Australian universities do use apple laptops in significant number though (yet our ERP system only works properly with Internet Explorer -- try requesting leave using chrome on linux and you may be in for a surprise) so I've recently been faced with the issue of installing my standard linux tools on students' apple laptops. In fact it's gotten so bad that several Australian universities 'give' ipads to all their students for 'free' (nothing is free when you're paying for it through your tuition). As someone working at a uni I resent this since, by using the one platform where you can't install what you want on it, this puts pressure on me to restrict my teaching to what can be had via the almighty app store. (there's a lot of BS about blended learning, and you'd be lucky to find a white board anywhere. Blackboards are completely gone which is idiocy of the first degree)

Anyway. There's plenty of people here using Macbook-thingies and it's in my own interest to get them on the narrow path to justice, liberty and the FOSS way.

Macports is a really cool package manager/repository for linux software for Mac OSX and works by compiling the software from the sources -- pretty much how I imagine that the Gentoo experience may be like. Anyway, it works fine although it takes a fair amount of time to install things.


So here's how to do it (no screenshots because I'm typing this from memory):
  1. Open the App Store and install XCode (free)
  2. Open Xcode, go to Preferences/Download, and install Command Line Tools
  3. Download macports via this link for OS X 10.8: https://distfiles.macports.org/MacPorts/MacPorts-2.1.2-10.8-MountainLion.pkg
    Other versions of OS X are also supported, see here: http://www.macports.org/install.php
  4. Install the downloaded macports by opening the .pkg file
  5. Open a Terminal window  (Applications/Utilities/Terminal) and run
  6. sudo port -v selfupdate
  7. Run
  8. sudo port install gnuplot maxima vim nano xterm
    which will take a while -- it needs to set up the build environment from scratch in addition to regular dependencies. Set aside an hour or so just in case. If there's an error, try running the command once more.

  9. Run
  10. sudo port install octave-devel qtoctave-mac
    which will take a long while. If the compile seems to have stopped, checked the titlebar of the terminal window -- the command it's executing will continously change during the compile)

  11. Run octave by running the command
    octave
    in the terminal.
  12. To install octave packages you can install them in the Octave environment :
    pkg install -forge miscellaneous struct general optim
  13. addpath
  14. In case you're having problems actually using the octave-forge packages, you might need to create/edit your ~/.octaverc along the lines of
    addpath('/Users/verahill/octave/optim-1.2.2')
    Replace verahill with the proper user name, and edit the version number as needed.

  15. X11/Xquartz - setting DISPLAY
  16. At this point
    echo $DISPLAY
    gave nothing, and trying to launch an X11 program (e.g. xterm) complained that DISPLAY was not set. Setting DISPLAY manually (export DISPLAY=:0.0) didn't help either.

    'Bad' solution: the first solution was to install xorg-server (sudo port install xorg-server), and then manually
    X &
    export DISPLAY=:0.0
    
    or
    Xquartz &
    export DISPLAY=:0.0
    
    Both X and Xquartz come from macports.

    Good solution
    I then tried to change tack and went to http://xquartz.macosforge.org/landing/ and downloaded XQuartz-2.7.4.dmg (I was originally under the impression that it came as default with "mountain lion" but no.).
    Open the file, then run the .pkg file in that archive. Log out of OSX, then log in again. Now try launching e.g. xterm form a terminal and it should work.


The entire process will take well over an hour, but at the end of it you'll have Octave, Gnuplot AND a complete build environment!

And there are plenty more things you can install with macports (e.g. qtoctave (qtoctave-mac), gedit (gedit gedit-plugins), kile, maxima, qtiplot).

Not sure why I am so excited over it since all these things are available in most linux repos, but there you go -- compiling stuff is ALWAYS exciting.

24 January 2013

326. Compiling Thunderbird 17.0.2 on Debian Testing

I tested this compile in a bare chroot, so the dependencies should be pretty much hammered out. The build is easy but fairly slow.

sudo apt-get install bzip2 build-essential python zip libgtk2.0-dev libdbus-glib-1-dev libasound2-dev libogg-dev libxt-dev yasm libcurl4-openssl-dev mesa-common-dev
mkdir ~/tmp
cd ~/tmp
wget ftp://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/17.0.2/source/thunderbird-17.0.2.source.tar.bz2
rm -rf comm-release/
tar xvf thunderbird-17.0.2.source.tar.bz2
mkdir bldthunder17
cd bldthunder17/
../comm-release/./configure --disable-necko-wifi
make
sudo make install

That took 122 minutes on a single core.
Checkinstall doesn't work and ends with segfault.


23 January 2013

325. Compiling ECCE 6.4 on Debian Testing

!NOTE! If you provide ECCE with 'localhost' as the hostname, be aware that this will block outside access: http://www.nwchem-sw.org/index.php/Special:AWCforum/st/id858/#post_3178

There's a new release of ECCE 6.4 out which fixes the following bug: http://verahill.blogspot.com.au/2012/11/minor-bug-in-ecce.html


A note on Java: I've only had luck with the openjdk packages -- not with the Oracle/sun java ones (see here: http://verahill.blogspot.com.au/2012/06/building-ecce-on-debian-testingwheezy.html).

This build was tested in a chrooted Testing/Wheezy i.e. I should've caught most of the necessary packages.


Compiling:
Download the source to ecce from http://ecce.emsl.pnl.gov/using/download.shtml, and put it in e.g. ~/tmp

sudo apt-get install bzip2 build-essential autoconf libtool ant pkg-config gtk+-2.0-dev libxt-dev csh gfortran openjdk-7-jdk python-dev libjpeg-dev imagemagick xterm
cd ~/tmp
tar xvf ecce-v6.4-src.tar.bz2
cd ecce-v6.4/
export ECCE_HOME=`pwd`
cd build/
./build_ecce
Hit return if xterm was found... The /home/sandbox/tmp/ecce-v6.4/scripts/sysdir script identifies the build platform directory as: empty Because this value is empty no platform-specific parent directory will be created for ECCE executables, libraries, etc. This works fine unless your site needs support for multiple platforms. Finished checking prerequisites for building ECCE. Do you want to skip these checks for future build_ecce invocations (y/n)? Y
./build_ecce
Xerces built
./build_ecce
Mesa OpenGL built
./build_ecce
wxWidgets built
./build_ecce
running build_ext wxPython built
./build_ecce
Apache HTTP server built
./build_ecce
Making combined tar file ecce.v6.4.tar Copying NWChem binary distribution nwchem-6.1.1-binary-rhel5-gcc4.1.2-m64.tar.bz2 Copying NWChem common distribution nwchem-6.1.1-binary-common.tar.bz2 Concatenating install script and combined tar file ecce.v6.4.tar create_ecce_bin finished ECCE built and distribution created in /home/sandbox/tmp/ecce-v6.4
cd ../ ./install_ecce.v6.4.csh

And see the next section for the installation steps.
The compilation steps take progressively longer and longer, so be patient during the build.

Installing:
Digital ink is cheap, so I'll show the whole process:
./install_ecce.v6.4.csh
Main ECCE installation menu =========================== 1) Help on main menu options 2) Prerequisite software check 3) Full install 4) Full upgrade 5) Application software install 6) Application software upgrade 7) Server install 8) Server upgrade IMPORTANT: If you are uncertain about any aspect of installing or running ECCE at your site, please refer to the detailed ECCE Installation and Administration Guide at http://ecce.pnl.gov/docs/installation/2864B-Installation.pdf Hit at prompts to accept the default value in brackets. Selection: [1] 3 Host name: [beryllium] localhost Application installation directory: [/home/sandbox/tmp/ecce-v6.4/ecce-v6.4/apps] /home/sandbox/.ecce/apps Server installation directory: [/home/sandbox/.ecce/server] ECCE v6.4 will be installed using the settings: Installation type: [full install] Host name: [localhost] Application installation directory: [/home/sandbox/.ecce/apps] Server installation directory: [/home/sandbox/.ecce/server] Are these choices correct (yes/no/quit)? [yes] Installing ECCE application software in /home/sandbox/.ecce/apps... Extracting application distribution... Extracting NWChem binary distribution... Extracting NWChem common distribution... Extracting client WebHelp distribution... Configuring application software... Configuring NWChem... Installing ECCE server in /home/sandbox/.ecce/server... Extracting data server in /home/sandbox/.ecce/server/httpd... Extracting data libraries in /home/sandbox/.ecce/server/data... Extracting Java Messaging Server in /home/sandbox/.ecce/server/activemq... Configuring ECCE server... ECCE installation succeeded. *************************************************************** !! You MUST perform the following steps in order to use ECCE !! -- Unless only the user 'sandbox' will be running ECCE, start the ECCE server as 'sandbox' with: /home/sandbox/.ecce/server/ecce-admin/start_ecce_server -- To register machines to run computational codes, please see the installation and compute resource registration manuals at http://ecce.pnl.gov/using/installguide.shtml -- Before running ECCE each user must source an environment setup script. For csh/tcsh users add this to ~/.cshrc: if ( -e /home/sandbox/.ecce/apps/scripts/runtime_setup ) then source /home/sandbox/.ecce/apps/scripts/runtime_setup endif For sh/bash users, add this to ~/.profile or ~/.bashrc: if [ -e /home/sandbox/.ecce/apps/scripts/runtime_setup.sh ]; then . /home/sandbox/.ecce/apps/scripts/runtime_setup.sh fi ***************************************************************

Instead of following the instructions above I normally do:
echo 'export ECCE_HOME=/home/sandbox/.ecce/apps' >> ~/.bashrc
echo 'PATH=$PATH:/home/sandbox/.ecce/server/ecce-admin/:/home/sandbox/.ecce/apps/scripts/' >> ~/.bashrc
echo 
source ~/.bashrc

You can now start ecce by either doing
ecce

or if that complains, do
start_ecce_server

then waiting a little while (10 s), followed by
ecce


Apppendix:

Selecting Java version
sudo update-alternatives --config java
There are 7 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 auto mode 1 /usr/bin/gij-4.4 1044 manual mode 2 /usr/bin/gij-4.6 1046 manual mode 3 /usr/bin/gij-4.7 1047 manual mode 4 /usr/lib/jvm/j2re1.6-oracle/bin/java 314 manual mode 5 /usr/lib/jvm/j2sdk1.6-oracle/jre/bin/java 315 manual mode 6 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode * 7 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode

I've got ECCE running fine with openjdk 7 as well as openjdk 6.