- 
                Notifications
    You must be signed in to change notification settings 
- Fork 929
Description
I see this build error with OpenMPI on Shelob at LSU:
  FCLD     libmpi_usempi_ignore_tkr.la
/usr/bin/ld: cannot find -l-L/project/eschnett/shelob/software/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0
collect2: error: ld returned 1 exit status
I configured with
/project/eschnett/shelob/software/src/openmpi-1.8.5/src/openmpi-1.8.5/configure --prefix=/project/eschnett/shelob/software/openmpi-1.8.5 --with-hwloc=/project/eschnett/shelob/software/hwloc-1.10.1 --disable-vt CC=/project/eschnett/shelob/software/llvm-3.6.0/bin/wrap-clang CXX=/project/eschnett/shelob/software/llvm-3.6.0/bin/wrap-clang++ FC=/project/eschnett/shelob/software/gcc-5.1.0/bin/wrap-gfortran CFLAGS=-I/opt/ofed/include -I/project/eschnett/shelob/software/hwloc-1.10.1/include CXXFLAGS=-I/opt/ofed/include -I/project/eschnett/shelob/software/hwloc-1.10.1/include LDFLAGS=-L/opt/ofed/lib64 -L/opt/rocks/lib -L/project/eschnett/shelob/software/hwloc-1.10.1/lib -Wl,-rpath,/project/eschnett/shelob/software/hwloc-1.10.1/lib LIBS=-lhwloc -lpthread -lpthread
I am using a self-built clang 3.6.0 that is called via the "wrap-clang" script, which calls clang, adding a few command line options to set include and library paths pointing to the self-build gcc 5.1 installation that provides libstdc++. (This is necessary since not all software packages honours CFLAGS, CXXFLAGS, etc.; I don't think this wrapper would be necessary for OpenMPI.) I am describing this wrapper here for completeness, I do not think it causes the problem I see.
In particular, the -L option mentioned in the error message is added by wrap-clang. I believe this is due to a problem in OpenMPI's configure script. The following patch remedies the problem:
--- configure
+++ configure
@@ -298951,6 +298951,7 @@
        # Remove the space.
        if test $p = "-L" ||
-          test $p = "-R"; then
+          test $p = "-R" ||
+          test $p = "-l"; then
     prev=$p
     continue
        fi
@@ -300857,6 +300858,7 @@
        # Remove the space.
        if test $p = "-L" ||
-          test $p = "-R"; then
+          test $p = "-R" ||
+          test $p = "-l"; then
     prev=$p
     continue
        fi
By the way, a more complete list of compiler command line options that takes paths as arguments are the letters "FILRYlouz"; you may want to check for all of these instead.