24 July 2012

215. Compiling gcc 4.7.1/gfortran 4.7.1 on Centos 5.6/ROCKS 4.5.3 (and gmp, mpfr, mpc, binutils (ld,as), glibc, libunistring, libtools...)

Update June 2013:
See flakrat's post for a working example: http://flakrat.blogspot.com.au/2013/06/building-gcc-481-on-centos-59.html

I haven't updated this post for a long time, and I haven't been using the GCC I compiled this way. See flakrat's post for an up-to-date working version.

Update(s): This is the first time I compile the GCC and because of this I will like be going back, updating this document over the coming days. Make sure to 1) check back in a week and 2) hit refresh.

Updated (given in Melb./Au time zone): 24/7, 25/7

The reason for this post is the outdated version (4.1) of gcc on our ROCKS 5.4.3/CentOS 5.6 cluster.

I looked at installing GCC 4.4.6 using rpm packages I found online, but I'm not used to the Red Hat way of doing things, and e.g. openmpi-devel was requiring a version of libgomp I wanted to update. Ultimately I got scared of messing up a production cluster and decided that compiling, while slower, is a whole lot safer -- especially if you're not comfortable with the local package manager.

So, here's the alternative route of compiling your own.

I'm really not a friend of CentOS or ROCKS. On the other hand, I freely admit that this is probably in large part due to not being used to it. But...during the course of this compilation my feelings have gone from mild annoyance to active, fiery hate. Mostly it has to do with how old everything is, and the difficult in updating anything in ROCKS.

This is probably my most massive compilation, owing to the number of packages I ended up compiling (a lot of these are probably optional). Guile in particular is very, very demanding.

The order in which things are done is not random


1. Look at 
http://gcc.gnu.org/install/configure.html
http://gcc.gnu.org/install/prerequisites.html

2. Download and untar all the sources
NOTE: you should, if possible, select mirrors based on where you are. However, sometimes you're stuck in a shell and just need to get those files downloaded.

mkdir ~/tmp/gcc
cd ~/tmp/gcc
wget http://www.netgull.com/gcc/releases/gcc-4.7.1/gcc-4.7.1.tar.gz
wget http://www.mpfr.org/mpfr-current/mpfr-3.1.1.tar.gz
wget ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2
wget http://www.multiprecision.org/mpc/download/mpc-1.0.tar.gz

tar xvf gcc-4.7.1.tar.gz
tar xvf gmp-5.0.5.tar.bz2
tar xvf mpfr-3.1.1.tar.gz
tar xvf mpc-1.0.tar.gz

That was the easy bit.

I've also set up a directory called /share/apps/tools/gcc/ with proper permissions already (i.e. whoever is doing the compiling should have write access)

3. Build gmp
cd gmp-5.0.5/
mkdir build
cd build/
.././configure --prefix=/share/apps/tools/gcc/gmp --program-suffix=-gcc47
make
make install
make check


4. Build mpfr
cd ../../mpfr-3.1.1/
mkdir build
cd build/
.././configure --prefix=/share/apps/tools/gcc/mpfr --program-suffix=-gcc-4.7 --with-gmp=/share/apps/tools/gcc/gmp
make
make install

Libraries have been installed in:
   /share/apps/tools/gcc/mpfr/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

make check

It looks like your compile is starting from scratch, but then it ends with:

====================
All 160 tests passed
(1 test was not run)
====================

5. Build mpc
cd ../../mpc-1.0/
mkdir build
cd build/
.././configure --prefix=/share/apps/tools/gcc/mpc --program-suffix=-gcc-4.7 --with-gmp=/share/apps/tools/gcc/gmp --with-mpfr=/share/apps/tools/gcc/mpfr
make
make install
make check

===================
All 64 tests passed
===================


6. Binutils
https://www.gnu.org/software/binutils/
'Often' (judging from forum postings...) you can use an older version of the binutils (ld, as) with a newer version of GCC. However, I need crt1.o when compilicing, it's part of glibc, and glibc requires newer versions of ld and as. So, here we go.
wget http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.gz
tar xvf binutils-2.22.tar.gz
cd binutils-2.22/
mkdir build
cd build/
.././configure --prefix=/share/apps/tools/gcc/binutils --program-suffix=-gcc-4.7
make
make install
make check

At some point I did:
cd /share/apps/tools/gcc/binutils/bin
ln -s ld-gcc-4.7 ld
ln -s as-gcc-4.7 as
ln -s ar-gcc-4.7 ar
but I don't think it's essential

7. Build gcc
cd ~/tmp/gcc-4.7.1
mkdir build
cd build/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/share/apps/tools/gcc/gmp/lib:/share/apps/tools/gcc/mpc/lib:/share/apps/tools/gcc/mpfr/lib
.././configure --prefix=/share/apps/tools/gcc/gcc47 --program-suffix=-gcc-4.7 --with-gmp=/share/apps/tools/gcc/gmp --with-mpfr=/share/apps/tools/gcc/mpfr --with-mpc=/share/apps/tools/gcc/mpc LD_FOR_TARGET=ld-gcc-4.7 AS_FOR_TARGET=as-gcc-4.7 --with-ld=/share/apps/tools/gcc/binutils/bin/ld-gcc-4.7 --with-as=/share/apps/tools/gcc/binutils/bin/as-gcc-4.7 --with-ar=/share/apps/tools/gcc/binutils/bin/ar-gcc-4.7 AR_FOR_TARGET=ar-gcc-4.7

make

This takes A LONG TIME.

make install

To do 'make check' you need to have done the compilations of the optional packages (autogen and dependencies) below.
make check

You now have a shiny new compiler.

Using it is another matter. I'm working on that post at the moment...
You may find the following informative:

gcc-gcc-4.7 --print-search-dirs

install: /share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/

programs: =/share/apps/tools/gcc/gcc47/libexec/gcc/x86_64-unknown-linux-gnu/4.7.1/:/share/apps/tools/gcc/gcc47/libexec/gcc/x86_64-unknown-linux-gnu/4.7.1/:/share/apps/tools/gcc/gcc47/libexec/gcc/x86_64-unknown-linux-gnu/:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu/4.7.1/:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../x86_64-unknown-linux-gnu/bin/

libraries: =/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../x86_64-unknown-linux-gnu/lib/x86_64-unknown-linux-gnu/4.7.1/:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../x86_64-unknown-linux-gnu/lib/../lib64/:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../x86_64-unknown-linux-gnu/4.7.1/:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../lib64/:/lib/x86_64-unknown-linux-gnu/4.7.1/:/lib/../lib64/:/usr/lib/x86_64-unknown-linux-gnu/4.7.1/:/usr/lib/../lib64/:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../x86_64-unknown-linux-gnu/lib/:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../:/lib/:/usr/lib/


8. glibc
cd ~/tmp/gcc
wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz
tar xvf blic-2.14.tar.gz
cd glibc-2.14/
mkdir build
cd build/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/share/apps/tools/gcc/mpc/lib:/share/apps/tools/gcc/mpfr/lib:/share/apps/tools/gcc/gmp/lib
.././configure --prefix=/share/apps/tools/gcc/glibc CC=gcc-gcc-4.7 --with-headers=/usr/src/kernels/2.6.18-238.19.1.el5-x86_64/include
make
make install

Using the current glibc 2.16 requires kernel>2.6.19 which is why I used 2.14. I don't want to fiddle with installing a new kernel on a production system which is shared between several users (and time zones...):
configure: error: GNU libc requires kernel header files from
Linux 2.6.19 or later to be installed before configuring.
The kernel header files are found usually in /usr/include/asm and
/usr/include/linux; make sure these directories use files from
Linux 2.6.19 or later.  This check uses <linux/version.h>, so
make sure that file was built correctly when installing the kernel header
files.  To use kernel headers not from /usr/include/linux, use the
configure option --with-headers.




Optional -- libtool, libunistring, libffi, bdw-gc, autogen and guile

I'm still stuck on Guile.

If you want to run make check on your gcc build, you need autogen, which needs guile, which needs libtool and libunistring

cd ~/tmp/gcc
wget http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
tar xvf libtool-2.4.2.tar.gz
cd libtool-2.4.2/
mkdir build
cd build/
.././configure --prefix=/share/apps/tools/gcc/libtool --program-suffix=-2.4.2
make
make install

make check
(this is very slow)
======================
All 122 tests passed
(2 tests were not run)
======================
and
## ------------- ##
## Test results. ##
## ------------- ##

104 tests behaved as expected.
22 tests were skipped.

cd ~/tmp/gcc
wget http://ftp.gnu.org/gnu/libunistring/libunistring-0.9.3.tar.gz
tar xvf libunistring-0.9.3.tar.gz 
cd libunistring-0.9.3/
mkdir build
cd build/
.././configure --prefix=/share/apps/tools/gcc/libunistring
make
make install

make check
====================
All 418 tests passed
====================

cd ~/tmp/gcc
wget ftp://sourceware.org/pub/libffi/libffi-3.0.11.tar.gz
tar xvf libffi-3.0.11.tar.gz 
cd libffi-3.0.11/
mkdir build
cd build/
.././configure --prefix=/share/apps/tools/gcc/libffi
make
make install
cp include -R /share/apps/tools/gcc/libffi/
cp ../src/x86/ffitarget.h /share/apps/tools/gcc/libffi/include/

cd ~/tmp/gcc
wget http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc.tar.gz
tar xvf gc.tar.gz
cd gc-7.2/
mkdir build
cd build/
 .././configure --prefix=/share/apps/tools/gcc/bdw-gc
make

make check
===================
All 10 tests passed
===================

wget ftp://ftp.gnu.org/gnu/guile/guile-2.0.6.tar.gz
tar xvf guile-2.0.6.tar.gz
cd guile-2.0.6
mkdir build
cd build/
.././configure --prefix=/share/apps/tools/gcc/guile --with-libltdl-prefix=/share/apps/tools/gcc/libtool --with-libgmp-prefix=/share/apps/tools/gcc/gmp --with-libunistring-prefix=/share/apps/tools/gcc/libunistring LIBFFI_CFLAGS=-I/share/apps/tools/gcc/libffi/include LIBFFI_LIBS=-L/share/apps/tools/gcc/libffi/lib BDW_GC_CFLAGS=-I/share/apps/tools/gcc/bdw-gc/include BDW_GC_LIBS=-L/share/apps/tools/gcc/bdw-gc/lib
make

Stuck:

../.././libguile/finalizers.c:167: error: static declaration of 'GC_set_finalizer_notifier' follows non-static declaration
/share/apps/tools/gcc/bdw-gc/include/gc/gc.h:177: error: previous declaration of 'GC_set_finalizer_notifier' was here
make[3]: *** [libguile_2.0_la-finalizers.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/home/me/tmp/gcc/guile-2.0.6/build/libguile'
make: *** [all] Error 2


wget http://ftp.gnu.org/gnu/autogen/rel5.16/autogen-5.16.tar.gz
tar xvf autogen-5.16.tar.gz
cd autogen-5.16/
mkdir build
cd build/






Errors:
checking for x86_64-unknown-linux-gnu-gcc... /home/me/tmp/gcc/gcc-4.7.1/build/./gcc/xgcc -B/home/me/tmp/gcc/gcc-4.7.1/build/./gcc/ -B/share/apps/tools/gcc/gcc47/x86_64-unknown-linux-gnu/bin/ -B/share/apps/tools/gcc/gcc47/x86_64-unknown-linux-gnu/lib/ -isystem /share/apps/tools/gcc/gcc47/x86_64-unknown-linux-gnu/include -isystem /share/apps/tools/gcc/gcc47/x86_64-unknown-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/home/me/tmp/gcc/gcc-4.7.1/build/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/me/tmp/gcc/gcc-4.7.1/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/me/tmp/gcc/gcc-4.7.1/build'
make: *** [all] Error 2

Solution: export LD_LIBRARY_PATH to include the mpc, mpfr and gmp lib dirs (see above)

Links to this post:
http://blog.naver.com/PostView.nhn?blogId=myunggyu&logNo=60173986972&categoryNo=0&parentCategoryNo=0&viewDate&currentPage=1&postListTopCurrentPage=1&userTopListOpen=true&userTopListCount=30&userTopListManageOpen=false&userTopListCurrentPage=1
http://flakrat.blogspot.com/2013/06/building-gcc-481-on-centos-59.html

214. Compiling kernel 3.5 on Debian testing

I've posted how to compile quite a few different kernel versions already (3.4, 3.3, 3.2). With the exception of specific questions asked during the process, the are all compiled in the same way.

Compiling kernels is NOT scary on debian.

cd ~/tmp
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.5.tar.bz2
tar xvf linux-3.5.tar.bz2
cd linux-3.5/
cat /boot/config-`uname -r`>.config
make oldconfig

Question time! See below.

make-kpkg clean
time fakeroot make-kpkg -j5 --initrd --revision=3.5.0 --append-to-version=-amd64 kernel_image kernel_headers

This takes a LONG TIME. Change 5 to number of cores+1. 35 minutes with -j5 on a six core desktop.

 mv ../*3.5.0*.deb .

sudo dpkg -i *.deb

And you're done.

Things to ponder in this version:
Tree-based hierarchical RCU leaf-level fanout value (RCU_FANOUT_LEAF) [16] (NEW
Cross Memory Support (CROSS_MEMORY_ATTACH) [Y/n/?] (NEW)
Enable frontswap to cache swap pages if tmem is present (FRONTSWAP) [N/y/?] (NEW)
Opportunistic sleep (PM_AUTOSLEEP) [N/y/?] (NEW)
User space wakeup sources interface (PM_WAKELOCKS) [N/y/?] (NEW)
"HMARK" target support (NETFILTER_XT_TARGET_HMARK) [N/m/?] (NEW)
Generic IEEE 802.15.4 Soft Networking Stack (mac802154) (MAC802154) [N/m/?] (NEW)
Controlled Delay AQM (CODEL) (NET_SCH_CODEL) [N/m/y/?] (NEW)
Fair Queue Controlled Delay AQM (FQ_CODEL) (NET_SCH_FQ_CODEL) [N/m/y/?] (NEW)
Bridge Loop Avoidance (BATMAN_ADV_BLA) [Y/n/?] (NEW)
NFC HCI implementation (NFC_HCI) [N/m/?] (NEW) 
BMP085 digital pressure sensor on I2C (BMP085_I2C) [N/m/?] (NEW)

BMP085 digital pressure sensor on SPI (BMP085_SPI) [N/m/y/?] (NEW)
TCM_QLA2XXX fabric module for Qlogic 2xxx series target mode HBAs (TCM_QLA2XXX) [N/m/?] (NEW) 
 FireWire SBP-2 fabric module (SBP_TARGET) [N/m/?] (NEW) 
PTP Hardware Clock (PHC) (IGB_PTP) [N/y/?] (NEW)
Intel(R) 10GbE PCI Express adapters HWMON support (IXGBE_HWMON) [Y/n/?] (NEW)
PTP Clock Support (IXGBE_PTP) [N/y/?] (NEW)
Data Center Bridging (DCB) Support (MLX4_EN_DCB) [Y/n/?] (NEW)
WIZnet devices (NET_VENDOR_WIZNET) [Y/n/?] (NEW)
WIZnet W5100 Ethernet support (WIZNET_W5100) [N/m/y/?] (NEW)
WIZnet W5300 Ethernet support (WIZNET_W5300) [N/m/y/?] (NEW)
TI Wireless LAN support (WL_TI) [N/y/?] (NEW)
Marvell WiFi-Ex Driver for USB8797 (MWIFIEX_USB) [N/m/?] (NEW) 
Matrix keymap support library (INPUT_MATRIXKMAP) [N/m/y/?] (NEW)
LM8333 keypad chip (KEYBOARD_LM8333) [N/m/?] (NEW) 
 Wacom Tablet support (I2C) (TOUCHSCREEN_WACOM_I2C) [N/m/?] (NEW)
Intel ICH GPIO (GPIO_ICH) [N/m/y/?] (NEW)
Texas Instruments INA219, INA226 (SENSORS_INA2XX) [N/m/?] (NEW)
Intel Atom E6xx Watchdog (IE6XX_WDT) [N/m/y/?] (NEW)
LM3533 Lighting Power chip (MFD_LM3533) [N/m/?] (NEW)
Freescale MC13783 and MC13892 SPI interface (MFD_MC13XXX_SPI) [N/m/y/?] (NEW)
Freescale MC13892 I2C interface (MFD_MC13XXX_I2C) [N/m/?] (NEW)
Intel ICH LPC (LPC_ICH) [M/y/?] (NEW)
 Afatech AF9035 DVB-T USB2.0 support (DVB_USB_AF9035) [N/m/?] (NEW) 
AST server chips (DRM_AST) [N/m/?] (NEW) 
Kernel modesetting driver for MGA G200 server engines (DRM_MGAG200) [N/m/?] (NEW)
Cirrus driver for QEMU emulated device (DRM_CIRRUS_QEMU) [N/m/?] (NEW) 
AUO-K190X EPD controller support (FB_AUO_K190X) [N/m/y/?] (NEW) 
Generic HID driver (HID_GENERIC) [M/n/?] (NEW) 
 Aureal (HID_AUREAL) [N/m/?] (NEW) 
BCMA usb host driver (USB_HCD_BCMA) [N/m/?] (NEW) 
SSB usb host driver (USB_HCD_SSB) [N/m/?] (NEW)
ChipIdea Highspeed Dual Role Controller (USB_CHIPIDEA) [N/m/?] (NEW) 
USB Quatech Serial Driver for USB 2 devices (USB_SERIAL_QT2) [N/m/?] (NEW)
NXP ISP1301 USB transceiver support (USB_ISP1301) [N/m/?] (NEW)
USB Gadget Target Fabric Module (USB_GADGET_TARGET) [N/m/?] (NEW) 
 LED Transient Trigger (LEDS_TRIGGER_TRANSIENT) [N/m/y/?] (NEW) 
 Emulex One Connect HCA support (INFINIBAND_OCRDMA) [N/m/?] (NEW) 
 Comedi default initial asynchronous buffer size in KiB (COMEDI_DEFAULT_BUF_SIZE_KB) [2048] (NEW) 
Comedi default maximum asynchronous buffer size in KiB (COMEDI_DEFAULT_BUF_MAXSIZE_KB) [20480] (NEW)
Amplicon PCI215 and PCI272 DIO board support (COMEDI_AMPLC_DIO200_PCI) [N/m/?] (NEW) 
 Amplicon PCI236 DIO board support (COMEDI_AMPLC_PC236_PCI) [N/m/?] (NEW)
Amplicon PCI263 relay board support (COMEDI_AMPLC_PC263_PCI) [N/m/?] (NEW) 
DAS-08 PCI support (COMEDI_DAS08_PCI) [N/m/?] (NEW)
Configurable Composite Gadget (STAGING) (USB_G_CCG) [N/m/?] (NEW)
 IndustryPack bus support (IPACK_BUS) [N/m/y/?] (NEW) 
GCT GDM72xx WiMAX support (WIMAX_GDM72XX) [N/m/y/?] (NEW)
External Connector Class (extcon) support (EXTCON) [N/m/y/?] (NEW) 
Memory Controller drivers (MEMORY) [N/y] (NEW)
 Log panic/oops to a RAM buffer (PSTORE_RAM) [N/m/y/?] (NEW) 
NFS client support for NFS version 2 (NFS_V2) [Y/n/?] (NEW) 
Codepage macroman (NLS_MAC_ROMAN) [N/m/y/?] (NEW)
Codepage macceltic (NLS_MAC_CELTIC) [N/m/y/?] (NEW)
Codepage maccenteuro (NLS_MAC_CENTEURO) [N/m/y/?] (NEW)
Codepage maccroatian (NLS_MAC_CROATIAN) [N/m/y/?] (NEW) 
Codepage maccyrillic (NLS_MAC_CYRILLIC) [N/m/y/?] (NEW) 
Codepage macgaelic (NLS_MAC_GAELIC) [N/m/y/?] (NEW)
Codepage macgreek (NLS_MAC_GREEK) [N/m/y/?] (NEW)
Codepage maciceland (NLS_MAC_ICELAND) [N/m/y/?] (NEW) 
Codepage macinuit (NLS_MAC_INUIT) [N/m/y/?] (NEW) 
Codepage macromanian (NLS_MAC_ROMANIAN) [N/m/y/?] (NEW) 
Codepage macturkish (NLS_MAC_TURKISH) [N/m/y/?] (NEW)
Generate readable assembler code (READABLE_ASM) [N/y/?] (NEW)
Enable uprobes-based dynamic events (UPROBE_EVENT) [N/y/?] (NEW)
JEDEC DDR data (DDR) [N/y/?] (NEW) 



Links to this page:
http://srmulcahy.github.com/2012/12/24/debian-x230.html
http://stackoverflow.com/questions/13533307/installing-headers-for-3-5-kernel-in-debian-wheezy

20 July 2012

213. Another earthquake (ca 4.3) felt in Melbourne, 20th July 2012

This one (4.3) didn't last as long as the last one, or maybe it was because I was in a busy chinese restaurant in Glen Waverley. Basically felt like sitting on a wooden floor with someone walking across it rapidly. That was at 19.11 (7.11 pm) 20/7/2012.

According to the GA:
Near Moe, Vic. Magnitude: 4.3 (ML) Depth: 0 km Tsunamigenic: Not available 
Date and Time UTC: 20 July 2012 @ 09:11:31 Sydney Time: 20 July 2012 @ 19:11:31 (AEST) 
Location Coordinates: -38.282, 146.164 
Solution status Last updated: 20 July 2012 @ 19:23:11 (AEST) Solution finalised: No Source: AUST 

Would say duration about 5 seconds. My wife didn't feel it, and it seems like few others did, as the noise in the restaurant didn't die down at all.

Not much of an experience in the SE Melbourne suburbs this time, and I don't think it will generate much media excitement this time.

IF YOU FELT IT, REPORT IT:
 http://www.ga.gov.au/earthquakes/staticPageController.do?page=felt-earthquake

The Australian GA didn't crash this time. Look here for good ol' local details about the 'quake:
http://www.ga.gov.au/earthquakes/getQuakeDetails.do?quakeId=3237322



But here's what's out there so far:

http://news.ninemsn.com.au/national/8502657/earthquake-reportedly-shakes-melbourne

http://www.theage.com.au/victoria/second-earthquake-shakes-melbourne-20120720-22fo6.html

This blog claims to have pictures from mayhem in a supermarket from this latest earthquake:
http://www.dirtydazz.com/wow-im-sure-we-just-had-another-earth-tremor-quake-in-melbourne-711pm-20-july/

That's 2 earthquakes in Melbourne in the past month -- and the last one was on the 19th of June, a day and a month ago.

From USGS:
13 km (8 miles) SW of Moe, Australia
21 km (13 miles) W of Morwell, Australia
34 km (21 miles) W of Traralgon, Australia
77 km (47 miles) ESE of Cranbourne, Australia


212. TmoleX client on Debian

Based on what Andreas Klamt has said about COSMO vs COSMO-RS I figured it might be worth taking a look at Turbomole. Turbomole is not GPLd, so whether it's a viable approach depends on whether you have a university paying for a license on your behalf. Luckily, I do, and APAC also has it on their HPC clusters.

As always, turbomole may or may not be for you -- the basis set nomenclature is definitely different from the Pople one. I'm only half-heartedly shopping around among different computational packages, but my guides may benefit someone.

The client is free and can be downloaded from here:
http://www.cosmologic.de/index.php?cosId=3016&crId=3

put TmoleXClient33_Linux64.sh in your ~/tmp
launch it by doing
sh TmoleXClient33_Linux64.sh

I don't like the idea of littering my system folders with symmlinks when you can fire up your PATH instead.
If you want to install in /opt, make sur eyou've already created /opt/COSMO and chown:ed it

Once all that's done you can do
echo 'export PATH=$PATH:/opt/COSMO/bin' >> ~/.bashrc
source ~/.bashrc

Start the binary by typing
TmoleX


211. Putting a 'Hold' on Gnome

Update 05/08/2012: The Mint people may have their own reasons for forking various GNOME components, but it seems that the removal of features in Nautilus was a direct reason for the creation of Nemo: http://www.webupd8.org/2012/08/nemo-linux-mint-team-forks-nautilus.html


There are a lot of things which are yet to come to Gnome. It's becoming increasingly clear that the Gnome people are going to push their ideas on the distros using Gnome regardless of whether the changes make sense or not. My main issue is still the destruction of gnome-screenshot, but it's clear that there are other things afoot that will make many of us unhappy. See e.g. nautilus

Actually, GNOME 3 is mostly fine. It's the removal of functionality from some of the GNOME applications which bothers me the most.

Going to KDE, XFCE, Xmonad, LXDE etc. won't bring me back gnome-screenshot. When it comes to Evolution, Epiphany etc. there are plenty of good alternatives. But Shutter etc. don't cut it when it comes to replacing gnome-screenshot. Nautilus, to me, is a good file manager and I prefer it to e.g. dolphin, thunar etc. for various reasons (dolphin because it's QT, thunar because...I don't even remember. Maybe I should have a look at it again...)

In all fairness, a subsection of the users will not care or maybe even like changes that I hate. Change isn't bad. Bad changes are bad. Change for the sake of change is bad.

Anyway. A temporary solution is to freeze gnome and not allow upgrades until you are sure that you won't be trading higher version numbers for reduced functionality.

Also, some might like the Mac-like idea of putting menus at the top of the screen, while most people using a desktop-sized screen will be severely unhappy with this (mouse has to travel a lot further). 

I suppose the idea is that you're only using one application per desktop at a time BUT WHY WAS THIS EVER THOUGHT TO BE THE WAY PEOPLE WORK?

Really, designing with non-work uses (chat/browsing) in mind seems a bit counter-productive. Literally.

Wikipedia has a list of the gnome applications which are the things that might get fiddled with. Basically, google for upcoming changes and prevent the heck out of them.

Early warning about stuff about to be changed in GNOME 3.6: 
see e.g. http://www.phoronix.com/scan.php?page=news_item&px=MTEzMzY
empathy
clutter
evolution
mutter
nautilus

Additional stuff to consider freezing
gnome-screenshot
gnome-shell
epiphany-browser
evince

Again, change may be good, but we've been burned before, so better to freeze stuff now, and make deliberate decisions about what changes to allow once they've been tested.

So how to freeze specific packages?
sudo su
echo "empathy hold"|dpkg --set-selections
echo "epiphany-browser hold"|dpkg --set-selections
echo "evince hold"|dpkg --set-selections
echo "gnome-shell hold"|dpkg --set-selections
echo "gnome-screenshot hold"|dpkg --set-selections
echo "mutter hold"|dpkg --set-selections
echo "mutter-common hold"|dpkg --set-selections
echo "nautilus hold"|dpkg --set-selections

Note that this may hold other packages, which list the above packages as dependencies, back as well. Still, better to make informed choices.

19 July 2012

210. Compiling CPMD on Debian Wheezy

[To those coming here from cpmd.org -- I wasn't meant to post in the bug tracking section, but unfortunately I also can't delete posts]

Here's how to compile cpmd on Wheezy. CPMD is the standard implementation of ab initio Carr-Parrinello method for molecular dynamic and would thus be useful to have at hand.

It took a fair while to hammer out the method, so this post might not read very well. Right now I'm having crashes after the binary has been running for a while -- this point towards system resources more than anything else.


WARNING:
 This involves patching a file -- you never know IF that causes problems with the output. To the best of my knowledge, it should be safe.

There's no reason to think that Ubuntu and Linux mint won't work just as well (i.e. you may want to look here if you're trying to compile for Ubuntu or Mint)

Errors I encountered on the road are found at the end of the post together with solutions.




COMPILING THE BINARY

First you need to request a username and password from http://cpmd.org/. That'll take a few days.

You may have to install libopenmpi-dev libfftw3-dev libblas-dev first

Once your application is approved and you've downloaded your file (in my case cpmd-v3_15_3.tar.gz) copy it to ~/tmp, then

tar -xvf cpmd-v3_15_3.tar.gz
cd CPMD/CONFIGURE

create CONFIGURE/LINUX-x86_64-DEBIAN
     IRAT=2
     CFLAGS='-c -O2 -Wall'
     CPP='/lib/cpp -P -C -traditional'
     CPPFLAGS='-D__Linux -D__PGI -D__GNU -DFFT_FFTW3 -DPARALLEL -DPOINTER8'
     FFLAGS='-c -O2 -fcray-pointer -fno-whole-file -fsecond-underscore'
     LFLAGS='-lfftw3 -lfftw3f -I/usr/include -lblas -llapack -lpthread -lmpi'
     FFLAGS_GROMOS='  $(FFLAGS)' 
      FC='mpif77 -fbounds-check'
      CC='mpicc'
      LD='mpif77 -fbounds-check'


cd ../

Edit the following lines in wfnio.F and change them to:
 15       CHARACTER(len=*) TAG
 63         IF(TAG(1:2).EQ.'NI') THEN
201       IF(TAG(1:2).NE.'NI') THEN
271         IF(TAG(1:2).EQ.'NI') THEN
(See below for the reasons why)

./mkconfig.sh LINUX-x86_64-DEBIAN > Makefile
make -j5

You should now have a working binary. This was a real PITA to sort out.

sudo mkdir /opt/cpmd
sudo chown $USER /opt/cpmd
cp cpmd.x /opt/cpmd


Done! Almost...



Time to get some pseudopotential files from http://cpmd.org/download

Download the following files:
http://cpmd.org/downloadable-files/authentication/contributions/pseudo_std.tar.gz
http://cpmd.org/downloadable-files/authentication/contributions/pseudo_ext.tar.gz
http://cpmd.org/downloadable-files/authentication/contributions/pseudo_vdb.tar.gz
And some test files:
http://cpmd.org/downloadable-files/authentication/contributions/cpmd-test.tar.gz
Put them in /opt/cpmd
cd /opt/cpmd
ls *.gz|xargs -I {} tar xvf {}
echo "export PP_LIBRARY_PATH=/opt/cpmd/PP_LIBRARY" >>~/.bashrc
echo "export PATH=$PATH:/opt/cpmd" >>~/.bashrc.
source ~/.bashrc

Note:
For some reason cpmd refuses to read my pseudopotential files unless I remove the .psp ending. Doesn't matter how eagerly I'm trying to point cpmd in the right direction. You can quickly mv all the psp files like this:
cp /opt/cpmd/pseudo_extlib/*.psp /opt/cpmd/PP_LIBRARY/
cd  /opt/cpmd/PP_LIBRARY/
ls *.psp|sed 's/\./\t/g'|gawk '{print $1}'|xargs -I {} mv {}.psp {}
mv Cu_MT_PBE_SEMI_2.08.psp Cu_MT_PBE_SEMI_2.08
mv Ga.1_GO_LDA.psp Ga.1_GO_LDA
Not that this will guarantee that it'll work. I often find myself putting the full relative path in the .in file:

&ATOMS
*../../PP_LIBRARY/O_MT_PBE KLEINMAN-BYLANDER
LMAX=P
Anyway

Test your binary
cd /opt/cpmd/CPMD-test/vdw
mpirun -n 4 cpmd.x ch4-ch4.inp


 ****************************************************************
 *                                                              *
 *                            TIMING                            *
 *                                                              *
 ****************************************************************
 SUBROUTINE            CALLS         CPU TIME        ELAPSED TIME
        HIP               12            19.64               21.55
    FFT-G/S              734            11.94               12.02
     GCENER               12             4.82                4.86
      FWFFT               72             4.80                4.85
    INVFFTN              100             3.93                3.93
     INVFFT               61             3.82                3.86
    HOCKNEY                1             3.20                3.31
     FFTCOM              133             2.34                2.33
       VPSI               21             2.22                2.20
     FWFFTN               56             2.14                2.15
     XCENER               12             1.70                1.71
     RHOOFR               11             1.59                1.61
     GRADEN               12             1.58                1.58
      PHASE              133             1.46                1.43
     LOADPA                1             1.30                1.31
      ODIIS               11             0.96                0.99
   N-FFTCOM              156             0.80                0.82
    VOFRHOH               12             0.61                0.62
    VOFRHOB               12             0.57                0.57
     EICALC               12             0.43                0.43
      NUMPW                1             0.31                0.31
      ATRHO                1             0.26                0.29
 ----------------------------------------------------------------
 TOTAL TIME                             70.43               72.74
 ****************************************************************

       CPU TIME :    0 HOURS  1 MINUTES 11.75 SECONDS     
   ELAPSED TIME :    0 HOURS  1 MINUTES 14.21 SECONDS     
 ***      CPMD| SIZE OF THE PROGRAM IS  141512/ 484936 kBYTES ***

 PROGRAM CPMD ENDED AT:   Thu Jul 19 12:50:17 2012  

 ================================================================
 = COMMUNICATION TASK  AVERAGE MESSAGE LENGTH  NUMBER OF CALLS  =
 = SEND/RECEIVE              370967. BYTES                 51.  =
 = BROADCAST                  10413. BYTES                297.  =
 = GLOBAL SUMMATION            1153. BYTES                190.  =
 = GLOBAL MULTIPLICATION          0. BYTES                  1.  =
 = ALL TO ALL COMM          8815282. BYTES                313.  =
 =                             PERFORMANCE          TOTAL TIME  =
 = SEND/RECEIVE             3014.256  MB/S           0.006 SEC  =
 = BROADCAST                 271.033  MB/S           0.011 SEC  =
 = GLOBAL SUMMATION            1.996  MB/S           0.220 SEC  =
 = GLOBAL MULTIPLICATION       0.000  MB/S           0.001 SEC  =
 = ALL TO ALL COMM           643.149  MB/S           4.290 SEC  =
 = SYNCHRONISATION                                   0.067 SEC  =
 ================================================================


Almost completely and utterly done.

There are a few more things to do for a full install:
 1. cpmd2cube
Download cpmd2xyz-scripts.xyz and cpmd2cube.tar.gz and put them in ~/tmp

cd ~/tmp
tar xvf cpmd2cube.tar.gz
cd cpmd2cube/
./Configure  Linux-PC-GFORTRAN-FFTW >Makefile


Edit the Makefile
 11 #--------------- Configuration

 12 FC  = mpif77
 13 FFLAGS  =  -ffree-form -D__GFORTRAN -DFFT_FFTW3 -std=gnu -O2  -fno-whole-file
 14 LFLAGS  =
 15 LIBS    =  -lfftw3

Then compile:
make

cp *.x /opt/cpmd/

2. cpdm2xyz-scripts
tar xvf cpmd2xyz-scripts.tar.gz
mv *xyz.pl /opt/cpmd/



ERRORS I encountered on the way to success:


Why I patched wfnio.F



 (K+E1+L+N+X)           TOTAL ENERGY =          -15.69316800 A.U.
 (K)                  KINETIC ENERGY =           11.26654720 A.U.
 (E1=A-S+R)     ELECTROSTATIC ENERGY =          -14.51438081 A.U.
 (S)                           ESELF =           15.95769122 A.U.
 (R)                             ESR =            0.61466148 A.U.
 (L)    LOCAL PSEUDOPOTENTIAL ENERGY =           -8.04105016 A.U.
 (N)      N-L PSEUDOPOTENTIAL ENERGY =            1.58864226 A.U.
 (X)     EXCHANGE-CORRELATION ENERGY =           -5.99292649 A.U.
          GRADIENT CORRECTION ENERGY =           -0.34038005 A.U.

 NFI      GEMAX       CNORM           ETOT        DETOT      TCPU
   1  2.271E-02   2.070E-03     -15.693168    0.000E+00     12.31
   2  2.968E-03   6.595E-04     -16.042408   -3.492E-01     12.23
   3  2.302E-03   2.795E-04     -16.073138   -3.073E-02     12.41
   4  1.202E-03   1.028E-04     -16.079251   -6.113E-03     13.11
   5  5.911E-04   3.645E-05     -16.080017   -7.655E-04     12.86
   6  2.152E-04   1.926E-05     -16.080119   -1.020E-04     12.27
   7  7.666E-05   8.749E-06     -16.080151   -3.277E-05     12.24
   8  4.416E-05   4.054E-06     -16.080159   -8.141E-06     12.54
   9  2.411E-05   1.531E-06     -16.080162   -2.318E-06     12.14
  10  1.203E-05   5.610E-07     -16.080162   -3.935E-07     12.22
  11  6.744E-06   2.833E-07     -16.080162   -3.662E-08     12.31
At line 2 of file ./wfnio.f
Fortran runtime error: Actual string length is shorter than the declared one for dummy argument 'tag' (2/10)

Line 2 in wfnio.f is 

      SUBROUTINE W_WFNIO(NW,IERROR,NSTATE,C,TAG)


I tried compiling with my own openblas libraries:

Used the following config file base:
     IRAT=2
     CFLAGS='-c -O1 -Wall'
     CPP='/lib/cpp -P -C -traditional'
     CPPFLAGS='-D__Linux -D__PGI -D__GNU -DFFT_FFTW -DPOINTER8  -DPARALLEL'
      FFLAGS='-c -O2 -fcray-pointer -fno-whole-file -fsecond-underscore'
     LFLAGS='-L/opt/fftw/fftw-2.1.5/double/lib -l:libfftw.a -I/opt/fftw/fftw-2.1.5/double/include -I/usr/include -L/opt/openblas/lib -lopenblas'
     FFLAGS_GROMOS='  $(FFLAGS)'
      FC='mpif90'
      CC='mpicc'
      LD='mpif90'


Tested with:
!  Wavefunction optimization using default setting
!
 &CPMD
    OPTIMIZE WAVEFUNCTION
 &END
 &SYSTEM
   SYMMETRY
    1
   CELL
    10.2612  1.0    1.0   0.0 0.0 0.0
   CUTOFF
   13.
 &END
 &ATOMS
*SI_SGS  KLEINMAN-BYLANDER
  LMAX=P
   8
           .00000      .00000      .00000    1
           .00000     5.13000     5.13000    1
          5.13000      .00000     5.13000    1
          5.13000     5.13000      .00000    1
          2.56500     2.56500     2.56500    1
          2.56500     7.69500     7.69500    1
          7.69500     2.56500     7.69500    1
          7.69500     7.69500     2.56500    1
 &END

And here's the output (NOTE: it wouldn't have worked anyway due to missing pseudopot files. But that's unrelated):
 PROGRAM CPMD STARTED AT: Wed Jul 18 20:41:51 2012
 SETCNST| USING: CODATA 2006 UNITS

[LOTS OF STUFF CUT OUT]
 EXCHANGE CORRELATION FUNCTIONALS
    LDA EXCHANGE:                                            NONE
    LDA XC THROUGH PADE APPROXIMATION
    S.GOEDECKER, J.HUTTER, M.TETER PRB 54 1703 (1996)

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:#0  0x2B3D01CFA667#1  0x2B3D01CFAC34#2  0x2B3D026F64EF#3  0x2B3CFFD8CBF7Segmentation fault


Valgrind told me:

 EXCHANGE CORRELATION FUNCTIONALS 
    LDA EXCHANGE:                                            NONE
    LDA XC THROUGH PADE APPROXIMATION
    S.GOEDECKER, J.HUTTER, M.TETER PRB 54 1703 (1996)

==1406== Invalid read of size 8
==1406==    at 0x59D0BF7: dcopy_k (in /opt/openblas/lib/libopenblas_barcelona-r0.1.1.so)
==1406==    by 0x485152: setsc_ (in /home/me/tmp/CPMD/cpmd.x)
==1406==    by 0x4264EE: cpmd_ (in /home/me/tmp/CPMD/cpmd.x)
==1406==    by 0x4262EE: main (in /home/me/tmp/CPMD/cpmd.x)
==1406==  Address 0x30016a9908 is not stack'd, malloc'd or (recently) free'd
==1406== 

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7737667
#1  0x7737C34
#2  0x81314EF
#3  0x59D0BF7
==1406== 
==1406== HEAP SUMMARY:
==1406==     in use at exit: 2,152,258 bytes in 2,802 blocks
==1406==   total heap usage: 10,893 allocs, 8,091 frees, 16,699,612 bytes allocated
==1406== 
==1406== LEAK SUMMARY:
==1406==    definitely lost: 567 bytes in 20 blocks
==1406==    indirectly lost: 2,973 bytes in 9 blocks
==1406==      possibly lost: 0 bytes in 0 blocks
==1406==    still reachable: 2,148,718 bytes in 2,773 blocks
==1406==         suppressed: 0 bytes in 0 blocks
==1406== Rerun with --leak-check=full to see details of leaked memory
==1406== 
==1406== For counts of detected and suppressed errors, rerun with: -v
==1406== Use --track-origins=yes to see where uninitialised values come from
==1406== ERROR SUMMARY: 591 errors from 4 contexts (suppressed: 4 from 4)
Segmentation fault

Ergo, it seems to be a problem with the openblas libs -- but they've work just fine with nwchem and gromacs...who knows? It might be due to mixing debian fftw3 and my own openblas.

I compiled openblas according to http://verahill.blogspot.com.au/2012/05/nwchem-with-openblas.html



If you're having problems with the output below it is because fftw 2 and fftw 3 are not compatible and CPDM uses the fftw 2 iface by default.


mltfft.o: In function `mltfft_fftw_': mltfft.f:(.text+0x958): undefined reference to `fftw_f77_create_plan_' mltfft.f:(.text+0x9af): undefined reference to `fftw_f77_' mltfft.f:(.text+0x9c2): undefined reference to `fftw_f77_destroy_plan_' mltfft.f:(.text+0xaee): undefined reference to `fftw_f77_create_plan_' mltfft.f:(.text+0xb4d): undefined reference to `fftw_f77_' mltfft.f:(.text+0xd03): undefined reference to `fftw_f77_' mltfft.f:(.text+0xdc4): undefined reference to `fftw_f77_' mltfft.f:(.text+0xe6e): undefined reference to `fftw_f77_create_plan_' mltfft.f:(.text+0xe8f): undefined reference to `fftw_f77_create_plan_' collect2: ld returned 1 exit status make: *** [cpmd.x] Error 1

You can either
1. Install fftw2 (sudo apt-get install fftw-dev, fftw2), and put -l:libfftw.so.2 -l:librfftw.so.2 in your LFLAGS.
or
2. Set -DFFT_FFTW3 instead of -DFFT_FFTW.

209. Quantum Espresso on Debian

Quantum Espresso seems to be a fairly capable software package for ab initio QM and MD calculations. In their own words:
"Quantum ESPRESSO is an integrated suite of Open-Source computer codes for electronic-structure calculations and materials modeling at the nanoscale.It is based on density-functional theory, plane waves, and pseudopotentials."

Reading between the lines it seems to be particularly geared towards solid state simulations, but given that I haven't used it much (I'm just an interested observer), you may take that statement with a grain of salt.

Anyway. Here's how to get it up and running.
Don't ask me how to USE these pieces of software though. For that, read the documentation at the Quantum Espresso website or look in /opt/QE/Doc


The download page can be found here: http://qe-forge.org/frs/?group_id=10. You won't need all the packages, since the espresso-5.0.tar.gz bundles most of them.

1. Housekeeping:
sudo mkdir /opt/QE
sudo chown $USER /opt/QE
mkdir ~/tmp/QE -p
cd ~/tmp/QE

2. Downloading:
wget http://qe-forge.org/frs/download.php/211/espresso-5.0.tar.gz
wget http://qe-forge.org/frs/download.php/214/PWgui-5.0.tgz
wget http://qe-forge.org/frs/download.php/204/xspectra-5.0.tar.gz

3. Extraction:
tar xvf espresso-5.0.tar.gz
tar xvf PWgui-5.0.tgz
tar xvf xspectra-5.0.tar.gz

4. Compilation:
cd espresso-5.0/

Edit environment_variables and set them to e.g.

PREFIX=/opt/QE
TMP_DIR=/scratch
PARA_PREFIX=" mpirun -n 3"

Don't know if any of those params are ever read though.

The following parameters will depend on your system. I tried compiling with openblas without luck. who knows? It might be due to mixing debian fftw3 and my own openblas.

Instead, install libblas-dev, libfftw3-dev, libopenmpi-dev etc.

./configure --prefix=/opt/QE/bin --exec-prefix=/opt/QE/bin/ FC=mpif90 BLAS_LIBS=-lblas LIBS="-lmpi -lopen-rte -lopen-pal -ldl -lmpi_f77 -lpthread" CPPFLAGS="-I/usr/lib/openmpi/include"
cd PW/
make

cd ../
make all -j5 
echo 'export PATH=$PATH:/opt/QE/bin' >>~/.bashrc
echo 'export PSEUDO_DIR=/opt/QE/pseudo' >>~/.bashrc
(replace 5 with  the number of cores you compile with +1)

cp * -R /opt/QE/
source ~/.bashrc

For some reason I had to move everything by hand. Oh well.

[It should be enough to set the env var PSEUDO_DIR to point at /opt/QE/pseudo, but it didn't work for me. Instead I symmlinked the entire /opt/QE to ~/espresso. Desperate? Sure...
ln -s /opt/QE/ /home/me/espresso]


5. Testing PW
Some examples are found in /opt/QE/PW/examples
cd /opt/QE/PW/examples/example01
./run_examples

/opt/QE/PW/examples/example01 : starting
This example shows how to use pw.x to calculate the total energy and
the band structure of four simple systems: Si, Al, Cu, Ni.
  executables directory: /opt/QE/bin
  pseudo directory:      /opt/QE/pseudo
  temporary directory:   /scratch
  checking that needed directories and files exist... done
  running pw.x as: mpirun -n 3 /opt/QE/bin/pw.x
  cleaning /scratch... done
  running the scf calculation for Si... done
  running the band-structure calculation for Si... done
  cleaning /scratch... done
  ..
  cleaning /scratch... done
  running the scf calculation for Ni... done
  running the band-structure calculation for Ni... done
Or you can try

cd /opt/QE/PW/tests/
./check-pw.x.j
A number of tests will now be executed.  Most will pass.
IF YOU DON'T HAVE A vdw_kernel_table file one of the tests will fail.

6. Installing PWgui
Assuming you downloaded and extracted the PWgui-5.0.tgz file in step 2 above.
sudo apt-get install itk3 iwidgets4
cd ~/tmp/QE/
mv PWgui-5.0 /opt/QE/
cd /opt/QE/bin
ln -s /opt/QE/PWgui-5.0/pwgui /opt/QE/bin/pwgui

Start by typing
pwgui


settings
You can try e.g. opening /opt/QE/PW/examples/example01/results/al.scf.cg.in if you ran the test in step 5 above. Then run it.


7. Installing Xspectra
This assumes you downloaded and extracted as shown in steps 2-3 above.
cd ~/tmp/QE/
mv XSpectra/ espresso-5.0/
cd espresso-5.0/XSpectra/
make
cd ..
mv XSpectra/ /opt/QE/
cd /opt/QE/bin
ln -s /opt/QE/XSpectra/src/xspectra.x xspectra.x



Notes: in an ideal world the --prefix during configure should suffice in telling a program where to install. No luck for me here though. Also, I had to start the compile in the PW directory and only by using make without any switches, or there would be complaints about a missing libpw.a

13 July 2012

208. Weird things with desktops -- nvidia cockup?

Just in case someone else is having an equally entertaining Friday the 13th (of July 2012).

So, I had a little gnome 3 crash. You know the ones with the frowny screen and a message saying that "yeah, we probably could have let you save everything you're working one but screw you 'cos we're logging you out"? (hmm...don't remember seeing that with gnome 2/metacity -- have we in fact been turned into Metro/Win8 guinea pigs?!)

Well, anyway, I had one of those and rebooted.

I got to gdm3, logged in and...nothing. I mean, I saw the desktop background, but no menus, nothing. Nothing at all. Moving the mouse to the top left corner would give me the typical gnome-shell splash pattern and make the screen a bit darker. I didn't get anything else though (like a list over programs, icons or anything). Oh, and the conky stuff briefly flashed by each time (but in the top left area instead of flush to the right side of the screen)

Given that I played around with testing different desktops recently I figured I might have upset the update-alternatives balance, and played around with --config x-window-manager and --config x-session-manager. I mean, I was hoping that the lack of a menu of some sort was due to having the wrong window manager, in spite of all the signs pointing to me actually using gnome-shell.

That not working I spent another hour playing with installing and uninstalling nvidia. For some reason smxi pulled in the 173 driver, before replacing it with 302. Every time. Finally, I managed to get everything to the point where I could do startx with the nouveau drivers installed.

Not that things were perfect -- in fact my screen was scaled to 1024*768 (supposed to be 1920x1280), and the flicker whenever I moved my mouse was not funny, but at least it kind of worked.

So back to the terminal, sudo rmmod nouveau, sudo smxi, install the nvidia driver again -- but this time selecting nvidia current instead of debian-nvidia, and then startx

Huh. This time I kind of got the icon panel and the bottom panel, and the gnome-shell hot corner worked ok. It's almost like...no way...is it pretending I have two displays???

I then went to System settings/Displays and the bloody thing had set it up so there were two active display (I don't OWN two displays and certainly did not set this willingly).

Here it's been deactivated. But seriously, wtf???

So if you find yourself in a similar situation without panels and stuff: check your settings. Now how the hell did this come about? And who can I blame? Debian? Nvidia? Nvidia has been the cause of most of my more severe problems with debian...I just wish nouveau was a better alternative than it currently is for my setup.

PS I do realise that some of the language in the post above is more fitting for a valley girl, but screw this: I'm a busy person with a tight schedule (semester starts in two weeks and still hammering away on lectures, not to mention research) who lost three valuable Friday afternoon hours on a stupid thing. Not happy.

12 July 2012

207. apt-get, apt-cacher-ng and hash sum mismatch

Update: Another day and we're back to the same crap with Hash sum mismatches. It's getting old...however, I'm beginning to suspect it's not the mirror, but my apt-cacher-ng.

I was getting a bit peeved with getting intermittent messages about 'hash sum mismatch' etc. when trying to do sudo apt-get update

Ign http://dl.google.com stable/main Translation-en                                                                                                                                                                                         
Fetched 17.1 MB in 9s (1,736 kB/s)                                                                                                                                                                                                          
W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_main_binary-amd64_Packages  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_contrib_binary-amd64_Packages  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_non-free_binary-amd64_Packages  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_contrib_i18n_Translation-en  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_main_i18n_Translation-en  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_non-free_i18n_Translation-en  Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.


So I took action:
sudo rm -rf /var/cache/apt-cacher-ng/*

But then
sudo apt-get update    
Get:1 http://192.168.1.1 testing InRelease [190 kB]
Err http://192.168.1.1 testing InRelease                                                                                                                        
Ign http://192.168.1.1 stable InRelease                                                                                                                         
Get:2 http://192.168.1.1 stable Release.gpg [1,672 B]                                                                                    
..
Fetched 7,004 kB in 7s (965 kB/s)                                                                                                                                                                                                           
Reading package lists... Done
W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://192.168.1.1 testing InRelease: File /var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_InRelease doesn't start with a clearsigned message

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/InRelease  

so I

sudo apt-get install debian-keyring

which didn't solve anything

Solution:
Edit you /etc/apt/sources.list and replace all instances of testing with wheezy, e.g.

deb http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/ wheezy main contrib non-free
deb http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/ stable main contrib non-free

I don't know if this has to do with the transition towards freezing wheezy, but basically, if you're having problems like that, have a look at what's actually on the mirror you're using. In my case I had a look at ftp://ftp.iinet.net.au/debian/debian/dists/ and found no 'testing' directory.


It also took care of these related messages on a different node:

Fetched 7,493 kB in 8s (885 kB/s)
W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/contrib/binary-amd64/PackagesIndex  MD5Sum mismatch

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/contrib/i18n/Translation-enIndex  MD5Sum mismatch

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/non-free/binary-amd64/PackagesIndex  MD5Sum mismatch

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/non-free/i18n/Translation-enIndex  MD5Sum mismatch

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/main/i18n/Translation-enIndex  MD5Sum mismatch

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/main/binary-amd64/PackagesIndex  MD5Sum mismatch

206. Chrome, cookies and incessant spying

With age and added responsibilities I'm becoming grumpier and grumpier.

I read lxer.com everyday since it provides a good aggregation of linux-related news. On clicking on this link to h-online I was shown a pop-up in the top left corner letting me know that h-online uses cookies, and by clicking close my consent to be tracked is assumed. A link was given to a page where I could opt out, and another link to etracker was provided on that page. Clicking on that and eventually getting past the captcha told me that etracker will no longer track my browser (so I have to do it for chrome, chromium, and iceweasel? And on every one of my six computers?)

I signed up for my first dial-up internet connection in 1996, and as far as I can remember cookies were heavily discussed already back then. However -- and again this is as far as I can remember -- accepting cookies wasn't necessary since not every website + their mum was using them to track you. 

As far as I can see there are a few reasons why websites want to set first or third party cookies:
* Ads. Targeted ads.
* Information. Which is then sold to companies tailoring ads.
* Automatic log-in and customisations
* Because everyone else is doing it


I've cleared my cache, but I saw cookies from the Swedish ministry of foreign affairs, among others. I find it difficult to imagine a legitimate reason for them to set a local cookie on my computer. I don't think there is any evil intent behind it -- instead it's probably a case of 'why not?'.


It's easy enough to set your browser to block all cookies or to automatically delete them on closing your browser. Some browsers allow you to accept cookies on a site/provider basis. This easily leads to you having to click pop-up after pop-up after pop-up...

The ideal case -- from the point of the user -- is one where you block all cookies and add exceptions for sites that YOU deem have legitimate reasons to set cookies and where YOU benefit from having cookies set.

A little experiment. Try disabling cookies completely, and then log-in to your blogger or gmail account. Try adding an exception for google servers only, then log in to blogger -- you get stuck in a nice little loop which only gets broken if you add an exception for blogger.

In fact, I can't even do much on the university network without allowing cookies -- the university wants to set cookies in order to allow me to do just about anything.

Anyway, after that rant, here's how you might want to manage your cookies in google chrome:
Got to settings in google chrome and type in cookies

Click on Content Settings.
Check:
* Block sites from settings any data
* Block third party cookies and site data
Then click on Manage Exceptions 

 Add sites YOU feel should have the right to add cookies.
With google and blogger you have little choice: in order to use those sites you need to enable cookies.
Note that wildcards are added using [*.]


You may also want to clear you cache to get rid of cookies which have already been set.
Continuously add exceptions for sites which you want to grant the ability to set cookies. 

You can also add sites by clicking on the cookie icon to the right of the URL field in your browser:

Take a look at what cookies are set every now and again.

If you find that you have plenty of cookies like these:

it's likely because you have the Google Opt Outs enabled: