Repository: spack/spack

Issue:
Installation issue: rust on macOS
### Steps to reproduce the issue

```console
$ spack install rust
...
     Running `/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/build/x86_64-apple-darwin/stage2-tools/release/build/openssl-sys-f5b6b6a6bcfd2d47/build-script-main`
error: failed to run custom build command for `openssl-sys v0.9.53`

Caused by:
  process didn't exit successfully: `/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/build/x86_64-apple-darwin/stage2-tools/release/build/openssl-sys-f5b6b6a6bcfd2d47/build-script-main` (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_APPLE_DARWIN_OPENSSL_LIB_DIR
X86_64_APPLE_DARWIN_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_APPLE_DARWIN_OPENSSL_INCLUDE_DIR
X86_64_APPLE_DARWIN_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_APPLE_DARWIN_OPENSSL_DIR
X86_64_APPLE_DARWIN_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
run pkg_config fail: "Failed to run `\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"`: No such file or directory (os error 2)"

--- stderr
rustc command: "DYLD_LIBRARY_PATH"="/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/build/x86_64-apple-darwin/stage2/lib" "/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/build/x86_64-apple-darwin/stage2/bin/rustc" "--crate-name" "probe0" "--crate-type=lib" "--out-dir" "/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/build/x86_64-apple-darwin/stage2-tools/x86_64-apple-darwin/release/build/openssl-sys-0dac76d1a259d6d8/out" "--emit=llvm-ir" "--target" "x86_64-apple-darwin" "-" "--sysroot" "/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/build/x86_64-apple-darwin/stage2" "-C" "debug-assertions=n"
sysroot: "/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/build/x86_64-apple-darwin/stage2"
libdir: "/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/build/x86_64-apple-darwin/stage2/lib"
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = x86_64-apple-darwin
$TARGET = x86_64-apple-darwin
openssl-sys = 0.9.53



It looks like you're compiling on macOS, where the system contains a version of
OpenSSL 0.9.8. This crate no longer supports OpenSSL 0.9.8.

As a consumer of this crate, you can fix this error by using Homebrew to
install the `openssl` package, or as a maintainer you can use the openssl-sys
0.7 crate for support with OpenSSL 0.9.8.

Unfortunately though the compile cannot continue, so aborting.

', /private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/vendor/openssl-sys/build/find_normal.rs:150:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/spack_bootstrap/bin/cargo" "build" "-Zconfig-profile" "--target" "x86_64-apple-darwin" "-Zbinary-dep-depinfo" "-j" "4" "-v" "--release" "--frozen" "--manifest-path" "/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/src/tools/cargo/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
Traceback (most recent call last):
  File "./x.py", line 11, in <module>
    bootstrap.main()
  File "/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/src/bootstrap/bootstrap.py", line 951, in main
    bootstrap(help_triggered)
  File "/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/src/bootstrap/bootstrap.py", line 937, in bootstrap
    run(args, env=env, verbose=build.verbose)
  File "/private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/src/bootstrap/bootstrap.py", line 141, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /private/var/folders/21/hwq39zyj4g36x6zjfyl5l8080000gn/T/Adam/spack-stage/spack-stage-rust-1.42.0-bstzydu5kantx3k4npotzo5mqqw3fafw/spack-src/build/bootstrap/debug/bootstrap build
```
We might need to add a build dependency on `pkgconfig` or set `OPENSSL_DIR`.

### Information on your system

* **Spack:** 0.14.1-593-08a491b062
* **Python:** 3.7.6
* **Platform:** darwin-catalina-ivybridge

### Additional information

* [spack-build-out.txt](https://github.com/spack/spack/files/4465818/spack-build-out.txt)
* [spack-build-env.txt](https://github.com/spack/spack/files/4465819/spack-build-env.txt)

@AndrewGaspar 

### General information

- [x] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [x] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [x] I have uploaded the build log and environment files
- [x] I have searched the issues of this repo and believe this is not a duplicate



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/rust/package.py b/var/spack/repos/builtin/packages/rust/package.py
--- a/var/spack/repos/builtin/packages/rust/package.py
+++ b/var/spack/repos/builtin/packages/rust/package.py
@@ -18,6 +18,7 @@ class Rust(Package):
 
     homepage = "https://www.rust-lang.org"
     url = "https://static.rust-lang.org/dist/rustc-1.42.0-src.tar.gz"
+    git = "https://github.com/rust-lang/rust.git"
 
     maintainers = ["AndrewGaspar"]
 
@@ -55,8 +56,11 @@ class Rust(Package):
         description='Install Rust source files'
     )
 
-    depends_on('cmake', type='build')
-    depends_on('python@:2.8', type='build')
+    depends_on('python@2.7:', type='build')
+    depends_on('python@2.7:2.8', when='@:1.43', type='build')
+    depends_on('gmake@3.81:', type='build')
+    depends_on('cmake@3.4.3:', type='build')
+    depends_on('pkgconfig', type='build')
     depends_on('openssl')
     depends_on('libssh2')
     depends_on('libgit2')


Test patch: