Source: elpa
Version: 2013.11.008-2
Severity: wishlist
Tags: patch

Hi maintainer

Elpa FTBFS on Ubuntu builders as it fails the blacs link test in configure with the following output:

configure:6376: checking for library containing blacs_gridinit
configure:6394: mpif90 -o conftest -g -O2 -ffree-form -lblacsCinit-openmpi -lblacs-openmpi -lscalapack-openmpi conftest.f -llapack -lblas >&5
/tmp/ccgbFmtZ.o: In function `MAIN__':
/build/buildd/elpa-2013.11.008/conftest.f:2: undefined reference to `blacs_gridinit_'
collect2: error: ld returned 1 exit status
configure:6394: $? = 1
configure: failed program was:
|       program main
|       call blacs_gridinit
|       end
...
configure:6411: result: no
configure:6421: checking whether we can link a program with a blacs lib
configure:6423: result: no
configure:6427: error: could not link with blacs: specify path

It seems the linker in Ubuntu is much stricter than the one in Debian.
I was able to get it to build successfully by reversing the order of the blacs and scalapack libraries, and inserting them after 'conftest.f' (as LIBS) instead of before 'conftest.f' (as LDFLAGS), as follows:

mpif90 -o conftest -g -O2 -ffree-form conftest.f -llapack -lblas -lscalapack-openmpi -lblacs-openmpi -lblacsCinit-openmpi

Please consider the attached patch.

Regards
Graham

diff -Nru elpa-2013.11.008/debian/control elpa-2013.11.008/debian/control
--- elpa-2013.11.008/debian/control	2014-09-14 15:40:14.000000000 +0200
+++ elpa-2013.11.008/debian/control	2015-03-05 11:54:11.000000000 +0200
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Debichem Team <[email protected]>
 Uploaders: Michael Banck <[email protected]>
-Build-Depends: debhelper (>= 7.0.50~), gfortran, libblas-dev, liblapack-dev, mpi-default-dev, libblacs-mpi-dev, libscalapack-mpi-dev
+Build-Depends: debhelper (>= 7.0.50~), gfortran, libblas-dev, liblapack-dev, mpi-default-dev, libblacs-mpi-dev, libscalapack-mpi-dev, dh-autoreconf
 Standards-Version: 3.9.4
 Homepage: http://elpa.rzg.mpg.de
 Vcs-Browser: http://anonscm.debian.org/viewvc/debichem/unstable/elpa/
diff -Nru elpa-2013.11.008/debian/patches/blacs-libs.patch elpa-2013.11.008/debian/patches/blacs-libs.patch
--- elpa-2013.11.008/debian/patches/blacs-libs.patch	1970-01-01 02:00:00.000000000 +0200
+++ elpa-2013.11.008/debian/patches/blacs-libs.patch	2015-03-04 22:46:50.000000000 +0200
@@ -0,0 +1,25 @@
+Description: Add blacs libraries as LIBS instead of LDFLAGS
+ This patch fixes a FTBFS in Ubuntu when configure checks for blacs
+ and scalapack libraries.
+ .
+ This works in Debian, but fails in Ubuntu:
+ mpif90 -o conftest -g -O2 -ffree-form     -lblacsCinit-openmpi
+ -lblacs-openmpi -lscalapack-openmpi  conftest.f -llapack -lblas
+ .
+ While this works in Ubuntu:
+ mpif90 -o conftest -g -O2 -ffree-form       conftest.f -llapack -lblas
+ -lscalapack-openmpi -lblacs-openmpi -lblacsCinit-openmpi
+  
+Author: Graham Inggs <[email protected]>
+Forwarded: no
+Last-Update: 2015-03-04
+--- a/configure.ac
++++ b/configure.ac
+@@ -235,6 +235,7 @@
+ 
+ FCFLAGS="$FCFLAGS $BLACS_FCFLAGS"
+ LDFLAGS="$LDFLAGS $BLACS_LDFLAGS"
++LIBS="$LIBS $BLACS_LIBS"
+ dnl check whether one can link with specified MKL (desired method)
+ AC_MSG_CHECKING([whether we can compile a Fortran program using MKL])
+ 
diff -Nru elpa-2013.11.008/debian/patches/series elpa-2013.11.008/debian/patches/series
--- elpa-2013.11.008/debian/patches/series	1970-01-01 02:00:00.000000000 +0200
+++ elpa-2013.11.008/debian/patches/series	2015-03-04 22:03:00.000000000 +0200
@@ -0,0 +1 @@
+blacs-libs.patch
diff -Nru elpa-2013.11.008/debian/rules elpa-2013.11.008/debian/rules
--- elpa-2013.11.008/debian/rules	2014-09-14 15:40:14.000000000 +0200
+++ elpa-2013.11.008/debian/rules	2015-03-04 22:12:26.000000000 +0200
@@ -4,10 +4,10 @@
 include /usr/share/mpi-default-dev/debian_defaults
 
 export OMPI_MCA_orte_rsh_agent=/bin/false
-export BLACS_LDFLAGS=-lblacsCinit-$(ARCH_DEFAULT_MPI_IMPL) -lblacs-$(ARCH_DEFAULT_MPI_IMPL) -lscalapack-$(ARCH_DEFAULT_MPI_IMPL)
+export BLACS_LIBS=-lscalapack-$(ARCH_DEFAULT_MPI_IMPL) -lblacs-$(ARCH_DEFAULT_MPI_IMPL) -lblacsCinit-$(ARCH_DEFAULT_MPI_IMPL) 
 
 %:
-	dh $@ 
+	dh $@ --with autoreconf
 
 override_dh_auto_clean:
 	rm -f .fortran_dependencies/dependencies.mk config-f90.h modules/elpa1.mod modules/elpa2.mod

Reply via email to