Repository: spack/spack

Issue:
Issue while building mpiP
Trying to build this on ubuntu desktop gives (config.log):

```
configure:4289: /home/guest/workarena/softwares/sources/spack/lib/spack/env/gcc/gcc -c   conftest.c >&5
conftest.c:11:17: fatal error: mpi.h: No such file or directory
compilation terminated.
configure:4289: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "mpiP"
| #define PACKAGE_TARNAME "mpip"
| #define PACKAGE_VERSION "3.3"
| #define PACKAGE_STRING "mpiP 3.3"
| #define PACKAGE_BUGREPORT "mpip-help@lists.sourceforge.net"
| #define PACKAGE_URL ""
| #define DEFAULT_REPORT_FORMAT mpiPi_style_verbose
| #define HAVE_LIBM 1
| /* end confdefs.h.  */
| #include "mpi.h"
|
| int
| main ()
| {
| #ifndef MPI_Init
| #ifdef __cplusplus
|   (void) MPI_Init;
| #else
|   (void) MPI_Init;
| #endif
| #endif
|
|   ;
|   return 0;
| }
configure:4289: result: no
configure:4294: error: "Failed to find declaration for MPI_Init!"
```

I am creating PR with additional `--with-cc` option to configure but then seeing next error:

```
  File "/home/guest/workarena/softwares/sources/spack/var/spack/stage/mpip-3.4.1-x7l5jk256ayuuirddcxdpbpytlnis3hq/mpiP-3.4.1/make-wrappers.py", line 712, in StandardFileHeader
    olist = StandardFileHeader(sname)
  File "/home/guest/workarena/softwares/sources/spack/var/spack/stage/mpip-3.4.1-x7l5jk256ayuuirddcxdpbpytlnis3hq/mpiP-3.4.1/make-wrappers.py", line 712, in StandardFileHeader
    olist.append("/* Creator: " + os.environ["LOGNAME"] + "  */\n")
  File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
    olist.append("/* Creator: " + os.environ["LOGNAME"] + "  */\n")
    raise KeyError(key)
  File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
KeyError: 'LOGNAME'    raise KeyError(key)
```

Issue while building mpiP
Trying to build this on ubuntu desktop gives (config.log):

```
configure:4289: /home/guest/workarena/softwares/sources/spack/lib/spack/env/gcc/gcc -c   conftest.c >&5
conftest.c:11:17: fatal error: mpi.h: No such file or directory
compilation terminated.
configure:4289: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "mpiP"
| #define PACKAGE_TARNAME "mpip"
| #define PACKAGE_VERSION "3.3"
| #define PACKAGE_STRING "mpiP 3.3"
| #define PACKAGE_BUGREPORT "mpip-help@lists.sourceforge.net"
| #define PACKAGE_URL ""
| #define DEFAULT_REPORT_FORMAT mpiPi_style_verbose
| #define HAVE_LIBM 1
| /* end confdefs.h.  */
| #include "mpi.h"
|
| int
| main ()
| {
| #ifndef MPI_Init
| #ifdef __cplusplus
|   (void) MPI_Init;
| #else
|   (void) MPI_Init;
| #endif
| #endif
|
|   ;
|   return 0;
| }
configure:4289: result: no
configure:4294: error: "Failed to find declaration for MPI_Init!"
```

I am creating PR with additional `--with-cc` option to configure but then seeing next error:

```
  File "/home/guest/workarena/softwares/sources/spack/var/spack/stage/mpip-3.4.1-x7l5jk256ayuuirddcxdpbpytlnis3hq/mpiP-3.4.1/make-wrappers.py", line 712, in StandardFileHeader
    olist = StandardFileHeader(sname)
  File "/home/guest/workarena/softwares/sources/spack/var/spack/stage/mpip-3.4.1-x7l5jk256ayuuirddcxdpbpytlnis3hq/mpiP-3.4.1/make-wrappers.py", line 712, in StandardFileHeader
    olist.append("/* Creator: " + os.environ["LOGNAME"] + "  */\n")
  File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
    olist.append("/* Creator: " + os.environ["LOGNAME"] + "  */\n")
    raise KeyError(key)
  File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
KeyError: 'LOGNAME'    raise KeyError(key)
```



Discussion:
I would start by converting all of the dependencies from `type='build'` to the default (build/link). I'm not sure why they would be build-only dependencies.

Note sure about the key error. I would have to see your PR.
I would start by converting all of the dependencies from `type='build'` to the default (build/link). I'm not sure why they would be build-only dependencies.

Note sure about the key error. I would have to see your PR.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/mpip/package.py b/var/spack/repos/builtin/packages/mpip/package.py
--- a/var/spack/repos/builtin/packages/mpip/package.py
+++ b/var/spack/repos/builtin/packages/mpip/package.py
@@ -33,10 +33,14 @@ class Mpip(AutotoolsPackage):
 
     version("3.4.1", "1168adc83777ac31d6ebd385823aabbd")
 
-    depends_on("libelf", type="build")
-    depends_on("libdwarf", type="build")
-    depends_on('libunwind', when=os.uname()[4] == "x86_64", type="build")
-    depends_on("mpi", type="build")
+    depends_on("libelf")
+    depends_on("libdwarf")
+    depends_on('libunwind', when=os.uname()[4] == "x86_64")
+    depends_on("mpi")
 
     def configure_args(self):
-        return ['--without-f77']
+        config_args = ['--without-f77']
+        config_args.append("--with-cc=%s" % self.spec['mpi'].mpicc)
+        config_args.append("--with-cxx=%s" % self.spec['mpi'].mpicxx)
+
+        return config_args


Test patch: