Anyone know how to install openssl on a Mac M1 so that I can get my projects that use the openssl crate to build?
My partner in business decided to splash some cache on new machines for us. When he suggested MacBook M1 I agreed, having heard good things of the new fangled ARM based Macs. And especially as my MS Surface Pro's battery exploded once and now the replacement only holds a charge for an hour or so. Great machine, puts my old big box PC to shame. Only problem is I have never used a Mac and have no idea how to drive it.
I managed to install rustup, Cargo and Rust using the same procedure I use for Debian. Happily "Hello World" compiled out of the box. But I can't get any of my projects that use openssl to build.
After much googling around I think I have MacPorts installed. And openssl:
**✗** brew install openssl
Updating Homebrew...
==> **Auto-updated Homebrew!**
Updated 1 tap (homebrew/core).
==> **New Formulae**
aliddns cloudflare-wrangler osmcoastline
==> **Updated Formulae**
Updated 116 formulae.
Warning: openssl@1.1 1.1.1i is already installed and up-to-date
To reinstall 1.1.1i, run `brew reinstall openssl@1.1`
**➜** **conq-sm-decoder** **git:(** **master** **)** **✗** brew reinstall openssl@1.1
==> **Downloading https://homebrew.bintray.com/bottles/openssl%401.1-1.1.1i.arm64_**
Already downloaded: /Users/zicog/Library/Caches/Homebrew/downloads/f5bd034aadaad80de4a9374ea974c7698a93a5a96c2671052d309a778ad6deca--openssl@1.1-1.1.1i.arm64_big_sur.bottle.tar.gz
==> **Reinstalling** **openssl@1.1**
==> **Pouring openssl@1.1-1.1.1i.arm64_big_sur.bottle.tar.gz**
==> **Caveats**
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/opt/homebrew/etc/openssl@1.1/certs
and run
/opt/homebrew/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH run:
echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
==> **Summary**
🍺 /opt/homebrew/Cellar/openssl@1.1/1.1.1i: 8,067 files, 18MB
On the other hand I have also tried this:
**✗** sudo /opt/local/bin/port -N install openssl +universal
---> Computing dependencies for openssl
---> Dependencies to be installed: zlib
---> Fetching archive for zlib
---> Attempting to fetch zlib-1.2.11_0+universal.darwin_20.arm64-x86_64.tbz2 from https://cph.dk.packages.macports.org/zlib
---> Attempting to fetch zlib-1.2.11_0+universal.darwin_20.arm64-x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/zlib
---> Installing zlib @1.2.11_0+universal
---> Activating zlib @1.2.11_0+universal
---> Cleaning lib
---> Fetching archive for openssl
---> Attempting to fetch openssl-1.1.1i_0+universal.darwin_20.arm64-x86_64.tbz2 from https://cph.dk.packages.macports.org/openssl
---> Attempting to fetch openssl-1.1.1i_0+universal.darwin_20.arm64-x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/openssl
---> Installing openssl @1.1.1i_0+universal
---> Activating openssl @1.1.1i_0+universal
---> Cleaning openssl
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.
Which may or may not have been a good idea. I have no idea.
But my project build fails to build:
> ✗ cargo build
> Compiling openssl-sys v0.9.60
> error: failed to run custom build command for `openssl-sys v0.9.60`
> Caused by:
> process didn't exit successfully: `/Users/zicog/conveqs/conq-sm-decoder/target/debug/build/openssl-sys-29c757dffae9a1e2/build-script-main` (exit code: 101)
> --- stdout
> cargo:rustc-cfg=const_fn
> cargo:rerun-if-env-changed=AARCH64_APPLE_DARWIN_OPENSSL_NO_VENDOR
> AARCH64_APPLE_DARWIN_OPENSSL_NO_VENDOR unset
> cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
> OPENSSL_NO_VENDOR unset
> --- stderr
> thread 'main' panicked at 'don't know how to configure OpenSSL for aarch64-apple-darwin', /Users/zicog/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.6.0+1.1.1d/src/lib.rs:178:18
> note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Any advice for a Mac neophyte much appreciated.