jeroen / openssl

OpenSSL bindings for R
Other
63 stars 19 forks source link

Unable to install openssl from source on M1 macbook #92

Closed can-taslicukur closed 2 years ago

can-taslicukur commented 2 years ago

When i try to install openssl by running install.packages("openssl") I get the following very long error.

installing the source package ‘openssl’

trying URL 'https://cran.rstudio.com/src/contrib/openssl_1.4.6.tar.gz'
Content type 'application/x-gzip' length 1198268 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
** using staged installation
Homebrew 3.3.8
Homebrew/homebrew-core (git revision aa7ddd3ecc7; last commit 2021-12-19)
Homebrew/homebrew-cask (git revision 31127b548e; last commit 2021-12-18)
Using PKG_CFLAGS=-I/usr/local/opt/openssl/include
Using PKG_LIBS=-L/usr/local/opt/openssl/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c aes.c -o aes.o
aes.c:40:39: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  unsigned char *buf = OPENSSL_malloc(outlen);
                       ~~~~~~~~~~~~~~~^~~~~~~
/usr/local/opt/openssl/include/openssl/crypto.h:96:23: note: expanded from macro 'OPENSSL_malloc'
        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
        ~~~~~~~~~~~~~ ^~~
aes.c:58:19: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
  int total = cur - buf;
      ~~~~~   ~~~~^~~~~
2 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c base64.c -o base64.o
base64.c:27:52: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  SET_STRING_ELT(out, 0, mkCharLen(buf->data, buf->length));
                         ~~~~~~~~~            ~~~~~^~~~~~
base64.c:43:31: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
  unsigned char *bin = malloc(len);
                       ~~~~~~ ^~~
2 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c bignum.c -o bignum.o
bignum.c:54:13: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  int res = BN_div_word(val, (BN_ULONG) INT_MAX + 1);
      ~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c cert.c -o cert.o
cert.c:30:45: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
  bail(X509_NAME_print_ex(b, name, 0, flags & ~ASN1_STRFLGS_ESC_MSB));
       ~~~~~~~~~~~~~~~~~~             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
cert.c:40:45: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
  bail(X509_NAME_print_ex(b, name, 0, flags & ~ASN1_STRFLGS_ESC_MSB));
       ~~~~~~~~~~~~~~~~~~             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
cert.c:51:20: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  OBJ_obj2txt(buf, sizeof(buf), sig_alg->algorithm, 0);
  ~~~~~~~~~~~      ^~~~~~~~~~~
3 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c compatibility.c -o compatibility.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c diffie.c -o diffie.o
diffie.c:31:34: warning: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'R_xlen_t' (aka 'long') [-Wsign-conversion]
  SEXP out = allocVector(RAWSXP, skeylen);
             ~~~~~~~~~~~         ^~~~~~~
1 warning generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c envelope.c -o envelope.o
envelope.c:33:44: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
  unsigned char *out = malloc(LENGTH(data) + 16);
                       ~~~~~~ ~~~~~~~~~~~~~^~~~
envelope.c:81:44: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
  unsigned char *out = malloc(LENGTH(data) + 16);
                       ~~~~~~ ~~~~~~~~~~~~~^~~~
2 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c error.c -o error.o
error.c:11:10: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  return len;
  ~~~~~~ ^~~
1 warning generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c hash.c -o hash.o
hash.c:21:24: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
    bail(EVP_Digest(x, len, md_value, &md_len, md, NULL));
         ~~~~~~~~~~    ^~~
hash.c:23:47: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
    bail(!!HMAC(md, RAW(key), LENGTH(key), x, len, md_value, &md_len));
           ~~~~                               ^~~
2 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c info.c -o info.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c keygen.c -o keygen.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c keys.c -o keys.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c onload.c -o onload.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c openssh.c -o openssh.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c password.c -o password.o
password.c:20:12: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
    return strlen(buf);
    ~~~~~~ ^~~~~~~~~~~
password.c:36:12: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
    return strlen(buf);
    ~~~~~~ ^~~~~~~~~~~
2 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c pbkdf.c -o pbkdf.o
pbkdf.c:14:42: warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion]
               RAW(key), Rf_length(key), Rf_asInteger(rounds)) != 0){
                                         ^~~~~~~~~~~~~~~~~~~~
pbkdf.c:14:26: warning: implicit conversion changes signedness: 'R_len_t' (aka 'int') to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
               RAW(key), Rf_length(key), Rf_asInteger(rounds)) != 0){
                         ^~~~~~~~~~~~~~
pbkdf.c:13:66: warning: implicit conversion changes signedness: 'R_len_t' (aka 'int') to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  if(bcrypt_pbkdf((char*) RAW(pass), Rf_length(pass), RAW(salt), Rf_length(salt),
     ~~~~~~~~~~~~                                                ^~~~~~~~~~~~~~~
pbkdf.c:13:38: warning: implicit conversion changes signedness: 'R_len_t' (aka 'int') to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  if(bcrypt_pbkdf((char*) RAW(pass), Rf_length(pass), RAW(salt), Rf_length(salt),
     ~~~~~~~~~~~~                    ^~~~~~~~~~~~~~~
4 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c pem.c -o pem.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c pkcs12.c -o pkcs12.o
pkcs12.c:79:40: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
    if(!PKCS12_verify_mac(p12, passwd, strlen(passwd)))
        ~~~~~~~~~~~~~~~~~              ^~~~~~~~~~~~~~
1 warning generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c pkcs7.c -o pkcs7.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c rand.c -o rand.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c rsa.c -o rsa.o
rsa.c:13:39: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  unsigned char* buf = OPENSSL_malloc(keysize);
                       ~~~~~~~~~~~~~~~^~~~~~~~
/usr/local/opt/openssl/include/openssl/crypto.h:96:23: note: expanded from macro 'OPENSSL_malloc'
        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
        ~~~~~~~~~~~~~ ^~~
rsa.c:28:39: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  unsigned char* buf = OPENSSL_malloc(keysize);
                       ~~~~~~~~~~~~~~~^~~~~~~~
/usr/local/opt/openssl/include/openssl/crypto.h:96:23: note: expanded from macro 'OPENSSL_malloc'
        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
        ~~~~~~~~~~~~~ ^~~
2 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c signing.c -o signing.o
signing.c:48:51: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  bail(EVP_PKEY_sign(ctx, NULL, &siglen, RAW(md), LENGTH(md)) > 0);
       ~~~~~~~~~~~~~                              ^~~~~~~~~~
signing.c:52:50: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  bail(EVP_PKEY_sign(ctx, sig, &siglen, RAW(md), LENGTH(md)) > 0);
       ~~~~~~~~~~~~~                             ^~~~~~~~~~
signing.c:55:34: warning: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'R_xlen_t' (aka 'long') [-Wsign-conversion]
  SEXP res = allocVector(RAWSXP, siglen);
             ~~~~~~~~~~~         ^~~~~~
signing.c:72:66: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  int res = EVP_PKEY_verify(ctx, RAW(sig), LENGTH(sig), RAW(md), LENGTH(md));
            ~~~~~~~~~~~~~~~                                      ^~~~~~~~~~
signing.c:72:44: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  int res = EVP_PKEY_verify(ctx, RAW(sig), LENGTH(sig), RAW(md), LENGTH(md));
            ~~~~~~~~~~~~~~~                ^~~~~~~~~~~
5 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c ssl.c -o ssl.o
ssl.c:128:44: warning: implicit conversion changes signedness: 'int' to 'socklen_t' (aka 'unsigned int') [-Wsign-conversion]
  int err = connect(sockfd, addr->ai_addr, (int)addr->ai_addrlen);
            ~~~~~~~                        ^~~~~~~~~~~~~~~~~~~~~
ssl.c:161:8: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
  bail(SSL_set_tlsext_host_name(ssl, CHAR(STRING_ELT(hostname, 0))));
  ~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/opt/openssl/include/openssl/tls1.h:260:9: note: expanded from macro 'SSL_set_tlsext_host_name'
        SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,\
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c stream.c -o stream.o
stream.c:33:38: warning: implicit conversion changes signedness: 'R_len_t' (aka 'int') to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  EVP_DigestUpdate(mdctx, RAW(data), length(data));
  ~~~~~~~~~~~~~~~~                   ^~~~~~~~~~~~
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:1631:20: note: expanded from macro 'length'
#define length(x)               Rf_length(x)
                                ^~~~~~~~~~~~
stream.c:85:36: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  bail(HMAC_Update(ctx, RAW(data), LENGTH(data)));
       ~~~~~~~~~~~                 ^~~~~~~~~~~~
2 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c write.c -o write.o
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c x25519.c -o x25519.o
x25519.c:15:69: warning: implicit conversion changes signedness: 'R_len_t' (aka 'int') to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  EVP_PKEY *pkey = EVP_PKEY_new_raw_private_key(type, NULL, RAW(x), Rf_length(x));
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                     ^~~~~~~~~~~~
x25519.c:32:68: warning: implicit conversion changes signedness: 'R_len_t' (aka 'int') to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  EVP_PKEY *pkey = EVP_PKEY_new_raw_public_key(type, NULL, RAW(x), Rf_length(x));
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~                     ^~~~~~~~~~~~
x25519.c:85:37: warning: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'R_xlen_t' (aka 'long') [-Wsign-conversion]
  SEXP res = Rf_allocVector(RAWSXP, len);
             ~~~~~~~~~~~~~~         ^~~
x25519.c:100:37: warning: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'R_xlen_t' (aka 'long') [-Wsign-conversion]
  SEXP res = Rf_allocVector(RAWSXP, len);
             ~~~~~~~~~~~~~~         ^~~
x25519.c:118:54: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  bail(EVP_DigestSign(ctx, NULL, &siglen, RAW(data), LENGTH(data)) > 0);
       ~~~~~~~~~~~~~~                                ^~~~~~~~~~~~
x25519.c:119:34: warning: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'R_xlen_t' (aka 'long') [-Wsign-conversion]
  SEXP res = allocVector(RAWSXP, siglen);
             ~~~~~~~~~~~         ^~~~~~
x25519.c:120:58: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  bail(EVP_DigestSign(ctx, RAW(res), &siglen, RAW(data), LENGTH(data)) > 0);
       ~~~~~~~~~~~~~~                                    ^~~~~~~~~~~~
x25519.c:137:72: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  int res = EVP_DigestVerify(ctx, RAW(sig), Rf_length(sig), RAW(data), LENGTH(data));
            ~~~~~~~~~~~~~~~~                                           ^~~~~~~~~~~~
x25519.c:137:45: warning: implicit conversion changes signedness: 'R_len_t' (aka 'int') to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
  int res = EVP_DigestVerify(ctx, RAW(sig), Rf_length(sig), RAW(data), LENGTH(data));
            ~~~~~~~~~~~~~~~~                ^~~~~~~~~~~~~~
9 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c bcrypt/bcrypt_pbkdf.c -o bcrypt/bcrypt_pbkdf.o
bcrypt/bcrypt_pbkdf.c:67:59: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'u_int16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
        Blowfish_expandstate(&state, sha2salt, shalen, sha2pass, shalen);
        ~~~~~~~~~~~~~~~~~~~~                                     ^~~~~~
bcrypt/bcrypt_pbkdf.c:67:41: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'u_int16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
        Blowfish_expandstate(&state, sha2salt, shalen, sha2pass, shalen);
        ~~~~~~~~~~~~~~~~~~~~                   ^~~~~~
bcrypt/bcrypt_pbkdf.c:69:43: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'u_int16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
                Blowfish_expand0state(&state, sha2salt, shalen);
                ~~~~~~~~~~~~~~~~~~~~~                   ^~~~~~
bcrypt/bcrypt_pbkdf.c:70:43: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'u_int16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
                Blowfish_expand0state(&state, sha2pass, shalen);
                ~~~~~~~~~~~~~~~~~~~~~                   ^~~~~~
4 warnings generated.
gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c bcrypt/blowfish.c -o bcrypt/blowfish.o
bcrypt/blowfish.c:534:52: warning: implicit conversion changes signedness: 'int' to 'u_int32_t' (aka 'unsigned int') [-Wsign-conversion]
                l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
                  ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
bcrypt/blowfish.c:535:52: warning: implicit conversion changes signedness: 'int' to 'u_int32_t' (aka 'unsigned int') [-Wsign-conversion]
                r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7];
                  ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
bcrypt/blowfish.c:556:52: warning: implicit conversion changes signedness: 'int' to 'u_int32_t' (aka 'unsigned int') [-Wsign-conversion]
                l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
                  ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
bcrypt/blowfish.c:557:52: warning: implicit conversion changes signedness: 'int' to 'u_int32_t' (aka 'unsigned int') [-Wsign-conversion]
                r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7];
                  ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
bcrypt/blowfish.c:580:52: warning: implicit conversion changes signedness: 'int' to 'u_int32_t' (aka 'unsigned int') [-Wsign-conversion]
                l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
                  ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
bcrypt/blowfish.c:581:52: warning: implicit conversion changes signedness: 'int' to 'u_int32_t' (aka 'unsigned int') [-Wsign-conversion]
                r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7];
                  ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
bcrypt/blowfish.c:606:52: warning: implicit conversion changes signedness: 'int' to 'u_int32_t' (aka 'unsigned int') [-Wsign-conversion]
                l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
                  ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
bcrypt/blowfish.c:607:52: warning: implicit conversion changes signedness: 'int' to 'u_int32_t' (aka 'unsigned int') [-Wsign-conversion]
                r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7];
                  ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
bcrypt/blowfish.c:622:51: warning: implicit conversion changes signedness: 'int' to 'u_int32_t' (aka 'unsigned int') [-Wsign-conversion]
        l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
          ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
bcrypt/blowfish.c:623:51: warning: implicit conversion changes signedness: 'int' to 'u_int32_t' (aka 'unsigned int') [-Wsign-conversion]
        r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7];
          ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
10 warnings generated.
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@3/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 -lssl -lcrypto -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: ignoring file /usr/local/opt/openssl@3/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@3/lib/libcrypto.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
installing to /Library/Frameworks/R.framework/Versions/4.1-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.1-arm64/Resources/library/00LOCK-openssl/00new/openssl/libs/openssl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/00LOCK-openssl/00new/openssl/libs/openssl.so, 0x0006): symbol not found in flat namespace '_PKCS12_SAFEBAG_free'
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/openssl’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/openssl’
Warning in install.packages :
  installation of package ‘openssl’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/_s/qsy2b8t94hg5jntzxqx9h20h0000gn/T/RtmpBwyYiV/downloaded_packages’

I have already installed openssl via homebrew using brew install openssl and added the following lines to Makevars LDFLAGS=-L/usr/local/opt/openssl@3/lib CPPFLAGS=-I/usr/local/opt/openssl@3/include

This is the Makevars file that i currently have.

CC=gcc
CXX=g++
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
FLIBS=-L/usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11
LDFLAGS=-L/usr/local/opt/openssl@3/lib
CPPFLAGS=-I/usr/local/opt/openssl@3/include

I have no idea what error is telling me, i think i have problems with both gcc and openssl

Edit : Removing CFLAGS and CXXFLAGS lines from Makevars returns different error

installing the source package ‘openssl’

trying URL 'https://cran.rstudio.com/src/contrib/openssl_1.4.6.tar.gz'
Content type 'application/x-gzip' length 1198268 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
** using staged installation
Homebrew 3.3.8
Homebrew/homebrew-core (git revision aa7ddd3ecc7; last commit 2021-12-19)
Homebrew/homebrew-cask (git revision 31127b548e; last commit 2021-12-18)
Using PKG_CFLAGS=-I/usr/local/opt/openssl/include
Using PKG_LIBS=-L/usr/local/opt/openssl/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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 -DOPENSSL_SUPPRESS_DEPRECATED  -I/usr/local/opt/openssl@3/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@3/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 -lssl -lcrypto -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: ignoring file /usr/local/opt/openssl@3/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@3/lib/libcrypto.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
installing to /Library/Frameworks/R.framework/Versions/4.1-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.1-arm64/Resources/library/00LOCK-openssl/00new/openssl/libs/openssl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/00LOCK-openssl/00new/openssl/libs/openssl.so, 0x0006): symbol not found in flat namespace '_PKCS12_SAFEBAG_free'
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/openssl’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/openssl’
Warning in install.packages :
  installation of package ‘openssl’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/_s/qsy2b8t94hg5jntzxqx9h20h0000gn/T/RtmpJKeUMJ/downloaded_packages’
jeroen commented 2 years ago

I think you have the wrong homebrew installed on your machine. It looks like you have intel homebrew; you need the M1 homebrew, which lives in /opt/homebrew/bin and not /usr/local.