jeroen / openssl

OpenSSL bindings for R
Other
63 stars 19 forks source link

Openssl install failure on MacOS Monterey M1 (arm64) for R 4.2.0 ("Vigorous Calisthenics") #101

Open cmhatche23 opened 2 years ago

cmhatche23 commented 2 years ago

Hi,

I recently upgraded my R version to the latest release (4.2.0, 2022-04-22). I am receiving this error message when installing openssl package. I have tried installing from both CRAN and GitHub:

R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> devtools::install_github("jeroen/openssl")
Downloading GitHub repo jeroen/openssl@HEAD
✔  checking for file ‘/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpjQXYpT/remotes1311770b98515/jeroen-openssl-47bf18b/DESCRIPTION’ ...
─  preparing ‘openssl’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  running ‘cleanup’
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘openssl_2.0.1.tar.gz’

* installing *source* package ‘openssl’ ...
** using staged installation
Using PKG_CFLAGS=-I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include
Using PKG_LIBS=-L/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/lib -lssl -lcrypto
** libs
rm -f aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pbkdf.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o x25519.o openssl.so bcrypt/libstatbcrypt.a bcrypt/bcrypt_pbkdf.o bcrypt/blowfish.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c aes.c -o aes.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c base64.c -o base64.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c bignum.c -o bignum.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c cert.c -o cert.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c compatibility.c -o compatibility.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c diffie.c -o diffie.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c envelope.c -o envelope.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c error.c -o error.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c hash.c -o hash.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c info.c -o info.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c keygen.c -o keygen.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c keys.c -o keys.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c onload.c -o onload.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c openssh.c -o openssh.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c password.c -o password.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c pbkdf.c -o pbkdf.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c pem.c -o pem.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c pkcs12.c -o pkcs12.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c pkcs7.c -o pkcs7.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c rand.c -o rand.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c rsa.c -o rsa.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c signing.c -o signing.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c ssl.c -o ssl.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c stream.c -o stream.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c write.c -o write.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c x25519.c -o x25519.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c bcrypt/bcrypt_pbkdf.c -o bcrypt/bcrypt_pbkdf.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c bcrypt/blowfish.c -o bcrypt/blowfish.o
ar rcs bcrypt/libstatbcrypt.a bcrypt/bcrypt_pbkdf.o bcrypt/blowfish.o
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/opt/openssl@1.1/lib -o openssl.so aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pbkdf.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o x25519.o -Lbcrypt -lstatbcrypt -L/private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/lib -lssl -lcrypto -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/opt/openssl@1.1/lib'
ld: warning: ignoring file /private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/lib/libcrypto.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /private/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T/RtmpOrSTix/R.INSTALL131a33d271a4b/openssl/.deps/lib/libssl.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
installing to /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-openssl/00new/openssl/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘openssl’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-openssl/00new/openssl/libs/openssl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-openssl/00new/openssl/libs/openssl.so, 0x0006): symbol not found in flat namespace '_ASN1_STRING_to_UTF8'
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/openssl’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/5d/z3_6_g1d6d91v4ppjkh4ldnh0000gn/T//RtmpjQXYpT/file13117452ee57a/openssl_2.0.1.tar.gz’ had non-zero exit status

Current session Info:

> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.3.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] rstudioapi_0.13   magrittr_2.0.3    usethis_2.1.5     devtools_2.4.3    pkgload_1.2.4     R6_2.5.1         
 [7] rlang_1.0.2       fastmap_1.1.0     tools_4.2.0       pkgbuild_1.3.1    sessioninfo_1.2.2 cli_3.3.0        
[13] withr_2.5.0       ellipsis_0.3.2    remotes_2.4.2     rprojroot_2.0.3   lifecycle_1.0.1   crayon_1.5.1     
[19] brio_1.1.3        processx_3.5.3    purrr_0.3.4       callr_3.7.0       fs_1.5.2          ps_1.7.0         
[25] curl_4.3.2        testthat_3.1.4    memoise_2.0.1     glue_1.6.2        cachem_1.0.6      compiler_4.2.0   
[31] desc_1.4.1        prettyunits_1.1.1

I have openssl@1.1 installed on my machine with homebrew, with the following configurations in my ~/.zshrc file:

### openssl:
path+=("/opt/homebrew/opt/openssl@1.1/bin")
#path+=("/opt/homebrew/opt/openssl@3/bin")
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
#export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
export LD_LIBRARY_PATH="/opt/homebrew/opt/openssl@1.1/lib"
# export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/homebrew/opt/openssl@1.1"

Any ideas? I noticed the issue about a week after downloading and installing the new R version when I tried using the googlesheets4 package.

jeroen commented 2 years ago

That is certainly wierd. What do you get for these in your shell:

arch

which pkg-config

pkg-config --modversion libssl
cmhatche23 commented 2 years ago

@jeroen

Here is what I get from each of those commands:

❯ arch                                                                               ─╯
arm64
❯ which pkg-config                                                                   ─╯
/opt/homebrew/bin/pkg-config
pkg-config --modversion libssl                                                     ─╯
1.1.1o

Thanks in advance.

michalovadek commented 2 years ago

hi, not sure whether this is related but perhaps might be.

R-CMD-CHECK for my package is failing due to openssl not building from source on windows-latest. Log from Github Actions:

Error: Error: <callr_remote_error: Failed to build source package 'openssl'>
   in process 6552 
  -->
  Failed to build source package 'openssl', stdout + stderr:

  OE> * installing *source* package 'openssl' ...
  OE> ** package 'openssl' successfully unpacked and MD5 sums checked
  OE> staged installation is only possible with locking
  OE> ** using non-staged installation
  OE> ** libs
  OE> "C:/R/bin/x64/Rscript.exe" "../tools/winlibs.R" 1.1.1k
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c aes.c -o aes.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c base64.c -o base64.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c bignum.c -o bignum.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c cert.c -o cert.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c compatibility.c -o compatibility.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c diffie.c -o diffie.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c envelope.c -o envelope.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c error.c -o error.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c hash.c -o hash.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c info.c -o info.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c keygen.c -o keygen.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c keys.c -o keys.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c onload.c -o onload.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c openssh.c -o openssh.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c password.c -o password.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c pbkdf.c -o pbkdf.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c pem.c -o pem.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c pkcs12.c -o pkcs12.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c pkcs7.c -o pkcs7.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c rand.c -o rand.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c rsa.c -o rsa.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c signing.c -o signing.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c ssl.c -o ssl.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c stream.c -o stream.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c write.c -o write.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c x25519.c -o x25519.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c bcrypt/bcrypt_pbkdf.c -o bcrypt/bcrypt_pbkdf.o
  OE> gcc  -I"C:/R/include" -DNDEBUG -I../windows/openssl-1.1.1k/include    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -c bcrypt/blowfish.c -o bcrypt/blowfish.o
  OE> ar rcs bcrypt/libstatbcrypt.a bcrypt/bcrypt_pbkdf.o bcrypt/blowfish.o
  OE> gcc -shared -s -static-libgcc -o openssl.dll tmp.def aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pbkdf.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o x25519.o -Lbcrypt -lstatbcrypt -L../windows/openssl-1.1.1k/lib/x64-ucrt -lssl -lcrypto -lws2_32 -lgdi32 -lcrypt32 -Lc:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -Lc:/rtools42/x86_64-w64-mingw32.static.posix/lib -LC:/R/bin/x64 -lR
  OE> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/openssl-1.1.1k/lib/x64-ucrt/libcrypto.a(v3_utl.o):(.text+0xd2a): undefined reference to `__stdio_common_vsscanf'
  OE> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/openssl-1.1.1k/lib/x64-ucrt/libcrypto.a(e_capi.o):(.text+0x3700): undefined reference to `__imp___acrt_iob_func'
  OE> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/openssl-1.1.1k/lib/x64-ucrt/libcrypto.a(eng_openssl.o):(.text+0x12): undefined reference to `__imp___acrt_iob_func'
  OE> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/openssl-1.1.1k/lib/x64-ucrt/libcrypto.a(eng_openssl.o):(.text+0x266): undefined reference to `__imp___acrt_iob_func'
  OE> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/openssl-1.1.1k/lib/x64-ucrt/libcrypto.a(ui_openssl.o):(.text+0x19): undefined reference to `__imp___acrt_iob_func'
  OE> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/openssl-1.1.1k/lib/x64-ucrt/libcrypto.a(ui_openssl.o):(.text+0x174): undefined reference to `__imp___acrt_iob_func'
  OE> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/openssl-1.1.1k/lib/x64-ucrt/libcrypto.a(ui_openssl.o):(.text+0x197): more undefined references to `__imp___acrt_iob_func' follow
  OE> collect2.exe: error: ld returned 1 exit status
  OE> no DLL was created
  OE> ERROR: compilation failed for package 'openssl'
  OE> * removing 'C:/Users/RUNNER~1/AppData/Local/Temp/Rtmp2FMxQh/pkg-lib19982ffe7cb3/openssl'

   Stack trace:

   12. (function (...)  ...
   13. base:::withCallingHandlers(cli_message = function(msg) { ...
   14. get("pkg_install_do_plan", asNamespace("pak"))(...)
   15. pkgdepends::install_package_plan(plan = plan, lib = lib, num_workers = num_ ...
   16. base:::withCallingHandlers({ ...
   17. pkgdepends:::handle_events(state, events)
   18. pkgdepends:::handle_event(state, i)
   19. pkgdepends:::stop_task(state, worker)
   20. pkgdepends:::stop_task_build(state, worker)
   21. base:::throw(new_pkg_build_error("Failed to build source package {pkg}",  ...
   22. base:::signalCondition(cond)
   23. (function (e)  ...
   24. base:::stop(e)
   25. (function (e)  ...

   x Failed to build source package 'openssl'
can-taslicukur commented 1 year ago

I have the same problem for MacOS Ventura M1 (arm64) R 4.2.2 I installed openssl@1.1 via homebrew and have tried exporting PKG_CONFIG_PATH. This is what I get when I try to install openssl with renv.

> install.packages("openssl")
Retrieving 'https://packagemanager.rstudio.com/all/latest/src/contrib/openssl_2.0.4.tar.gz' ...
    OK [file is up to date]
Installing openssl [2.0.4] ...
    FAILED
Error installing package 'openssl':
===================================
* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
** using staged installation
Homebrew 3.6.14
Homebrew/homebrew-core (git revision d7bde1056b7; last commit 2022-12-07)
Homebrew/homebrew-cask (git revision 6fb50d235a; last commit 2022-12-07)
Using PKG_CFLAGS=-I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include
Using PKG_LIBS=-L/usr/local/opt/openssl/lib -L/usr/local/opt/openssl@1.1/lib -lssl -lcrypto
** libs
rm -f aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pbkdf.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o x25519.o openssl.so bcrypt/libstatbcrypt.a bcrypt/bcrypt_pbkdf.o bcrypt/blowfish.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c aes.c -o aes.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c base64.c -o base64.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c bignum.c -o bignum.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c cert.c -o cert.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c compatibility.c -o compatibility.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c diffie.c -o diffie.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c envelope.c -o envelope.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c error.c -o error.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c hash.c -o hash.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c info.c -o info.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c keygen.c -o keygen.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c keys.c -o keys.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c onload.c -o onload.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c openssh.c -o openssh.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c password.c -o password.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c pbkdf.c -o pbkdf.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c pem.c -o pem.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c pkcs12.c -o pkcs12.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c pkcs7.c -o pkcs7.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c rand.c -o rand.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c rsa.c -o rsa.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c signing.c -o signing.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c ssl.c -o ssl.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c stream.c -o stream.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c write.c -o write.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c x25519.c -o x25519.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c bcrypt/bcrypt_pbkdf.c -o bcrypt/bcrypt_pbkdf.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl@1.1/include  -I/usr/local/opt/openssl@1.1/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c bcrypt/blowfish.c -o bcrypt/blowfish.o
ar rcs bcrypt/libstatbcrypt.a bcrypt/bcrypt_pbkdf.o bcrypt/blowfish.o
gcc -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/opt/openssl@1.1/lib -o openssl.so aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pbkdf.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o x25519.o -Lbcrypt -lstatbcrypt -L/usr/local/opt/openssl/lib -L/usr/local/opt/openssl@1.1/lib -lssl -lcrypto -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib'
ld: warning: -undefined dynamic_lookup may not work with chained fixups
ld: warning: ignoring file /usr/local/opt/openssl@1.1/lib/libssl.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/opt/openssl@1.1/lib/libcrypto.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
installing to /Users/ege/Documents/rhino-showcase/renv/staging/1/00LOCK-openssl/00new/openssl/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘openssl’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/ege/Documents/rhino-showcase/renv/staging/1/00LOCK-openssl/00new/openssl/libs/openssl.so':
  dlopen(/Users/ege/Documents/rhino-showcase/renv/staging/1/00LOCK-openssl/00new/openssl/libs/openssl.so, 0x0006): symbol not found in flat namespace '_ASN1_STRING_to_UTF8'
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/ege/Documents/rhino-showcase/renv/staging/1/openssl’
Error: install of package 'openssl' failed [error code 1]
Traceback (most recent calls last):
12: install.packages("openssl")
11: install(pkgs)
10: renv_install_impl(records)
 9: renv_install_staged(records)
 8: renv_install_default(records)
 7: handler(package, renv_install_package(record))
 6: renv_install_package(record)
 5: withCallingHandlers(renv_install_package_impl(record), error = function(e) {
        vwritef("\tFAILED")
        writef(e$output)
    })
 4: renv_install_package_impl(record)
 3: r_cmd_install(package, path)
 2: r_exec_error(package, output, "install", status)
 1: stop(error)
can-taslicukur commented 1 year ago

To follow up on my previous comment, the problem was that my homebrew was installed /usr/local instead of /opt/homebrew/bin so reinstalling homebrew and installing openssl from the new installed version solved the issue