Showing posts with label compile. Show all posts
Showing posts with label compile. Show all posts

09 January 2013

311. Compiling MPE for MPI profiling

I've been wanting to get an overview of how my parallel (nwchem, gamess, dalton, etc.) programs are running, and whether there are any obvious bottlenecks other than the network and slow harddrives that I can sort out.

The Australia high performance computer facility in Canberrra uses http://ipm-hpc.sourceforge.net/, but I'm not having much luck compiling it, and the lack of recent updates makes me somewhat less willing to invest too much effort into it.

So I stumbled across MPE instead: http://www.mcs.anl.gov/research/projects/perfvis/download/index.htm#MPE

The problem is that almost all of the links of that page are broken, including those pointing towards the documentation, so I don't actually know how to use it properly. The presence of mpecc in /opt/mpe/bin suggests that it's used as a stand-in for mpicc when compiling, which I'll test some day.


Installing/compiling
cd ~/tmp
wget ftp://ftp.mcs.anl.gov/pub/mpi/mpe/mpe2.tar.gz
tar xvf mpe2.tar.gz
cd mpe2-1.3.0/
./configure MPI_CC=mpicc MPI_F77=mpif77 --prefix=/opt/mpe
make
sudo make install

I found what I looked for in Tau instead: 
http://verahill.blogspot.com.au/2013/01/312-tau-mpi-profiling-on-debian.html

19 December 2012

296. Building Wine 1.5.19 on Debian (Wheezy/Testing) without errors

UPDATE 16 May 2013: See here for Wine 1.5.30: http://verahill.blogspot.com.au/2013/05/416-wine-1530-in-chroot.html

UPDATE (10th Jan 2013): See here for Wine 1.5.21 using the multiarch approach: http://verahill.blogspot.com.au/2013/01/308-compiling-wine-1521-on-debian.html

This time we'll be cheating and using the carbon-dev.org debian rules to build wine 1.5.19, which works amazingly well with a tiny bit of editing. In spite of what it looks like, this build is easy.



This is also my first encounter with multiarch since libgsm was causing issues (think it's moved out of ia32). Ultimately, multiarch will be the proper way to build 32-bit wine anyway, but I'll deal with that some other day.

Interesting fact: if you try to build with ... 1>build.log 2> build.err the build will fail since files are changing in the main directory during build. Make sure that you do e.g. .. 1> ../build.log 2> ../build.err if you want to track the build.

Finally, I've also built wine 1.5.18 this way, in addition to wine 1.5.19.

The build starts here:

Here's my current best guess at dependencies (Note that multiarch on ubuntu is a little bit different from Debian.):
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install ia32-libs ia32-libs-dev bison flex gcc libc6-dev libfontconfig-dev libfreetype6-dev libglu-dev libgsm1-dev libice-dev libjpeg-dev libldap-dev libmpg123-dev libncurses5-dev libopenal-dev libpng-dev libsm-dev libssl-dev libusb-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libxrender-dev libxslt-dev libxt-dev libxxf86vm-dev make libcapi20-dev liblcms-dev libsane-dev libhal-dev libdbus-1-dev valgrind prelink libcups2-dev opencl-dev lib32opencl1 oss4-dev gettext lib32v4l-dev lib32ncurses5-dev lib32asound2-dev libtiff4-dev libgphoto2-2-dev libxkbfile-dev libxxf86dga-dev freeglut3-dev unixodbc-dev gcc-multilib
sudo apt-get install libgsm1:i386
Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: gcc-4.7-base:i386 libc6:i386 libc6-i686:i386 libgcc1:i386 Suggested packages: glibc-doc:i386 locales:i386 The following NEW packages will be installed: gcc-4.7-base:i386 libc6:i386 libc6-i686:i386 libgcc1:i386 libgsm1:i386 0 upgraded, 5 newly installed, 0 to remove and 2 not upgraded. Need to get 5,412 kB of archives. After this operation, 11.9 MB of additional disk space will be used. [..]
Once you've got that sorted, it is time to download the sources:
mkdir -p ~/tmp/wine_1.5.19_carbon/
cd ~/tmp/wine_1.5.19_carbon/
wget http://mirrors.ibiblio.org/wine/source/1.5/wine-1.5.19.tar.bz2 -O wine-unstable_1.5.19.orig.tar.bz2
tar xvf wine-unstable_1.5.19.orig.tar.bz2
cd wine-1.5.19/
wget http://dev.carbon-project.org/debian/wine-unstable/wine-unstable_1.5.5-0.1.debian.tar.bz2
tar xvf wine-unstable_1.5.5-0.1.debian.tar.bz2
rm wine-unstable_1.5.5-0.1.debian.tar.bz2

We could do the editing the proper way, or the quick way. Since I'm not really that familiar with build debian packages the right way (I cheat using checkinstall) we're doing this the quick and dirty way:
sed -i 's/1.5.5/1.5.19/g' debian/changelog
sed -i 's/\-4.5//g' debian/rules
sed -i 's/\-4.5//g' debian/control
sed -i 's/\-4.5//g' debian/control.in

Next, edit debian/patches/series and change it from
  1 debian-changes-from-1.1.32-1.patch
  2 readd_xpm.patch
  3 function_grep.patch
  4 Bug#29669_proposed-fix.patch
  5 fix-winegcc-paths.patch
  6 Bug#28898_squashed-proposed-patches.patch
  7 Bug#28201_proposed-fix-modified.patch
to
  1 debian-changes-from-1.1.32-1.patch
  2 readd_xpm.patch
  3 function_grep.patch

And build:
time dpkg-buildpackage -uc -us

The entire build takes about 40 minutes and gives the following files:
../libwine-alsa-unstable_1.5.19-0.1_amd64.deb
../libwine-dbg-unstable_1.5.19-0.1_amd64.deb
../libwine-ldap-unstable_1.5.19-0.1_amd64.deb
../libwine-sane-unstable_1.5.19-0.1_amd64.deb
../libwine-bin-unstable_1.5.19-0.1_amd64.deb
../libwine-dev-unstable_1.5.19-0.1_amd64.deb
../libwine-openal-unstable_1.5.19-0.1_amd64.deb
../libwine-unstable_1.5.19-0.1_amd64.deb
../libwine-capi-unstable_1.5.19-0.1_amd64.deb
../libwine-gl-unstable_1.5.19-0.1_amd64.deb
../libwine-oss-unstable_1.5.19-0.1_amd64.deb
../wine-bin-unstable_1.5.19-0.1_amd64.deb
../libwine-cms-unstable_1.5.19-0.1_amd64.deb
../libwine-gphoto2-unstable_1.5.19-0.1_amd64.deb
../libwine-print-unstable_1.5.19-0.1_amd64.deb
../wine-unstable_1.5.19-0.1_amd64.deb

To install,
cd ../
sudo dpkg -i *.deb

And you're done.
To confirm what version you're using (and get a screenshot like above) do
winecfg
and click on 'about'.

Links to this post:
http://www.debian-srbija.iz.rs/p/kako-da.html

12 December 2012

290. Compiling Kernel 3.7.* on Debian (Wheezy/testing)

Update 19/12/2012
On one of my seven boxes I'm having problems with the new kernel, receiving messages such as
pci_pcm_runtime_suspend()
azx_runtime_suspend
[snd_hda_intel] returns -11
This is a known bug (https://patchwork.kernel.org/patch/1865521/), but as can be seen in that message the patch might not be included until kernel 3.8 (although one of the authors call for a backport to kernel 3.6). Again, this happened only on one out of seven computers tested so far so it might not be a universal problem. See here for how to fix it yourself: http://verahill.blogspot.com.au/2012/12/patching-kernel-371-to-fix.html

Note
 vboxdrv 4.1.18 and nvidia 304.48-1 dkms packages do not seem to play well with 3.7. This is perhaps not that surprising given that wheezy is frozen since June 2012.

* The virtualbox-dkms/vboxdrv (4.1.18-dfsg-1.1) isn't playing ball on 3.7. See e.g. https://forums.virtualbox.org/viewtopic.php?f=7&t=53031 and http://www.kubuntuforums.net/showthread.php?61234-Kernel-update-video-drivers-and-virtualbox

I solved it by going to the virtualbox website and installing their .deb package:
wget http://download.virtualbox.org/virtualbox/4.2.4/virtualbox-4.2_4.2.4-81684~Debian~wheezy_amd64.deb
sudo apt-get autoremove virtualbox virtualbox-qt virtualbox-dkms
sudo dpkg -i virtualbox-4.2_4.2.4-81684~Debian~wheezy_amd64.deb
sudo /etc/init.d/vboxdrv setup

This works absolutely fine under 3.7 and 3.7.1

* I'm also having issues with building the nvidia dkms module on this kernel. It seems to be a bug which is resolved by upgrading to a newer nvidia driver. http://www.mail-archive.com/desktop-packages@lists.launchpad.net/msg184146.html

Given that Wheezy is frozen since the end of June I suspect that we won't be seeing any fix for this. Instead I ended up installing nvidia-current (310.19) using smxi (smxi.org) and it's working fine (the alt+prtscrn screenshot bug doesn't seem to be resolved though).



Original post:
Be aware that starting with kernel 3.6 you will need to explicitly include compilation of various drivers for multimedia and webcams -- see e.g.
http://verahill.blogspot.com.au/2012/10/compiling-kernel-36-on-debian.html
http://verahill.blogspot.com.au/2012/10/leadtek-dtv-1000s-in-kernel-36-debian.html

Other than that, compiling kernel 3.7.* is pretty straightforward. The ncurses packages are needed only for 'make menuconfig'

sudo apt-get install kernel-package fakeroot build-essential ncurses-bin ncurses-dev
mkdir ~/tmp
cd ~/tmp
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.7.1.tar.bz2
tar xvf linux-3.7.1.tar.bz2
cd linux-3.7.1/
cat /boot/config-`uname -r`>.config
make oldconfig

and answer the questions (see bottom of the post for a list of new features).

If you want to specifically include a driver, then the easiest thing to do is:

make menuconfig

and navigating through (or search -- hit / ). E.g. saa7134 is found under Device drivers/Multimedia support/Media PCI adapters/Philips SAA7134 support. Don't forget to compile in remote control support as well if needed.

Continue (replace 4 with whatever is suitable for the number of cores on your system):
make-kpkg clean
time fakeroot make-kpkg -j4 --initrd --revision=3.7.1 --append-to-version=-amd64 kernel_image kernel_headers

This took 20 minutes on a four-core i5-2400..

mv ../linux*3.7*.deb .
sudo dpkg -i *.deb

Building failed completely on an AMD 8150FX 8 core system (See bottom of the post). It built fine on first try on all other systems.



Changes (if in doubt, hit enter for the default option):

* CPU/Task time and stats accounting
*
Cputime accounting
> 1. Simple tick based cputime accounting (TICK_CPU_ACCOUNTING) (NEW)
  2. Fine granularity task level IRQ time accounting (IRQ_TIME_ACCOUNTING)
choice[1-2]: 1
Consider userspace as in RCU extended quiescent state (RCU_USER_QS) [N/y/?] (NEW)
Module signature verification (MODULE_SIG) [N/y/?] (NEW)
Legacy cpb sysfs knob support for AMD CPUs (X86_ACPI_CPUFREQ_CPB) [Y/n/?] (NEW)
Packet: sockets monitoring interface (PACKET_DIAG) [N/m/y/?] (NEW)
IPv6: GRE tunnel (IPV6_GRE) [N/m/y/?] (NEW) 
IPv4 NAT (NF_NAT_IPV4) [N/m/?] (NEW)
IPv6 NAT (NF_NAT_IPV6) [N/m/?] (NEW)
OMAP OCP2SCP DRIVER (OMAP_OCP2SCP) [N/m/y/?] (NEW) 
 Maximum expected bad eraseblock count per 1024 eraseblocks (MTD_UBI_BEB_LIMIT) [20] (NEW)
UBI Fastmap (Experimental feature) (MTD_UBI_FASTMAP) [N/y/?] (NEW)
Calxeda Highbank SATA support (SATA_HIGHBANK) [N/m/?] (NEW)
Virtual eXtensible Local Area Network (VXLAN) (VXLAN) [N/m/y/?] (NEW) 
PCH PTP clock support (PCH_PTP) [N/y/?] (NEW)
Solarflare SFC9000-family PTP support (SFC_PTP) [Y/n/?] (NEW)
Drivers for Atheros AT803X PHYs (AT803X_PHY) [N/m/?] (NEW)
MAX310X support (SERIAL_MAX310X) [N/y/?] (NEW)
SCCNXP serial port support (SERIAL_SCCNXP) [N/m/y/?] (NEW)
TPM HW Random Number Generator support (HW_RANDOM_TPM) [M/n/?] (NEW)
TPM Interface Specification 1.2 Interface (I2C - Infineon) (TCG_TIS_I2C_INFINEON) [N/m/?] (NEW)
NXP SC18IS602/602B/603 I2C to SPI bridge (SPI_SC18IS602) [N/m/?] (NEW)
OMAP HDQ driver (HDQ_MASTER_OMAP) [N/m/?] (NEW)
Analog Devices ADT7410 (SENSORS_ADT7410) [N/m/?] (NEW)
Maxim MAX197 and compatibles (SENSORS_MAX197) [N/m/y/?] (NEW)
generic cpu cooling support (CPU_THERMAL) [N/y/?] (NEW)
Fairchild FAN53555 Regulator (REGULATOR_FAN53555) [N/m/?] (NEW)
Media USB Adapters (MEDIA_USB_SUPPORT) [N/y/?] (NEW) 
STK1160 USB video capture support (VIDEO_STK1160) [N/m/?] (NEW)
STK1160 AC97 codec support (VIDEO_STK1160_AC97) [N/y/?] (NEW)   
Enable debug for the B2C2 FlexCop drivers (DVB_B2C2_FLEXCOP_USB_DEBUG) [N/y/?] (NEW)
Media PCI Adapters (MEDIA_PCI_SUPPORT) [N/y/?] (NEW)
Enable debug for the B2C2 FlexCop drivers (DVB_B2C2_FLEXCOP_PCI_DEBUG) [N/y/?] (NEW)
Media test drivers (V4L_TEST_DRIVERS) [N/y] (NEW)
ISA and parallel port devices (MEDIA_PARPORT_SUPPORT) [N/y/?] (NEW)
Autoselect tuners and i2c modules to build (MEDIA_SUBDRV_AUTOSELECT) [Y/n/?] (NEW)
Maximum debug level (NOUVEAU_DEBUG) [5] (NEW)
Default debug level (NOUVEAU_DEBUG_DEFAULT) [3] (NEW)
Backlight Driver for LM3630 (BACKLIGHT_LM3630) [N/m/?] (NEW)
Backlight Driver for LM3639 (BACKLIGHT_LM3639) [N/m/?] (NEW)
Sony PS3 BD Remote Control (HID_PS3REMOTE) [N/m/?] (NEW)
HID Sensors framework support (HID_SENSOR_HUB) [N/m/?] (NEW)
ZTE USB serial driver (USB_SERIAL_ZTE) [N/m/?] (NEW)
Functions for loading firmware on EZUSB chips (USB_EZUSB_FX2) [M/y/?] (NEW)
LED support for LM3642 Chip (LEDS_LM3642) [N/m/?] (NEW)
LED support for LM355x Chips, LM3554 and LM3556 (LEDS_LM355x) [N/m/?] (NEW)
LED CPU Trigger (LEDS_TRIGGER_CPU) [N/y/?] (NEW)
Dallas DS2404 (RTC_DRV_DS2404) [N/m/y/?] (NEW)
Silicom devices (NET_VENDOR_SILICOM) [Y/n/?] (NEW)
Silicom BypassCTL library support (SBYPASS) [N/m/?] (NEW)
Silicom BypassCTL net support (BPCTL) [N/m/?] (NEW)
Cambridge Electronic Design 1401 USB support (CED1401) [N/m/?] (NEW)
Digi Realport driver (DGRP) [N/m/y/?] (NEW) *
STE-Modem remoteproc support (STE_MODEM_RPROC) [N/m/y/?] (NEW)
SMB2 network file system support (EXPERIMENTAL) (CIFS_SMB2) [N/y/?] (NEW)
Red-Black tree test (RBTREE_TEST) [N/m/?] (NEW)
Interval tree test (INTERVAL_TREE_TEST) [N/m/?] (NEW)
CAST5 (CAST-128) cipher algorithm (x86_64/AVX) (CRYPTO_CAST5_AVX_X86_64) [N/m/y/?] (NEW)
CAST6 (CAST-256) cipher algorithm (x86_64/AVX) (CRYPTO_CAST6_AVX_X86_64) [N/m/y/?] (NEW)
Asymmetric (public-key cryptographic) key type (ASYMMETRIC_KEY_TYPE) [N/m/y/?] (NEW)
Asymmetric public-key crypto algorithm subtype (ASYMMETRIC_PUBLIC_KEY_SUBTYPE) [N/m/?] (NEW)
RSA public-key algorithm (PUBLIC_KEY_ALGO_RSA) [N/m/?] (NEW)
X.509 certificate parser (X509_CERTIFICATE_PARSER) [N/m/?] (NEW)


AMD FX 8150
My AMD FX8150 is causing no end of problems when it comes to compiling the kernel e.g.

In file included from include/linux/dynamic_debug.h:100:0,
                 from include/linux/kernel.h:14,
                 from include/linux/sched.h:15,
                 from include/linux/blkdev.h:4,
                 from drivers/scsi/lpfc/lpfc_sli.c:22:
include/linux/string.h:23:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See  /usr/share/doc/gcc-4.7/README.Bugs for instructions.
  CC [M]  drivers/scsi/lpfc/lpfc_ct.o
[..]
  LD [M]  drivers/scsi/osd/osd.o
  CC [M]  drivers/scsi/mpt2sas/mpt2sas_ctl.o
The bug is not reproducible, so it is likely a hardware or OS problem.
make[4]: *** [drivers/scsi/lpfc/lpfc_sli.o] Error 1
make[3]: *** [drivers/scsi/lpfc] Error 2
make[3]: *** Waiting for unfinished jobs....

29 November 2012

287. Compiling Wine 1.5.5 from source using the carbon-dev deb patches

UPDATE 16 May 2013: See here for Wine 1.5.30: http://verahill.blogspot.com.au/2013/05/416-wine-1530-in-chroot.html

UPDATE (10th Jan 2013): See here for Wine 1.5.21 using the multiarch approach: http://verahill.blogspot.com.au/2013/01/308-compiling-wine-1521-on-debian.html
. Use the updated build instead of what follows below.


Here's how to build the wine 1.5.5 packages without any errors.

I'm cheating and using the debian rules from dev.carbon-project.org.-- it's a small file and is a better solution than downloading the deb files from there.

Note that you will probably need more packages than the ones listed here.

1. Download the source and debian build patches

sudo apt-get install bzip2
cd ~/tmp
mkdir wine-1.5.5_carbon/
cd wine-1.5.5_carbon/
wget http://sourceforge.net/projects/wine/files/Source/wine-1.5.5.tar.bz2
mv wine-1.5.5.tar.bz2 wine-unstable_1.5.5.orig.tar.bz2
tar xvf wine-unstable_1.5.5.orig.tar.bz2
cd wine-1.5.5/
wget http://dev.carbon-project.org/debian/wine-unstable/wine-unstable_1.5.5-0.1.debian.tar.bz2
tar xvf wine-unstable_1.5.5-0.1.debian.tar.bz2
rm wine-unstable_1.5.5-0.1.debian.tar.bz2 

2.  Edit control, control.in and rules
Allow any version of gcc (this may obviously backfire if your version is no good)
Edit debian/control and control.in

 27  gcc-4.5-multilib [amd64 kfreebsd-amd64], gcc-4.5 [amd64 kfreebsd-amd64]
 28  g++-4.5 [amd64 kfreebsd-amd64],

so that is says
 27  gcc-multilib [amd64 kfreebsd-amd64], gcc [amd64 kfreebsd-amd64],
 28  g++ [amd64 kfreebsd-amd64],

Edit debian/rules
 53 ifeq ($(DEB_HOST_GNU_CPU),x86_64)
 54 CC=gcc-4.5
 55 CXX=g++-4.5
 56 else
 57 CC=gcc
 58 CXX=g++

to say
 53 ifeq ($(DEB_HOST_GNU_CPU),x86_64)
 54 CC=gcc
 55 CXX=g++
 56 else
 57 CC=gcc
 58 CXX=g++

2. Get dependencies
Note that this list is based on a very old post -- some packages may not be needed.


sudo apt-get install ia32-libs ia32-libs-dev bison flex gcc libc6-dev libfontconfig-dev libfreetype6-dev libglu-dev libgsm1-dev libice-dev libjpeg-dev libldap-dev libmpg123-dev libncurses5-dev libopenal-dev libpng-dev libsm-dev libssl-dev libusb-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libxrender-dev libxslt-dev libxt-dev libxxf86vm-dev make libcapi20-dev liblcms-dev libsane-dev libhal-dev libdbus-1-dev valgrind prelink libcups2-dev opencl-dev lib32opencl1 oss4-dev gettext lib32v4l-dev lib32ncurses5-dev lib32asound2-dev libtiff4-dev libgphoto2-2-dev
sudo apt-get install libxkbfile-dev libxxf86dga-dev freeglut3-dev unixodbc-dev gcc-multilib dpkg-dev

Note: I used the following list on debian stable/squeeze.
sudo apt-get install ia32-libs ia32-libs-dev bison flex gcc libc6-dev libfontconfig-dev libfreetype6-dev libglu-dev libgsm1-dev libice-dev libjpeg-dev libldap-dev libmpg123-dev libncurses5-dev libopenal-dev libpng-dev libsm-dev libssl-dev libusb-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libxrender-dev libxslt-dev libxt-dev libxxf86vm-dev make libcapi20-dev liblcms-dev libsane-dev libhal-dev libdbus-1-dev valgrind prelink libcups2-dev oss4-dev gettext lib32v4l-dev lib32ncurses5-dev lib32asound2-dev libtiff4-dev libgphoto2-2-dev libxkbfile-dev libxxf86dga-dev freeglut3-dev unixodbc-dev gcc-multilib dpkg-dev debhelper libxmu-dev dctrl-tools lzma sharutils lib32z1-dev libgstreamer-plugins-base0.10-dev
sudo apt-get install lib32opencl1


Then continue as normal.

If you're on Wheezy/Testing you should be following this post instead anyway.

3. Compile
in wine-1.5.5/:
dpkg-buildpackage -us -uc
If all went well you saw:
dpkg-deb: building package `wine-unstable' in `../wine-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `wine-bin-unstable' in `../wine-bin-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-dbg-unstable' in `../libwine-dbg-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-dev-unstable' in `../libwine-dev-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-unstable' in `../libwine-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-alsa-unstable' in `../libwine-alsa-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-bin-unstable' in `../libwine-bin-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-capi-unstable' in `../libwine-capi-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-cms-unstable' in `../libwine-cms-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-gl-unstable' in `../libwine-gl-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-gphoto2-unstable' in `../libwine-gphoto2-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-ldap-unstable' in `../libwine-ldap-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-openal-unstable' in `../libwine-openal-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-oss-unstable' in `../libwine-oss-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-print-unstable' in `../libwine-print-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-sane-unstable' in `../libwine-sane-unstable_1.5.5-0.1_amd64.deb'.
[..]
dpkg-source: info: using options from wine-1.5.5/debian/source/options: --compression=bzip2 --compression-level=9
dpkg-source: info: unapplying Bug#28201_proposed-fix-modified.patch
dpkg-source: info: unapplying Bug#28898_squashed-proposed-patches.patch
dpkg-source: info: unapplying fix-winegcc-paths.patch
dpkg-source: info: unapplying Bug#29669_proposed-fix.patch
dpkg-source: info: unapplying function_grep.patch
dpkg-source: info: unapplying readd_xpm.patch
dpkg-source: info: unapplying debian-changes-from-1.1.32-1.patch
dpkg-buildpackage: full upload (original source is included)

Your packages will be found in the wine-1.5.5_carbon/ directory.
../libwine-alsa-unstable_1.5.5-0.1_amd64.deb
../libwine-bin-unstable_1.5.5-0.1_amd64.deb
../libwine-capi-unstable_1.5.5-0.1_amd64.deb
../libwine-cms-unstable_1.5.5-0.1_amd64.deb
../libwine-dbg-unstable_1.5.5-0.1_amd64.deb
../libwine-dev-unstable_1.5.5-0.1_amd64.deb
../libwine-gl-unstable_1.5.5-0.1_amd64.deb
../libwine-gphoto2-unstable_1.5.5-0.1_amd64.deb
../libwine-ldap-unstable_1.5.5-0.1_amd64.deb
../libwine-openal-unstable_1.5.5-0.1_amd64.deb
../libwine-oss-unstable_1.5.5-0.1_amd64.deb
../libwine-print-unstable_1.5.5-0.1_amd64.deb
../libwine-sane-unstable_1.5.5-0.1_amd64.deb
../libwine-unstable_1.5.5-0.1_amd64.deb
../wine-bin-unstable_1.5.5-0.1_amd64.deb
../wine-unstable_1.5.5-0.1_amd64.deb

If something went wrong, it's probably because of a missing dependency.

To install just run
sudo dpkg -i *.deb in the wine-1.5.5_carbon/ directory.

07 November 2012

277. Compiling LSDALTON on debian testing/wheezy

I'm writing this as a separate post even though it's really an integral part of the compilation of Dalton 2011 which I described here: http://verahill.blogspot.com.au/2012/11/compiling-dalton-2011-on-debian.html

LSDALTON supports Open MP which is neat -- it means you can't run across nodes, but it'll automatically take advantage of the resources on the node it's run on.

Anyway.

Assuming you've followed that post, you're now ready to compile LSDALTON.

cd ~/tmp/Dalton2011_release/LSDALTON/
./configure

There are fewer questions this time so I won't list them -- basically, use gfortran and gcc, and compile with OpenMP support.

This gives you a Makefile.config -- edit it as shown. Note that I have the debian libblas3 and libgomp1 packages installed.

ARCH        = linux
FMMDIR      = mm
#
#
CPPFLAGS      = -DSYS_LINUX -D_FILE_OFFSET_BITS=64 -D'INSTALL_BASDIR="/opt/dalton/basis"' -DGFORTRAN=471 -DVAR_LINSCA -DIMPLICIT_NONE
F77            = gfortran
F90            = gfortran
FLNK           = gfortran
CC             = gcc
RM             = rm -f
FFLAGS         = -march=native -O1 -ffast-math -funroll-loops -ftree-vectorize -ffloat-store -fno-whole-file
F90OPTFLAGS    = -march=native -O1 -ffast-math -funroll-loops -ftree-vectorize -ffloat-store -I. -x f95-cpp-input -ffloat-store -fopenmp -fno-whole-file
SAFEFFLAGS     = -march=native -O1 -ffast-math -funroll-loops -ftree-vectorize -ffloat-store -fno-whole-file
CFLAGS         = -march=native -O1 -ffast-math -funroll-loops -ftree-vectorize -std=c99 -DRESTRICT=restrict -DFUNDERSCORE=1 -ffloat-store -DUSE_UNDERSCORES
INCLUDES       =  
LIBS           = -lblas -lgomp 
INSTALLDIR     = /opt/dalton/bin
PDPACK_EXTRAS  = linpack.o eispack.o gp_dlapack.o gp_zlapack.o
AR             = ar
ARFLAGS        =  rvs
#
default : linux.x
#
# Suffix rules C
#
.SUFFIXES : .F90 .f90 .F .o .c

.F90.o:
        $(F90) $(INCLUDES) $(CPPFLAGS) $(F90OPTFLAGS) -c $*.F90

.f90.o:
        $(F90) $(INCLUDES) $(CPPFLAGS) $(F90OPTFLAGS) -c $*.f90

.F.o:
        $(F77) $(INCLUDES) $(CPPFLAGS) $(FFLAGS) -c $*.F

.c.o:
        $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $*.c

Now compile!
make

Test your installation:
cd test/
 ./TEST all
[..]
-----------------------------------------------------------
TEST ENDED PROPERLY

#####################################################################
                              Summary
#####################################################################

ALL TESTS ENDED PROPERLY!
date and time         : Wed Nov  7 14:57:29 EST 2012

06 November 2012

276. Compiling Dalton 2011 on Debian Testing/Wheezy

UPDATE: To deal with basis sets and 'GPOPEN' errors, see bottom of this post
UPDATE2: Because of the basis set issue the code doesn't run in parallel!
UPDATE 3: All issues are solved by -O0 or -O1. The code now works in parallel and you can define basis sets the usual way. Performance-wise? No idea. So you can compile with -O3 or -O2 but the code doesn't read basis sets the intended way, or you use -O1 or -O0 and it works.

THIS WORKS NOW  :)

Original post:
I've been wanting to use dalton for a long time, but it's been difficult to compile dalton 2.0, and I didn't realise until a few days ago that there's a newer version.
See here for a description of how to compile on ROCKS 5.4.3 (i.e. Centos 5.6) which uses gfortran v 4.1. The main difference between compiling on CentOS 5.6 and Debian Wheezy is in how you edit the Makefile.config. More specifically, compile works a whole lot better with -fno-whole-file and -march=native..

Other than that the steps are the same.

In terms of running, there's an issue with the discoverability of the basis sets which I don't really understand. There's a solution to that at the end of the file.

Before you get started you may want to compile ATLAS as shown here: http://verahill.blogspot.com.au/2012/05/compile-atlas-blas-on-debian-testing.html

Alternatively, you should get the ACML libraries.

NOTE: The compile went without a hitch on my AMD II X3, AMD Phenom II X6 and Intel i5-2400.
My AMF FX 8150 is a trickier story though: it failed to compile with acml libs (gfortran64_fma4_int64) for -O3 and -O2, but compiled with -O1 and -O0. The -O1 binary segfaults though. Never tried the -O0 binary.

WARNING: If you run dalton in parallel it will -- for some reason -- delete your scratch folder when the run is over. The scratch directory is defined in the  /opt/dalton/bin/dalton script (TMPDIR)

License:
First go to http://daltonprogram.org/licence/ and fill out the license agreement. Once that's done you'll get an automated email with a license form, which you should print, sign, scan and email to the email address you're given. Once your form has been processed you'll be sent another email with a user name and password. I received my user name and password the next business day.

Go online and download the source file, Dalton2011_release_v0.tgz, and put it in ~/tmp. Sort out where you want your program to end up
sudo mkdir /share/apps/dalton
sudo chown $USER /share/apps/dalton
mkdir /share/apps/dalton/bin /share/apps/dalton/basis /share/apps/dalton/lsdalton

Next,
cd ~/tmp
tar xvf Dalton2011_release_v0.tgz
cd Dalton2011_release/DALTON
./configure 

and answer all the questions:
./configure

------------------------------------------------------------------
   Configuring the DALTON Makefile.config and "dalton" run script
------------------------------------------------------------------

INFO: Operating system from 'uname -s' : Linux
INFO: Processor type   from 'uname -m' : x86_64
No architecture specified, attempting auto-configuration:
This appears to be a -linux architecture. Is this correct? [Y/n] 
--> Installing DALTON on a -linux computer


Note that 64-bit integers are desirable for Cholesky and very large
scale CI, otherwise the most important effect is that some files will be bigger.

If you choose 64-bit integers, be careful that any system library
routines (incl. MPI) also use 64-bit integers!

Do you want 64-bit integers? [y/N] Do you want to install the program in a parallel MPI version? [Y/n] 
-->WARNING: Makefiles for MPI architecture are difficult to guess
   Please compare the generated Makefile.config with local documentation.

   Checking for Fortran compiler ...
   from this list: mpif90 mpiifort ifort pgf95 pgf90 gfortran g95 

Compiler /usr/bin/mpif90 found, use this compiler? [Y/n] 
-->Compiler mpif90 found and accepted.
Is backend compiler gfortran ? [Y/n] 
   Checking for C compiler ...
   from this list: mpicc  mpiicc   icc ecc pgcc gcc 

Compiler /usr/bin/mpicc found, use this compiler? [Y/n] 
-->Compiler mpicc found and accepted.

Testing existence of libraries in this order:
 libacml.a libmkl.so libmkl_p3.a libatlas.a libblas.a
Directory search list for libraries:
  /opt/ATLAS/lib /home/me/tmp/ATLAS/build/lib /lib /usr/local/lib /usr/lib /usr/local/lib/ATLAS /lib64 /usr/lib64 /usr/local/lib64 

Do you want to replace this with your own directory search list? [y/N] Found /opt/ATLAS/lib/libatlas.a, use it? [Y/n] 
-->The following mathematical library(ies) will be used:
   -L/opt/ATLAS/lib -llapack -llapack -lf77blas -latlas


DALTON uses almost 100 Megabytes of static
allocations, in addition to the dynamic allocation.

DALTON has the possibility to reserve an amount of static memory
for storing two-electron integrals in direct and parallel calculations
Storing some or all of the 2-el. integrals in memory will speed up
direct and parallel calculations (and in particular the latter).
NOTE: This will increase the static memory allocation used by DALTON

Would you like to activate the possibility of storing 2-el.int. in memory? [y/N] How many MB to use for storing 2-el. integrals? 
-->Program will be installed with 300 MB (39000000 words) used for storing 2-el. integrals

Maximum amount of work memory for dynamic allocations can be changed
at run time with the environment variable WRKMEM (in REAL*8 words = megabytes/8)
or by using the -M option to the run script: "dalton -M mb ..." (in megabytes).
We recommend at least 200 MB work memory,
larger for correlated calculations, but it should for maximum
efficiency NOT exceed available physical memory per CPU in parallel calculations.

How many MB to use as default for work memory (hit return for default of 1000 MB)? 
-->Program will be installed with a default work memory of 3900 MB (511000000 words)

-->Current directory is /home/me/tmp/Dalton2011_release/DALTON

Use default ../bin as installation directory for DALTON binaries and scripts? [Y/n] Please enter another installation directory: 
-->DALTON executable and script will be placed in /opt/dalton/bin directory


-->Default basis set directory will be /home/me/tmp/Dalton2011_release/DALTON/../basis/

Use this directory as default basis set directory? [Y/n] 
Please choose another default basis set directory (must end with /) 
-->Default basis set directory will be /opt/dalton/basis/


-->Job specific directories under $SCRATCH/$USER
-->will be used for temporary files when running DALTON

Use SCRATCH=/work as default root scratch space in "dalton" run script? [Y/n] Please enter default root scratch directory: 
-->Creating Makefile.config ...
gfortran version 471 prc=x86_64
INFO: Compiling with 32-bit integers.
INFO: Make sure pre-compiled BLAS, MPI etc. libraries are also with 32-bit integers!!!

Proper 64-bit file access detected.

-->Creating the DALTON run-script in /opt/dalton/bin

   The configuration of DALTON has finished succesfully.
   Check compiler flags etc. in Makefile.config and run "make" to get executable.

which generates Makefile.config. Edit it and

  • change the -march to native. 
  • add -fno-whole-file to avoid internal compiler errors
  • change optimisation level to -O1 (O0 is ok, O2 and O3 give GPOPEN problems)

Like this:

ARCH        = linux
#
#
CPPFLAGS      = -DVAR_GFORTRAN -DSYS_LINUX -DVAR_MFDS -D'INSTALL_WRKMEM=131000000' -D'INSTALL_MMWORK=65000000' -D_FILE_OFFSET_BITS=64 -DVAR_MPI -DGFORTRAN=471 -DIMPLICIT_NONE
F90           = mpif90
CC            = mpicc
LOADER        = mpif90
RM            = rm -f
FFLAGS        = -march=native -O1 -ffast-math -funroll-loops -ftree-vectorize -fbacktrace -fno-whole-file
SAFEFFLAGS    = -march=native -O1 -ffast-math -funroll-loops -ftree-vectorize -fbacktrace -fno-whole-file
CFLAGS        = -march=native -O1 -ffast-math -funroll-loops -ftree-vectorize -std=c99 -DRESTRICT=restrict -DFUNDERSCORE=1
INCLUDES      = -I../include 
MODULES       = -J../modules
LIBS          = -L/opt/ATLAS/lib -llapack -llapack -lf77blas -latlas 
INSTALLDIR    = /opt/dalton/bin
PDPACK_EXTRAS = linpack.o eispack.o gp_zlapack.o gp_dlapack.o
GP_EXTRAS     = 
AR            = ar
ARFLAGS       = rvs
# flags for ftnchek on Dalton /hjaaj
CHEKFLAGS  = -nopure -nopretty -nocommon -nousage -noarray -notruncation -quiet  -noargumants -arguments=number  -usage=var-unitialized
# -usage=var-unitialized:arg-const-modified:arg-alias
# -usage=var-unitialized:var-set-unused:arg-unused:arg-const-modified:arg-alias
#
default : dalton linuxparallel.x
SAFE_FFLAGS_for_ifort = $(FFLAGS)
#
# Parallel initialization
#
MPI_INCLUDE_DIR = 
MPI_LIB_PATH    = -L/usr/lib
MPI_LIB         = -lmpi
#
#
# Suffix rules
# hjaaj Oct 04: .g is a "cheat" suffix, for debugging.
#               'make x.g' will create x.o from x.F or x.c with -g debug flag set.
#
.SUFFIXES : .F .F90 .c .o .i .g .s

.F.o:
        $(F90) $(INCLUDES) $(MODULES) $(CPPFLAGS) $(FFLAGS) -c $*.F 

.F.i:
        $(F90) $(INCLUDES) $(MODULES) $(CPPFLAGS) -E $*.F > $*.i

.F.g:
        $(F90) $(INCLUDES) $(MODULES) $(CPPFLAGS) $(SAFEFFLAGS) -g -c $*.F 

.F.s:
        $(F90) $(INCLUDES) $(MODULES) $(CPPFLAGS) $(FFLAGS) -S -g -c $*.F 

.F90.o:
        $(F90) $(INCLUDES) $(MODULES) $(CPPFLAGS) $(FFLAGS) -c $*.F90 

.F90.i:
        $(F90) $(INCLUDES) $(MODULES) $(CPPFLAGS) -E $*.F90 > $*.i




make
make install

Now just copy the basis sets and ecp data to the proper location:
cd ../
cp basis/* -R /opt/dalton/basis

and edit your ~/.bashrc;
export PATH=$PATH:/opt/dalton/bin

And you should be good to go.


So far I haven't run all the tests, but
./TEST -dalton /opt/dalton/bin/dalton short

gave
#####################################################################
                              Summary
#####################################################################

ALL TESTS ENDED PROPERLY!

date and time         : Wed Nov  7 11:57:02 EST 2012



GPOPEN errors and how to get around them.

To make the story short: if you use -O3 or -O2 for some reason Dalton can't find the basis sets if you declare them the normal way (-O0 and -O1 take care of the problem). However, using ATOMBASIS it works.

Here's an example. Typically you'd specify the basis set for a whole molecule in your .mol file:

BASIS
STO-3G
DFT PROPERTIES TEST 
This doesn't work with O3
AtomTypes=2 Angstrom
        8.    1     
O -0.141254 0.0998816 0.00000
        1.    2     
H 0.589315 0.718039 0.00000
H -0.922641 0.652406 0.00000

but that leads to errors on the debian (but not centos) builds:
   0: Directories for basis set searches:
     /jobs/dalton:/opt/dalton/basis

 MPI node no.:     0
 Reason: ERROR (GPOPEN) UPON OPENING A FILE


 Node      0:  --- SEVERE ERROR, PROGRAM WILL BE ABORTED ---
 ERROR (GPOPEN) UPON OPENING A FILE

and
  Atomic type no.    1
  --------------------
  Nuclear charge:   8.00000
  Number of symmetry independent centers:    1
  Number of basis sets to read;    2
  Basis set file used for this atomic type with Z =   8 :
     "/opt/dalton/basis/                                                                                "


--> ERROR (GPOPEN) UPON TRYING TO OPEN FILE ON UNIT 11
--> with filename /opt/dalton/basis/
--> IOSTAT ERROR CODE RETURNED      21


 QTRACE dump of internal trace stack

 ========================
      level    module
 ========================
          7    GPOPEN      
          6    BASLIB      
          5    READ_MOL    
          4    READIN      
          3    HERMIT      
          2    DALTON      
          1    DALTON main 

whereas

ATOMBASIS
DFT PROPERTIES TEST 
This works with O3
AtomTypes=2 Angstrom
        8.    1    basis=STO-3G 
O -0.141254 0.0998816 0.00000
        1.    2     basis=STO-3G
H 0.589315 0.718039 0.00000
H -0.922641 0.652406 0.00000

works and gives
   0: Directories for basis set searches:
     /opt/dalton/basis:/opt/dalton/basis

 NOTE:    1 informational messages have been issued.
 Check output, result, and error files for "INFO".

and a normal exit:
 CPU time statistics for ABACUS
 ------------------------------

 LINRES     00:00:02      77 %

 TOTAL      00:00:03     100 %


 >>>> Total CPU  time used in ABACUS:   3.21 seconds
 >>>> Total wall time used in ABACUS:   3.22 seconds


                   .-------------------------------------------.
                   | End of Static Property Section (ABACUS) - |
                   `-------------------------------------------'

 >>>> Total CPU  time used in DALTON:   6.04 seconds
 >>>> Total wall time used in DALTON:   6.06 seconds

 
     Date and time (Linux)  : Tue Nov  6 14:54:24 2012
     Host name              : beryllium   

02 November 2012

274. Kernel 3.7-rc3

There's a specific driver (Silicom devices) included in the new kernel (3.7) that interests a friend. I do not suggest people in general run an -rc kernel, so I'm not going to put any effort into making this post user-friendly.

Having said that, in general you should be fine. In general.

sudo apt-get install kernel-package fakeroot build-essential
mkdir ~/tmp
cd ~/tmp
wget http://www.kernel.org/pub/linux/kernel/v3.0/testing/linux-3.7-rc3.tar.bz2
tar xvf linux-3.7-rc3.tar.bz2 
cd linux-3.7-rc3/
cat /boot/config-`uname -r`>.config
make oldconfig

At this stage you'll be asked questions about all the shiny new things that are found in the kernel. See bottom of the post for a list of the questions.

If you regret the answer to a question you can change your mind later by doing
make menuconfig

Once you're done answering questions, compile!
make-kpkg clean
time fakeroot make-kpkg -j3 --initrd --revision=3.7.0 --append-to-version=-rc3 kernel_image kernel_headers

It takes 43 minutes on my old AMD X3.



To install the kernel:
mv ../linux-*-3.7.0-rc3*.deb .
sudo dpkg -i *.deb

And you're done!

New stuff (compared to kernel 3.6.3):

* CPU/Task time and stats accounting
*
Cputime accounting
> 1. Simple tick based cputime accounting (TICK_CPU_ACCOUNTING) (NEW)
  2. Fine granularity task level IRQ time accounting (IRQ_TIME_ACCOUNTING)
choice[1-2]: 1

Consider userspace as in RCU extended quiescent state (RCU_USER_QS) [N/y/?] (NEW) 
Module signature verification (MODULE_SIG) [N/y/?] (NEW)  
Legacy cpb sysfs knob support for AMD CPUs (X86_ACPI_CPUFREQ_CPB) [Y/n/?] (NEW) 
Packet: sockets monitoring interface (PACKET_DIAG) [N/m/y/?] (NEW)
IPv6: GRE tunnel (IPV6_GRE) [N/m/y/?] (NEW) 
IPv4 NAT (NF_NAT_IPV4) [N/m/?] (NEW) 
IPv6 NAT (NF_NAT_IPV6) [N/m/?] (NEW) 
OMAP OCP2SCP DRIVER (OMAP_OCP2SCP) [N/m/y/?] (NEW) 
Maximum expected bad eraseblock count per 1024 eraseblocks (MTD_UBI_BEB_LIMIT) [20] (NEW)
UBI Fastmap (Experimental feature) (MTD_UBI_FASTMAP) [N/y/?] (NEW)
Calxeda Highbank SATA support (SATA_HIGHBANK) [N/m/?] (NEW) 
Virtual eXtensible Local Area Network (VXLAN) (VXLAN) [N/m/y/?] (NEW) Y
PCH PTP clock support (PCH_PTP) [N/y/?] (NEW)
Solarflare SFC9000-family PTP support (SFC_PTP) [Y/n/?] (NEW)
Drivers for Atheros AT803X PHYs (AT803X_PHY) [N/m/?] (NEW)
MAX310X support (SERIAL_MAX310X) [N/y/?] (NEW)
SCCNXP serial port support (SERIAL_SCCNXP) [N/m/y/?] (NEW)
TPM HW Random Number Generator support (HW_RANDOM_TPM) [M/n/?] (NEW) 
TPM Interface Specification 1.2 Interface (I2C - Infineon) (TCG_TIS_I2C_INFINEON) [N/m/?] (NEW) 
NXP SC18IS602/602B/603 I2C to SPI bridge (SPI_SC18IS602) [N/m/?] (NEW)
OMAP HDQ driver (HDQ_MASTER_OMAP) [N/m/?] (NEW)
Analog Devices ADT7410 (SENSORS_ADT7410) [N/m/?] (NEW)
Maxim MAX197 and compatibles (SENSORS_MAX197) [N/m/y/?] (NEW)
generic cpu cooling support (CPU_THERMAL) [N/y/?] (NEW) Y
Fairchild FAN53555 Regulator (REGULATOR_FAN53555) [N/m/?] (NEW)
Media USB Adapters (MEDIA_USB_SUPPORT) [N/y/?] (NEW)
Media PCI Adapters (MEDIA_PCI_SUPPORT) [N/y/?] (NEW) 
Media test drivers (V4L_TEST_DRIVERS) [N/y] (NEW) 
ISA and parallel port devices (MEDIA_PARPORT_SUPPORT) [N/y/?] (NEW) 
Autoselect tuners and i2c modules to build (MEDIA_SUBDRV_AUTOSELECT) [Y/n/?] (NEW) 
Maximum debug level (NOUVEAU_DEBUG) [5] (NEW)
Default debug level (NOUVEAU_DEBUG_DEFAULT) [3] (NEW)
Backlight Driver for LM3630 (BACKLIGHT_LM3630) [N/m/?] (NEW)
Backlight Driver for LM3639 (BACKLIGHT_LM3639) [N/m/?] (NEW)
Sony PS3 BD Remote Control (HID_PS3REMOTE) [N/m/?] (NEW)
HID Sensors framework support (HID_SENSOR_HUB) [N/m/?] (NEW)
ZTE USB serial driver (USB_SERIAL_ZTE) [N/m/?] (NEW)
Functions for loading firmware on EZUSB chips (USB_EZUSB_FX2) [M/y/?] (NEW) 
OMAP USB2 PHY Driver (OMAP_USB2) [N/m/y/?] (NEW)
LED support for LM3642 Chip (LEDS_LM3642) [N/m/?] (NEW)
LED support for LM355x Chips, LM3554 and LM3556 (LEDS_LM355x) [N/m/?] (NEW)
LED CPU Trigger (LEDS_TRIGGER_CPU) [N/y/?] (NEW)
Dallas DS2404 (RTC_DRV_DS2404) [N/m/y/?] (NEW) 
Silicom devices (NET_VENDOR_SILICOM) [Y/n/?] (NEW) Y
Silicom BypassCTL library support (SBYPASS) [N/m/?] (NEW)m
Silicom BypassCTL net support (BPCTL) [N/m/?] (NEW) m
Cambridge Electronic Design 1401 USB support (CED1401) [N/m/?] (NEW)
Digi Realport driver (DGRP) [N/m/y/?] (NEW)
STE-Modem remoteproc support (STE_MODEM_RPROC) [N/m/y/?] (NEW)
SMB2 network file system support (EXPERIMENTAL) (CIFS_SMB2) [N/y/?] (NEW)
Red-Black tree test (RBTREE_TEST) [N/m/?] (NEW)
Interval tree test (INTERVAL_TREE_TEST) [N/m/?] (NEW)
CAST5 (CAST-128) cipher algorithm (x86_64/AVX) (CRYPTO_CAST5_AVX_X86_64) [N/m/y/?] (NEW)
CAST6 (CAST-256) cipher algorithm (x86_64/AVX) (CRYPTO_CAST6_AVX_X86_64) [N/m/y/?] (NEW)
Asymmetric (public-key cryptographic) key type (ASYMMETRIC_KEY_TYPE) [N/m/y/?] (NEW)

As for Intel devices the pre-existing settings were:

Intel devices (NET_VENDOR_INTEL) [Y/n/?] y
      Intel(R) PRO/100+ support (E100) [M/n/y/?] m
      Intel(R) PRO/1000 Gigabit Ethernet support (E1000) [M/n/y/?] m
      Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support (E1000E) [M/n/y/?] m
      Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support (IGB) [M/n/y/?] m
        Direct Cache Access (DCA) Support (IGB_DCA) [Y/n/?] y
        PTP Hardware Clock (PHC) (IGB_PTP) [N/y/?] n
      Intel(R) 82576 Virtual Function Ethernet support (IGBVF) [M/n/y/?] m
      Intel(R) PRO/10GbE support (IXGB) [M/n/y/?] m
      Intel(R) 10GbE PCI Express adapters support (IXGBE) [M/n/y/?] m
        Intel(R) 10GbE PCI Express adapters HWMON support (IXGBE_HWMON) [Y/n/?] y
        Direct Cache Access (DCA) Support (IXGBE_DCA) [Y/n/?] y
        Data Center Bridging (DCB) Support (IXGBE_DCB) [Y/n/?] y
        PTP Clock Support (IXGBE_PTP) [N/y/?] n
      Intel(R) 82599 Virtual Function Ethernet support (IXGBEVF) [M/n/y/?] m
      Intel (82586/82593/82596) devices (NET_VENDOR_I825XX) [Y/n/?] y
        Zenith Z-Note support (EXPERIMENTAL) (ZNET) [N/m/y/?] n

18 October 2012

259. Compiling firefox 16.0.1 in debian testing/wheezy

I actually mainly use chromium/chrome for my normal browsing needs, and have set up an ssh tunnel with an American university for iceweasel so I can access sites that filter on IP.

There's nothing particularly wrong with iceweasel, but it's nice to check out the latest and shiniest versions of different projects every now and again, so here's how to compile the latest firefox:

The source is just a hair under 90 Mb and the build takes around 40 minutes on a three-core AMD.

I've got so many -dev packages installed on my system that I don't really know what the dependencies are anymore, but here's a guess:
sudo apt-get install build-essential gfortran gawk libpango1.0-dev libgconf2-dev libgnomevfs2-dev libcogl-pango-dev libpangomm-1.4-dev libgconfmm-2.6-dev libnotify-dev libgnomeui-dev libdbus-1-dev libdbus-glib-1-dev 

Anyway:
cd ~/tmp
wget ftp://ftp.mozilla.org/pub/firefox/releases/16.0.1/source/firefox-16.0.1.source.tar.bz2
tar xvf firefox-16.0.1.source.tar.bz2
mkdir firefox_build
cd firefox_build/
../mozilla-release/./configure --prefix=$HOME/.firefox --disable-necko-wifi
make
make install

I'm getting tired of the clutter in my PATH, so
echo "alias firefox16='$HOME/.firefox/bin/firefox'" >> ~/.bashrc



Note that iceweasel puts a firefox in/usr/bin/, hence the use of firefox16

01 October 2012

250. Compiling Kernel 3.6 on Debian Testing/Wheezy

IMPORTANT: a lot of drivers need to be explicitly enabled now, in particular those related to video devices (e.g. saa*, uvcvideo)

Nothing difficult or weird about compiling your own kernel, and 3.6 is no exception. This post is pretty much identical to my previous kernel compile posts, but with 3.6 replacing 3.x.
I've successfully compiled 3.6.0, 3.6.2, 3.6.3 and 3.6.6 this way.

If you're wondering whether it's worth it, you can have a look here:
 http://www.h-online.com/open/features/What-s-new-in-Linux-3-6-1714690.html

If you've never compiled a kernel before you might need to:
sudo apt-get install kernel-package fakeroot build-essential

Then get on with it:

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

You'll get a whole bunch of questions about what to include. See the end of the post for a list.

Video device drivers
Chances are that you will want to do
make menuconfig

and enable the compilation of various video device drivers e.g. go to Device drivers, Multimedia support, star (*) Cameras/video grabbers support, which enables Video Capture Adapters. Go to Video Capture Adapters and enable e.g. V4L USB devices/USB Video Class (m) to get your webcam working. You may need to enable other things too.

 Next:

make-kpkg clean
time fakeroot make-kpkg -j3 --initrd --revision=3.6.3 --append-to-version=-amd64 kernel_image kernel_headers

Building takes a while -- about 39 minutes on an AMD II X3.

mv ../*3.6.3*.deb .
sudo dpkg -i *.deb

And you're done!


What's new:

Expose hardware/virtual IRQ mapping via debugfs (IRQ_DOMAIN_DEBUG) [N/y/?] (NEW) *
Memory Resource Controller for Control Groups (MEMCG) [N/y/?] (NEW)
HugeTLB Resource Controller for Control Groups (CGROUP_HUGETLB) [N/y/?] (NEW)
Virtual (secure) IP: tunneling (NET_IPVTI) [N/m/?] (NEW)
NFQUEUE integration with Connection Tracking (NETFILTER_NETLINK_QUEUE_CT) [N/y/?] (NEW)
CAN Identifier (NET_EMATCH_CANID) [N/m/?] (NEW)     IPset (NET_EMATCH_IPSET) [N/m/?] (NEW)
Three-wire UART (H5) protocol support (BT_HCIUART_3WIRE) [N/y/?] (NEW)
Trace all mac80211 debug messages (MAC80211_MESSAGE_TRACING) [N/y/?] (NEW)   *
Driver for Broadcom BCM8706 and BCM8727 PHYs (BCM87XX_PHY) [N/m/?] (NEW) 
rt2800pci - Include support for rt3290 devices (EXPERIMENTAL) (RT2800PCI_RT3290) [Y/n/?] (NEW) 
MELFAS MMS114 touchscreen (TOUCHSCREEN_MMS114) [N/m/?] (NEW) 
EDT FocalTech FT5x06 I2C Touchscreen support (TOUCHSCREEN_EDT_FT5X06) [N/m/?] (NEW) 
Analog Devices AD-FMCOMMS1-EBZ SPI-I2C-bridge driver (SPI_XCOMM) [N/m/?] (NEW) 
BT8XX GPIO abuser (GPIO_BT8XX) [N/m/y/?] (NEW)   
AMD 8111 GPIO driver (GPIO_AMD8111) [N/m/y/?] (NEW)  
4096-Bit Addressable 1-Wire EEPROM with PIO (DS28E04-100) (W1_SLAVE_DS28E04) [N/m/?] (NEW)
Adaptive Voltage Scaling class support (POWER_AVS) [N/y/?] (NEW) *
Honeywell Humidicon HIH-6130 humidity/temperature sensor (SENSORS_HIH6130) [N/m/?] (NEW) 
BCMA Broadcom GBIT MAC COMMON core driver (BCMA_DRIVER_GMAC_CMN) [N/y/?] (NEW)
Support Wolfson Microelectronics Arizona platform with I2C (MFD_ARIZONA_I2C) [N/m/?] (NEW)
Support Wolfson Microelectronics Arizona platform with SPI (MFD_ARIZONA_SPI) [N/m/y/?] (NEW)
Cameras/video grabbers support (MEDIA_CAMERA_SUPPORT) [N/y/?] (NEW)  
Analog TV support (MEDIA_ANALOG_TV_SUPPORT) [N/y/?] (NEW) 
Digital TV support (MEDIA_DIGITAL_TV_SUPPORT) [N/y/?] (NEW)  
AM/FM radio receivers/transmitters support (MEDIA_RADIO_SUPPORT) [N/y/?] (NEW) 
Remote Controller support (MEDIA_RC_SUPPORT) [N/y/?] (NEW) 
Enable framebuffer console under vmwgfx by default (DRM_VMWGFX_FBCON) [N/y/?] (NEW)  
User-space I/O driver support for HID subsystem (UHID) [N/m/?] (NEW)  
Lenovo ThinkPad USB Keyboard with TrackPoint (HID_LENOVO_TPKBD) [N/m/?] (NEW) 
LED support for LM3556 Chip (LEDS_LM3556) [N/m/?] (NEW)  
LED support for the BlinkM I2C RGB LED (LEDS_BLINKM) [N/m/?] (NEW) 
LED One-shot Trigger (LEDS_TRIGGER_ONESHOT) [N/m/y/?] (NEW) 
EDAC legacy sysfs (EDAC_LEGACY_SYSFS) [Y/n/?] (NEW)  
VFIO Non-Privileged userspace driver framework (VFIO) [N/m/y/?] (NEW) *
Xen platform mcelog (XEN_MCE_LOG) [N/y/?] (NEW) *
Comedi misc drivers (COMEDI_MISC_DRIVERS) [N/y/?] (NEW) *
Comedi PCI drivers (COMEDI_PCI_DRIVERS) [N/y/?] (NEW) *
Comedi PCMCIA drivers (COMEDI_PCMCIA_DRIVERS) [N/y/?] (NEW) *
Comedi USB drivers (COMEDI_USB_DRIVERS) [N/y/?] (NEW) *
CSR wireless driver (CSR_WIFI) [N/m/?] (NEW) *
Pulse-Width Modulation (PWM) Support (PWM) [N/y/?] (NEW) *
Log kernel console messages (PSTORE_CONSOLE) [N/y/?] (NEW)   
Provide swap over NFS support (NFS_SWAP) [N/y/?] (NEW) 
Notifier error injection (NOTIFIER_ERROR_INJECTION) [N/m/y/?] (NEW)
Set upper limit of TLB entries to flush one-by-one (DEBUG_TLBFLUSH) [N/y/?] (NEW)
Serpent cipher algorithm (x86_64/AVX) (CRYPTO_SERPENT_AVX_X86_64) [N/m/y/?] (NEW) 
Twofish cipher algorithm (x86_64/AVX) (CRYPTO_TWOFISH_AVX_X86_64) [N/m/y/?] (NEW)   *
TCM_VHOST fabric module (EXPERIMENTAL) (TCM_VHOST) [N/m/?] (NEW) #

Links to this post:
http://forumubuntusoftware.info/viewtopic.php?f=117&t=8832
http://linux.org.ru/forum/linux-hardware/8339795
http://www.taringa.net/comunidades/ubuntuparataringeros/6513772/_ayuda_compilar-kernel-3_6-en-crunchbang.html
http://kenan.abdullahoglu.com/index.php/bilisim
http://crunchbang.org/forums/viewtopic.php?id=24484
http://forum.teneon.de/index.php?yshout&file=home&history&n=1000

19 September 2012

242. Briefly: Compiling NWChem 6.1.1 with Python on Debian Testing (Wheezy)

Back at the end of June a minor version of NWChem (bug fixes) was released.

There isn't much difference between compiling 6.1.1 and 6.1. Mainly, the difference is in what line to edit for python compatibility (NWChem 6.1 here:http://verahill.blogspot.com.au/2012/05/building-nwchem-61-on-debian.html )

1. Install dev packages
sudo apt-get install libopenmpi-dev openmpi-bin python2.7-dev zlib1g-dev libssl-dev

2. Compile openblas  or download e.g. acml.
(compiles fine, but doesn't run, with atlas)

3. NWchem goodness:

sudo mkdir /opt/nwchem
sudo chown $USER /opt/nwchem
cd /opt/nwchem
wget http://www.nwchem-sw.org/images/Nwchem-6.1.1-src.2012-06-27.tar.gz
(or go here http://www.nwchem-sw.org/index.php/Download)

tar xvf Nwchem-6.1.1-src.2012-06-27.tar.gz
cd nwchem-6.1.1-src/src/config/

Edit makefile.h and hange (line numbers are just for convenience -- don't add them)
1956 #   EXTRA_LIBS += -ltk -ltcl -L/usr/X11R6/lib -lX11 -ldl
1957      EXTRA_LIBS +=    -lnwcutil  -lpthread -lutil -ldl
1958   LDOPTIONS = -Wl,--export-dynamic

to
1956 #   EXTRA_LIBS += -ltk -ltcl -L/usr/X11R6/lib -lX11 -ldl
1957      EXTRA_LIBS +=    -lnwcutil  -lpthread -lutil -ldl -lssl -lz
1958   LDOPTIONS = -Wl,--export-dynamic

cd to /opt/nwchem/nwchem-6.1.1-src/ Create a file called buildconf.sh with the following content:
export LARGE_FILES=TRUE
export TCGRSH=/usr/bin/ssh
export NWCHEM_TOP=`pwd`
export NWCHEM_TARGET=LINUX64
export NWCHEM_MODULES="all python"
export PYTHONVERSION=2.7
export PYTHONHOME=/usr
export BLASOPT="-L/opt/openblas/lib -lopenblas"
#export BLASOPT="-L/opt/acml/acml5.2.0/gfortran64_int64/lib -lacml"
#export BLASOPT="-L/opt/ATLAS/lib -lsatlas -ltatlas"
export USE_MPI=y
export USE_MPIF=y
export USE_MPIF4=y
export MPI_LOC=/usr/lib/openmpi/lib
export MPI_INCLUDE=/usr/lib/openmpi/include
export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib/openmpi/lib:/opt/openblas/lib
#export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib/openmpi/lib:/opt/acml/acml5.2.0/gfortran64_int64/lib
#export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib/openmpi/lib:/opt/ATLAS/lib
export LIBMPI="-lmpi -lopen-rte -lopen-pal -ldl -lmpi_f77 -lpthread"
cd $NWCHEM_TOP/src
make clean
make nwchem_config
make FC=gfortran 1> make.log 2>make.err
export FC=gfortran
cd ../contrib
./getmem.nwchem

Start the compilation:
time sh buildconf.sh 

 On a quadcore i5-2400 it took 18 minutes.

13 September 2012

235. CPMD with Netlib's lapack, blas and your own fftw3 on ROCKS 5.4.3/CentOS 5.6

Update 8 Feb 2013:
I somehow had forgot to include some of the instructions for the BLAS part. Fixed now.

Post:
This is done pretty much like how it's done on Debian (-march=native didn't work in the BLAS compilation though, nor was -fno-whole-file accepted when compiling cpmd)

1. Compile cmake according to this post:
http://verahill.blogspot.com.au/2012/05/compiling-openbabel-231-and-cmake-on.html

2. Compile BLAS
sudo mkdir /share/apps/tools/netlib/blas/lib -p
sudo chown $USER /share/apps/tools/netlib -R
mkdir ~/tmp
cd ~/tmp
wget http://www.netlib.org/blas/blas.tgz
tar xvf blas.tgz
cd BLAS/

Edit make.inc
OPTS     = -O3 -shared -m64 -fPIC

make all

gfortran -shared -Wl,-soname,libnetblas.so -o libblas.so.1.0.1 *.o -lc
ln -s libblas.so.1.0.1 libnetblas.so
cp lib*blas* /share/apps/tools/netlib/blas/lib

3. Compile LAPACK
sudo mkdir /share/apps/tools/netlib/lapack -p
sudo chown $USER /share/apps/tools/netlib -R
wget http://www.netlib.org/lapack/lapack-3.4.1.tgz

tar xvf lapack-3.4.1.tgz
cd lapack-3.4.1/
mkdir build
cd build
ccmake ../

Hit 'c' and edit the values:

 BUILD_COMPLEX                    ON
 BUILD_COMPLEX16                  ON
 BUILD_DOUBLE                     ON
 BUILD_SHARED_LIBS                ON
 BUILD_SINGLE                     ON
 BUILD_STATIC_LIBS                ON
 BUILD_TESTING                    ON
 CMAKE_BUILD_TYPE                    
 CMAKE_INSTALL_PREFIX             /share/apps/tools/netlib/lapack
 LAPACKE                          OFF
 LAPACKE_WITH_TMG                 OFF
 USE_OPTIMIZED_BLAS               ON
 USE_XBLAS                        OFF

Hit 'c' again, then hit 'g'.

Edit CMakeCache.txt and add the following lines at the beginning:

########################
# EXTERNAL cache entries
########################
BLAS_FOUND:STRING=TRUE
BLAS_GENERIC_FOUND:BOOL=TRUE
BLAS_GENERIC_blas_LIBRARY:FILEPATH=/share/apps/tools/netlib/blas/lib/libnetblas.so
BLAS_LIBRARIES:PATH=/share/apps/tools/netlib/blas/lib/libnetblas.so

Do
ccmake ../
again, hit 'c', then 'g'.

Now,
make
make install

4. Compile FFTW3
sudo mkdir /share/apps/tools/fftw3
sudo chown $USER /share/apps/tools/fftw3
cd ~/tmp
wget http://www.fftw.org/fftw-3.3.1.tar.gz
tar -xvf fftw-3.3.1.tar.gz
cd fftw-3.3.1
make distclean
./configure --enable-float --enable-mpi --enable-threads --with-pic --prefix=/share/apps/tools/fftw3/single
make
make install
make distclean
./configure --disable-float --enable-mpi --enable-threads --with-pic --prefix=/share/apps/tools/fftw3/double
make 
make install

5. Compile CPMD
I downloaded the cpmd file to a client computer, then uploaded it to the ROCKS front node:
sftp me@rocks:/home/me/tmp

Connected to rocks.
Changing to: /home/me/tmp
sftp> put cpmd-v3_15_3.tar.gz
Uploading cpmd-v3_15_3.tar.gz to /home/me/tmp/cpmd-v3_15_3.tar.gz
cpmd-v3_15_3.tar.gz                100% 2937KB 587.4KB/s   00:05
sftp> exit

I then logged in via ssh as normal.
cd ~/tmp
tar xvf cpmd-v3_15_3.tar.gz
cd CPMD/CONFIGURE
Create a new file LINUX-x86_64-ROCKS

     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 -fsecond-underscore'
LFLAGS='-L/share/apps/tools/fftw3/double/lib -lfftw3-lfftw3_mpi -lfftw3_threads -I/usr/include -L/share/apps/tools/netlib/blas/lib -lnetblas -L/share/apps/tools/netlib/lapack/lib -llapack -L/opt/openmpi/lib -lpthread -lmpi'
     FFLAGS_GROMOS='  $(FFLAGS)' 
      FC='mpif77 -fbounds-check'
      CC='mpicc'
      LD='mpif77 -fbounds-check'

NOTE: I don't think the -I belongs in the LFLAGS statement, but I'm presuming that I put it there for a reason back when I did it the first time.

Go to ~/tmp/CPMD, and edit wfnio.F (basically replace 3 with 2 and remove 'L'):

 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

Finally, edit Makefile and change
  23 LD = f95 -O
to
  23 LD = mpif77 -fbounds-check

Time to compile


./mkconfig.sh LINUX-x86_64-ROCKS > Makefile
make
sudo mkdir /share/apps/cpmd
sudo chown $USER /share/apps/cpmd
cp cpmd.x /share/apps/cpmd

echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/share/apps/tools/netlib/blas/lib:/share/apps/tools/netlib/lapack/lib:/share/apps/tools/fftw3/double/lib' >>~/.bashrc
echo 'export PATH=$PATH:/share/apps/cpmd' >> ~/.bashrc
echo "export PP_LIBRARY_PATH=/share/apps/cpmd/PP_LIBRARY" >>~/.bashrc

You're now done compiling. To test, you need to get some pseudopotential files -- look at e.g. the end of http://verahill.blogspot.com.au/2012/07/not-solved-compiling-cpmd-on-debian.html for instructions.


25 July 2012

216. Quantum Espresso on ROCKS 5.4.3 / CentOs 5.6 -- Almost got it.

Preamble:

I've seen just about any error message imaginable when compiling Quantum Espresso. You can most likely get around them by following this guide ad verbatim 
(no parallel environment detected, can't build fortran programs, no linker, parallel vs serial compiler etc.)

This compile is nothing like the easy-breezy one on debian, because of one reason: CentOS 5.6 is old. It's so old that the default gcc version can't compile QE. You'd encounter similar problems with an increasing number of software packages, including ABINIT.

      CentOS 5.6: gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)
      Wheezy:       gcc version 4.7.1 (Debian 4.7.1-2)

The crusty compiler collection means we have to hammer out errors like these during compilation:


In file dfile_star.f90:28
    INTEGER,ALLOCATABLE ::  npert (:), irgq (:)
                      1
Error: Attribute at (1) is not allowed in a TYPE definition
 In file dfile_star.f90:37

    REAL(DP),ALLOCATABLE :: gi (:,:), gimq (:), eigen(:)
                       1
Error: Attribute at (1) is not allowed in a TYPE definition
 In file dfile_star.f90:42

    COMPLEX(DP),ALLOCATABLE :: u(:,:), t(:,:,:,:), tmq (:,:,:)
                          1
Error: Attribute at (1) is not allowed in a TYPE definition


Hence the requirement to first compile GCC 4.7, even if it takes a couple of hours. 

To the students out there swearing (and sweating) over their professors' insistence on using ROCKS/CentOS: compiling a compiler is not a wasted skill and just might be useful in building cross compilation environments for the time when you decide that science can take a hike and there's more money in working on setting up embedded systems. At least it'll buy you a little geek cred. 

Also, it seems that you need to use math and mpi libs compiled with the same compiler as you use to compile quantum espresso. So...lots of steps today as well!

Also, I haven't reported the configure bug for openmpi 1.6. Feel free to reproduce and report it.

I'm not happy that Quantum Espresso ignores the compile flags I've given it and defaults to things it should not default. I've had to jump through way too many hoops to be happy about this. OpenMPI not supporting program-suffix annoys me as well.

This is another massive compile...I'd rate it as my most annoying, troublesome and infuriating one yet.


1. Build GCC (gfortran, g++, gcc) 4.7 according to this post:
 http://verahill.blogspot.com.au/2012/07/compiling-gcc-471gfortran-471-on-centos.html
Make sure that
export PATH=$PATH:/share/apps/tools/gcc/gcc47/bin

2. Create target directory structure
sudo mkdir /share/apps/libs
sudo chown $USER /share/apps/lib

3. Recompile GNU OpenMP (libgomp)
It's probably easier you start with a freshly extracted gcc-4.7.1
cd ~/tmp/gcc
mkdir newgcc
cp gcc-4.7.1.tar.gz newgcc/
cd newgcc
tar xvf gcc-4.7.1
cd gcc-4.7.1/libgomp
mkdir build
cd build/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/share/apps/tools/gcc/mpc/lib:/share/apps/tools/gcc/gmp/lib:/share/apps/tools/gcc/mpfr/lib
.././configure CC=gcc-gcc-4.7 CXX=g++-gcc-4.7 F77=gfortran-gcc-4.7 FC=gfortran-gcc-4.7 --prefix=/share/apps/tools/gcc/gcc47

md5sum /share/apps/tools/gcc/gcc47/lib/libgomp.so.1.0.0
23db68121aacf1e7d896704474e26350  /share/apps/tools/gcc/gcc47/lib/libgomp.so.1.0.0

make
make install

md5sum /share/apps/tools/gcc/gcc47/lib/libgomp.so.1.0.0
791a1ceb0ea4009e22703b82e8ce1ff4  /share/apps/tools/gcc/gcc47/lib/libgomp.so.1.0.0

4.  Compile OpenMPI using your new GCC 
cd ~/tmp/
wget http://www.open-mpi.org/software/ompi/v1.6/downloads/openmpi-1.6.tar.gz
tar xvf openmpi-1.6.tar.gz
cd openmpi-1.6
mkdir build
cd build/
export LD_LIBRARY_PATH=/share/apps/tools/gcc/gcc47/lib64:/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1:/share/apps/tools/gcc/gmp/lib:/share/apps/tools/gcc/mpc/lib:/share/apps/tools/gcc/mpfr/lib

.././configure --prefix=/share/apps/libs/openmpi47 CC=gcc-gcc-4.7 FC=gfortran-gcc-4.7 F77=gfortran-gcc-4.7 F90=gfortran-gcc-4.7 CPP=cpp-gcc-4.7 CXX=g++-gcc-4.7 --with-sge LDFLAGS="-L/share/apps/tools/gcc/gcc47/lib64 -L/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1 -L/share/apps/tools/gcc/gmp/lib -L/share/apps/tools/gcc/mpc/lib -L/share/apps/tools/gcc/mpfr/lib -L/share/apps/tools/gcc/gcc47/lib" CPPFLAGS="-I/share/apps/tools/gcc/mpc/include -I/share/apps/tools/gcc/gmp/include -I/share/apps/tools/gcc/mpfr/include -I/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/include"

** There's a bug in the openmpi configure script leading to config failure due to to an extra space being introduced in front of -L when testing the F77 compiler. Exporting the LD_LIBRARY_PATH is done to get around that. **

make
make install

cd /share/apps/libs/openmpi47bin/
ls mpi* |xargs -I {} ln -s {} {}-gcc-4.7
echo 'export PATH=$PATH:/share/apps/libs/openmpi47/bin' >> ~/.bashrc
source ~/.bashrc

cd /share/apps/libs/openmpi47share/openmpi/
ln -s mpif77-vt-wrapper-data.txt mpif77-gcc-4.7-vt-wrapper-data.txt
ln -s mpif90-vt-wrapper-data.txt mpif90-gcc-4.7-vt-wrapper-data.txt
ln -s mpicc-vt-wrapper-data.txt mpicc-gcc-4.7-vt-wrapper-data.txt
ln -s mpic++-vt-wrapper-data.txt mpic++-gcc-4.7vt--wrapper-data.txt

ln -s mpicxx-vt-wrapper-data.txt mpicxx-gcc-4.7-vt-wrapper-data.txt
ln -s mpif77-wrapper-data.txt mpif77-gcc-4.7-wrapper-data.txt
ln -s mpif90-wrapper-data.txt mpif90-gcc-4.7-wrapper-data.txt
ln -s mpicc-wrapper-data.txt mpicc-gcc-4.7-wrapper-data.txt
ln -s mpic++-wrapper-data.txt mpic++-gcc-4.7-wrapper-data.txt
ln -s mpicxx-wrapper-data.txt mpicxx-gcc-4.7-wrapper-data.txt


5. Compile FFT using your new GCC
cd ~/tmp
wget ftp://ftp.fftw.org/pub/fftw/fftw-3.3.2.tar.gz
tar xvf fftw-3.3.2.tar.gz

cd fftw-3.3.2/
./configure --enable-float --enable-mpi --enable-threads --with-pic --prefix=/share/apps/libs/fftw-3.3.2-gcc47/single CC=gcc-gcc-4.7 FC=gfortran-gcc-4.7 CPP=cpp-gcc-4.7 MPIF90=mpif90-gcc-4.7 F77=gfortran-gcc-4.7 MPICC=mpicc-gcc-4.7 MPIF77=mpif77-gcc-4.7

make
make install
make check

--------------------------------------------------------------
         FFTW threaded transforms passed basic tests!
--------------------------------------------------------------
..
Executing "mpirun -np 1 ..
..
make[3]: *** [check-local] Error 1
..

That mpirun won't work isn't that surprising since it's still point to /opt/openmpi/bin instead of our mpirun-gcc-4.7

make distclean
./configure --disable-float --enable-mpi --enable-threads --with-pic --prefix=/share/apps/libs/fftw-3.3.2-gcc47/double CC=gcc-gcc-4.7 FC=gfortran-gcc-4.7 CPP=cpp-gcc-4.7 MPIF90=mpif90-gcc-4.7 F77=gfortran-gcc-4.7 MPICC=mpicc-gcc-4.7 MPIF77=mpif77-gcc-4.7

make
make install
make check
--------------------------------------------------------------
         FFTW threaded transforms passed basic tests!
--------------------------------------------------------------
...followed by the same error as above.
It's fine.

6. Optional: Compile openblas using your new GCC
cd /share/apps/tools/gcc/binutils/bin
ln -s ar-gcc-4.7 gcc-ar

cd ~/tmp
wget http://nodeload.github.com/xianyi/OpenBLAS/tarball/v0.1.1
mv v0.1.1 openblas.tar.gz
tar xvf openblas.tar.gz
cd xianyi-OpenBLAS-e6e87a2/
wget http://www.netlib.org/lapack/lapack-3.4.1.tgz

export LD_LIBRARY_PATH=/share/apps/tools/gcc/gmp/lib:/share/apps/tools/gcc/mpc/lib:/share/apps/tools/gcc/mpfr/lib

make all BINARY=64 CC=gcc-gcc-4.7 FC=gfortran-gcc-4.7 MPICC=mpicc-gcc-4.7 USE_THREAD=0 INTERFACE64=1 

make PREFIX=/share/apps/libs/openblas47 install

cp libopenblas_* /share/apps/libs/openblas47/lib
cd /share/apps/libs/openblas47/lib
ln -s libopenblas_nehalem-r0.1.1.so libopenblas.so.1
ln -s libopenblas.so.1 libopenblas.so
ln -s libopenblas.so libopenblas.so.0
ln -s libopenblas_nehalem-r0.1.1.a libopenblas.a

7. Compile Quantum Espresso using your new GCC
sudo mkdir /share/apps/QE
sudo chown $USER /share/apps/QE
mkdir /share/apps/QE/lapack-3.2

mkdir ~/tmp/QE
cd ~/tmp/QE

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

Edit environmental_variables
PREFIX=/share/apps/QE
TMP_DIR=/tmp/QE
PARA_PREFIX="mpirun-gcc-4.7 -n 8"

Time to configure and compile:
cd ~/tmp/QE
tar xvf espresso-5.0.tar.gz
cd espresso-5.0/
cp lapack-3.2 -R /share/apps/QE/
cp BLAS -R /share/apps/QE/

Create a script called compile.sh:

make clean
export PATH=""
export PATH="/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/ecce/apps/scripts/share/apps/pvm/pvm3/bin/LINUX64:/share/apps/libs/openmpi47/bin:/share/apps/nwchem/nwchem-6.1/bin/LINUX64:/share/apps/sinfo/bin:/share/apps/sinfo/sbin:/share/apps/gromacs/bin:/share/apps/cmake/bin:/share/apps/tools/babel/bin:/share/apps/tools/htop/bin:/share/apps/tools/xmgrace/grace/bin:/share/apps/tools/rasmol/src:/share/apps/tools/strace/bin:/share/apps/tools/gcc/gcc47/bin:/share/apps/tools/gcc/binutils/bin"
which mpif90
read -p "press any key"
export CC=gcc-gcc-4.7
export FC=gfortran-gcc-4.7
export MPIF90=mpif90-gcc-4.7
export MPIF77=mpif77-gcc-4.7
export F77=gfortran-gcc-4.7
export F90=gfortran-gcc-4.7
export CPP=cpp-gcc-4.7
export CXX=g++-gcc-4.7
export CFLAGS=""
export DFLAGS="-DFFT_FFTW3"
export CPPFLAGS="-I/share/apps/tools/gcc/mpc/include -I/share/apps/tools/gcc/gmp/include -I/share/apps/tools/gcc/mpfr/include -I/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/include -I/share/apps/libs/openmpi47/include -I//share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/include"
export LDFLAGS="-L/share/apps/tools/gcc/gcc47/lib -L/share/apps/tools/gcc/gcc47/lib64 -L/share/apps/tools/gcc/gcc47/lib/gcc/x86_64-unknown-linux-gnu/4.7.1 -L/share/apps/tools/gcc/gmp/lib -L/share/apps/tools/gcc/mpc/lib -L/share/apps/tools/gcc/mpfr/lib -L/share/apps/libs/openmpi47/lib -L/lib64 -lc"
#export BLAS_LIBS="-L/share/apps/libs/openblas47/lib -lopenblas" 
export BLAS_LIBS="/share/apps/QE/BLAS/blas.a"
export LAPACK_LIBS="/share/apps/QE/lapack-3.2/lapack.a"
export FFT_LIBS="-L/share/apps/libs/fftw-3.3.2-gcc47/double/lib -lfftw3 -lfftw3_mpi -lfftw3_threads"
export MPI_LIBS="-L/share/apps/libs/openmpi47/lib -l:/share/apps/libs/openmpi47/lib/libmpi.so"
export LD_LIBRARY_PATH=/share/apps/tools/gcc/gmp/lib:/share/apps/tools/gcc/mpfr/lib:/share/apps/tools/gcc/mpc/lib:/share/apps/libs/openmpi47/lib
./configure --prefix=/share/apps/QE/bin|tee conf.log
read -p "Press key to continue"
cd PW
make |tee make.log
cd ../
make all |tee makeall.log

Then run it using

sh compile.sh

Which gives:

--------------------------------------------------------------------
ESPRESSO can take advantage of several optimized numerical libraries
(essl, fftw, mkl...).  This configure script attempts to find them,
but may fail if they have been installed in non-standard locations.
If a required library is not found, the local copy will be compiled.

The following libraries have been found:
  BLAS_LIBS=/share/apps/QE/BLAS?blas.a
  LAPACK_LIBS=/share/apps/QE/lapack-3.2/lapack.a
  FFT_LIBS=-L/share/apps/libs/fftw-3.3.2-gcc47/double/lib -lfftw3 -lfftw3_mpi -lfftw3_threads
  MPI_LIBS=-L/share/apps/libs/openmpi47/lib -l:/share/apps/libs/openmpi47/lib/libmpi.so
Please check if this is what you expect.

If any libraries are missing, you may specify a list of directories
to search and retry, as follows:
  ./configure LIBDIRS="list of directories, separated by spaces"

Parallel environment detected successfully.\
Configured for compilation of parallel executables.

For more info, read the ESPRESSO User's Guide (Doc/users-guide.tex).
--------------------------------------------------------------------
configure: success

and more...Once it's over do

cd ~/tmp/QE/espresso-5.0
cp * -R /share/apps/QE/
echo 'export PATH=$PATH:/share/apps/QE/bin' >> ~/.bashrc
source ~/.bashrc

8. Testing PW -- STUCK
export LD_LIBRARY_PATH=/share/apps/tools/gcc/gmp/lib:/share/apps/tools/gcc/mpfr/lib:/share/apps/tools/gcc/mpc/lib:/share/apps/libs/openmpi47/lib:/share/apps/libs/openblas47/lib:/share/apps/tools/gcc/gcc47/lib64
cd /share/apps/QE/PW/examples/example02
./run_example

/share/apps/QE/PW/examples/example02 : starting

This example shows how to use pw.x to compute the equilibrium geometry
of a simple molecule, CO, and of an Al (001) slab.
In the latter case the relaxation is performed in two ways:
1) using the quasi-Newton BFGS algorithm
2) using a damped dynamics algorithm.

  executables directory: /share/apps/QE/bin
  pseudo directory:      /share/apps/QE/pseudo
  temporary directory:   /tmp/QE
  checking that needed directories and files exist...
Downloading O.pz-rrkjus.UPF to /share/apps/QE/pseudo...
Downloading C.pz-rrkjus.UPF to /share/apps/QE/pseudo... done

  running pw.x as: mpirun-gcc-4.7 -n 8  /share/apps/QE/bin/pw.x  

  cleaning /tmp/QE... done
  running the geometry relaxation for CO... from test_input_xml: Empty input file .. stopping
 from test_input_xml: Empty input file .. stopping
 from test_input_xml: Empty input file .. stopping
 from test_input_xml: Empty input file .. stopping
 from test_input_xml: Empty input file .. stopping
 from test_input_xml: Empty input file .. stopping
STOP 2
STOP 2
--------------------------------------------------------------------------
mpirun-gcc-4.7 noticed that the job aborted, but has no info as to the process
that caused that situation.
--------------------------------------------------------------------------
Error condition encountered during test: exit status = 2
Aborting

It's more insidious than that though -- pw.x crashes with "STOP 2" for any type of input.

NOTE: Like on Debian I had segfaults happening when using my own openblas (which works fine with gromacs and nwchem). Hence why I show you how to compile it, yet never use it.

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