Wednesday, 10 July 2013

Compiling BOOST with custom GCC location

Compiling BOOST on our shared cluster running CentOS 5 is always a pain in the neck. The default GCC version is 4.1, so compiling programs with just the default GCC is not always the best choice.
I was trying to compile a program that depends on BOOST, and figuring out how to specify non-default compilers to BOOST took me a while to figure out.

Download your version of BOOST and untar:

wget http://sourceforge.net/projects/boost/files/boost/1.52.0/boost_1_52_0.tar.bz2
tar xjf boost_1_52_0.tar.bz2


Find the user-config.jam file (this is where the magic happens) and edit:

cd boost_1_52_0
vim tools/build/v2/user-config.jam


Add the line corresponding to your C++ compiler (In my case G++ 4.4). The user-config.jam file loosk something like:

# ------------------
# GCC configuration.
# ------------------

# Configure gcc (default version).
# using gcc ;
# Configure specific gcc version, giving alternative name to use.
# using gcc : 3.2 : g++-3.2 ;
using gcc : 4.4 : /usr/bin/g++44 ;

The syntax is:

using <toolset name> : <version> : <executable> ;


See more info here: http://www.boost.org/boost-build2/doc/html/bbv2/reference/tools.html

Now bootstrap BOOST as you normally would:

./bootstrap.sh --prefix=/opt/boost_1_52_0_gcc44

And compile! Use the -d2 option to up the debug level of b2, so you can see the actual compile command (and check that b2 is using the correct compiler):

./b2 -d 2
./b2 install

Tell your mother of that awesome blog post you just read.

Saturday, 6 October 2012

Downgrading GDM to version 2.20 on CentOS

Sun Ray Server Software requires GDM <= 2.20. Unfortunately contemporary (i.e. up-to-date) Linux distros do not offer outdated GDM. However GDM is surprisingly easy to build from source on CentOS.


Step 1: Get GDM 2.20 source

wget http://download.gnome.org/sources/gdm/2.20/gdm-2.20.11.tar.bz2
tar xf gdm-2.20.11.tar.bz2
cd gdm-2.20.11


Step 2: Edit gdm-2.20.11/daemon/gdm-net.c


Change

#define MAX_CONNECTIONS 15

to

#define MAX_CONNECTIONS 100

(Prevents GDM from hanging when all your Sun Ray terminals connect)


Step 3: Install dependencies

su
yum install audit-libs-devel \
 libglade2-devel \
 libart_lgpl-devel \
 libgnomecanvas \
 libgnomecanvas-devel \
 librsvg2-devel \
 dbus-glib-devel \
 popt-devel \
 gnome-doc-utils


Step 4: Configure and make a dirty install

./configure
make
make install



Step 5: Logout and test

gdm --version
GDM 2.20.11


Leave a comment if the above didn't work. This was done on a CentOS 6.3 64-bit machine.

Friday, 7 September 2012

Downgrading from NVIDIA 304.43 to 295.71 on CentOS 6

The latest upgrade in 'elrepo' updates the NVIDIA drivers from version 295.71 to version 304.43. However, it ain't no bed of roses. On my CentOS 6.3 box, 3D performance under Wine took a massive hit, to the point where even sound playback was affected.

However, it's easy to just roll back the NVIDIA driver upgrades and get on with your life. First, grab the latest working version from elrepo:

wget http://elrepo.reloumirrors.net/elrepo/el6/x86_64/RPMS/kmod-nvidia-295.71-1.el6.elrepo.x86_64.rpm
wget http://elrepo.reloumirrors.net/elrepo/el6/x86_64/RPMS/nvidia-x11-drv-32bit-295.71-1.el6.elrepo.x86_64.rpm
wget http://elrepo.reloumirrors.net/elrepo/el6/x86_64/RPMS/nvidia-x11-drv-295.71-1.el6.elrepo.x86_64.rpm

Now, remove the new, buggy 304.43 drivers:

yum remove nvidia-x11-drv kmod-nvidia nvidia-x11-drv-32bit
 
Beware that uninstalling kmod-nvidia may take quite a while. Finally, install the fresh, old drivers:

rpm -Uvh kmod-nvidia-295.71-1.el6.elrepo.x86_64.rpm \
nvidia-x11-drv-295.71-1.el6.elrepo.x86_64.rpm \
nvidia-x11-drv-32bit-295.71-1.el6.elrepo.x86_64.rpm

Reboot. Commence life.

Monday, 3 September 2012

minimalistic laptop setup

I recently fell in love with i3wm, a tile window manager, so I wanted to format my computer and have a bare-minimum installation (instead of running gnome in the background). I checked out tile-window-managers after using pywo, and wanted to 'go the extra mile'.

This resulted in me downloading the minimal CD from ubuntu (12.04) and installing X, i3 and a smallest login manager I could find.

I just ordered the ASUS UX31A and so I need to install everything from scratch again, so what I did was to create a github project with bash file installing all the nice small packages from the first time.

https://github.com/charnley/ubuntu-mts

Here is an outline of the install script, which basicly uses apt-get (why I choose ubuntu) and installs everything needed.


Afterwards all the setup RC's, icon, font setup is done via setup.sh.

I really like this setup for a fast on-the-go geeky setup, especially on a 13" where room on the screen is limited.

Saturday, 14 July 2012

[SOLVED] segmentation fault in shared-mime-types - Ubuntu 10.04 LTS

I just did a kernel + gfx driver upgrade on our Beowulf cluster (Running Ubuntu 10.04 LTS Server), `hostname`=sunray.

However, apt-get upgrade choked (with nothing less than a segmentation fault) when I tried to update the package 'shared-mine-types'. Even a gdb backtrace wasn't helpful at all.

I could replicate the seg/fault by trying to update the mime database:

sudo update-mime-database -V /usr/share/mime

The workaround I found was pretty easy (though also ugly). The problem is a conflict with an early version of libxml2 and libxml2-dev. The workaround is to do this (pull never versions from Ubuntu 10.10 (Maverick)):

sudo -s
apt-get update
apt-get purge  shared-mime-info
cd /root/
wget https://launchpad.net/~ubuntu-security/+archive/ppa/+build/3103171/+files/libxml2-dev_2.7.7.dfsg-4ubuntu0.3_amd64.deb
wget https://launchpad.net/~ubuntu-security/+archive/ppa/+build/3103171/+files/libxml2_2.7.7.dfsg-4ubuntu0.3_amd64.deb
dpkg -i libxml2-dev_2.7.7.dfsg-4ubuntu0.3_amd64.deb
dpkg -i libxml2_2.7.7.dfsg-4ubuntu0.3_amd64.deb
apt-get install shared-mime-info

Now you should be able to do:

apt-get upgrade

^_^



The specs of the Ubuntu is 10.04.4 LTS (Lucid) with a custom compilation of gdm-2.20 from Ubuntu 9.10 (Karmic).

Happy apt-get upgrade'ing!


Friday, 29 June 2012

Shutting down at 6:30 AM?

We're having cooling maintenance carried out on Monday morning at 7:30 (yes AM!). As nobody likes getting up so friggin' early in the morning, here's how I'm going to shut down the servers nicely at 6:30. The command is simply called 'at'.

You envoke it by 'at <time>', e.g.:

# at 6:30
> shutdown -hP [Ctrl-D]

Here is where write the command being carried out .. when you're done, simply exit with a [Ctrl-D]. You wil be greeted by a message like

job 3 at 2012-06-29 6:30

The integer is the job id. You can also be more specific:

# at 6:30 monday

Jobs are executed only once. List your current at jobs with atq:

# atq
3    2012-06-29 6:30 a root

And cancel your at jobs with atrm (using the job id):

# atrm 3

Back to the problem at hand. We have a bunch of compute nodes, named *unray (i.e. bunray, gunray, funray, zunray, punray, wunray, runray,). Since I don't want to manually SSH into every node, I use SSH-keys and a for loop. All nodes mount the same /opt/folder. I put a file containing the command "shutdown -hP now" in /opt/scripts/shutdown.txt. at reads commands from a file via the -f switch. Now it is very easy to make all nodes receive the at command:


for i in b f g z p r w
do
ssh root@$i\unray at -f /opt/scripts/shutdown.txt 6:30am monday
done


Happy at'ing!

Saturday, 9 June 2012

Linux alternative to spotlight and windows startmenu

I really like the work flow of "run command" alt+f2 in most of the linux distros, but i would like to extend the functionality from just running a command to search etc.

I really dig the spotlight functionality on Mac OS X, and the startmenu functionality of windows.

windows 7 - start menu

OS X - Spotlight


I tried alternatives like The Synapse Launcher, Gnome Do and Google Desktop Search, but they seemed slow and very slow (and everyone working with unity will tell you how much of a pain alt+f2 is when it is slow).

I finally found Kupfer, which is really cool. Check it out in this video for an longer introduction of kupfer:




Personally I use Kupfer under LXDE which works great.