jeroen / openssl

OpenSSL bindings for R
Other
63 stars 19 forks source link

Configure error on m1 MacBook Pro #91

Closed ywwry66 closed 2 years ago

ywwry66 commented 2 years ago

Hi, I just found that brew version of openssl on m1 Mac has the following symlink of its installation path:

/opt/homebrew/opt/openssl@1.1

while on Intel Mac the symlink is

/usr/local/opt/openssl

The extra @1.1 string makes configure unable to find header files.

I am not sure if I should report here or report to Homebrew. Thanks for maintaining this package.

jeroen commented 2 years ago

Why is it unable to find header files? If you have pkgconfig on your PATH, i.e. /opt/homebrew/bin or /usr/local/bin then it should find it.

ywwry66 commented 2 years ago

This is because brew does not symlink openssl.pc to /opt/homebrew/lib/pkgconfig (the default PKG_CONFIG_PATH). It will build if I set the variable manually with

Sys.setenv(PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig")
colinbrislawn commented 2 years ago

I'm getting this error as well, and it's a blocker for a couple other packages

Thanks for working on a fix!

jeroen commented 2 years ago

If you want to build against openssl 1.1 you do:

system("brew install openssl@1.1")
Sys.setenv(PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig")
install.packages("openssl")

If you want to build against openssl 3 you do:

system("brew install openssl")
Sys.setenv(PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig")
install.packages("openssl")
rundel commented 2 years ago

Currently the anticonf script suggests that brew install openssl@1.1 be used. If that is the only keg installed then the install fails due to:

tools/version.c:1:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.

However if openssl (i.e. openssl@3) is installed everything works as expected and the header is found - both are keg-only so not entirely sure why the latter is working. Is there a reason not to switch from openssl@1.1 to openssl in the configure script?

jeroen commented 2 years ago

Both are fine. Until recently openssl was an alias for openssl@1.1 but now they switched it to openssl@3. I'll update the configure script accordingly.