PKG_CONFIG_PATH=/opt/homebrew/opt/openssl/lib/pkgconfig cargo build
If it works, hooray! Add it to your ~/.zshrc
(Based on your output, it looks likely to be your shell.)
I've only used pkgsrc myself, so I'm not sure how MacPorts works. But I would:
Make sure that MacPorts' bin directory is in PATH.
Make sure that pkg-config
is installed.
Try to build the openssl crate again.
... and I say this while stressing that I haven't actually used MacPorts, but I assume it works sort of like pkgsrc when it comes to pkg-config.
Sorry, you appear to be using both Homebrew and macports... I'm not sure that's a great idea. If you use homebrew, install pkgconfig
(brew install pkgconfig
).
PKG_CONFIG_PATH
is there for you to explicitly add additional search paths for pkgconfig files -- it's not typically set by the OS.
Where you get all this stuff... not sure what you mean, but I learned the majority of this building software in Linux. Fortunately much of it carries over to macOS. (though, not all... )
uberjay:
you appear to be using both Homebrew and macports... I'm not sure that's a great idea
Perhaps not. I have no idea. Both "Homebrew" and "macports" are barley more than just words to me at the moment. I gather they do something akin to apt, rpm, emerge, etc.
uberjay:
Where you get all this stuff... not sure what you mean, but I learned the majority of this building software in Linux
It's a long while since I did that much. Back in the days of tinkering with gentoo and Linix From Scratch at the turn of the century.
Seems I have some homework to do.
Fun fact:
Compile times (cargo build --release, from clean) for that project on various machines around here:
MacBook Pro M1, 16GB (2021) - 39 seconds.
PC Intel Core i7-2600K 3.4GHz, 8GB + Samsung SSD (2011) - 111 seconds.
MS Surface Pro 4, 8GB (2015) - 224 seconds.
Raspberry Pi 4, 8GB (2020) - 450 seconds.
Likely this M1 is the fastest machine I have ever owned
Thanks all.
ZiCog:
Now I don't recall why I put the "vendored" into my Cargo.toml in the first place. It was a while ago.
I used the “vendored” feature when using openssl crate on windows since it can be a hassle to get a crate to build across different Windows PC’s otherwise. If you primarily built this on Windows earlier that might be the reason
Btw, on Windows I had to use the openssl_probe crate as well to locate the root certificates.
Ah yes, Windows. That would be it. As far as I recall I never did get the thing to build on Windows. I gave up as it's not a platform we need to support and it builds and runs inside the WSL anyway.
I noticed that openssl_probe is pulled in. I have no specified it. I presume that is he nats crate which I use with TLS.
Thanks.
For future reference: When using open source libraries on Windows, if you want to stick to msvc, you'll probably want to use vcpkg. And if you use openssl:x64-windows-static-md
you'll get a static library which uses a dynamic CRT.
vcpkg has come a long way since the first time I tried to use it with Rust crates. It's a little peculiar in some ways, but I've been happy with it for the past couple of months.