Trying to install openssl on homebrew using:
brew install openssl
Is giving the following error during make:
clang -I. -Iinclude -fPIC -arch x86_64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/etc/[email protected]\"" -DENGINESDIR="\"/usr/local/Cellar/[email protected]/1.1.1l/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -MMD -MF crypto/rand/randfile.d.tmp -MT crypto/rand/randfile.o -c -o crypto/rand/randfile.o crypto/rand/randfile.c
In file included from crypto/rand/rand_unix.c:38:
/usr/include/CommonCrypto/CommonRandom.h:35:9: error: unknown type name 'CCCryptorStatus'
typedef CCCryptorStatus CCRNGStatus;
^
crypto/rand/rand_unix.c:385:47: error: use of undeclared identifier 'kCCSuccess'
if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
^
2 errors generated.
make[1]: *** [crypto/rand/rand_unix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
Do not report this issue to Homebrew/brew or Homebrew/core!
Brew is trying to install openssl 1.1.1l:
==> Downloading https://www.openssl.org/source/openssl-1.1.1l.tar.gz
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/b6ccc5a2a602c2af3480bbcf1656bd9844595974ba60501871ac12504508e818--openssl-1.1.1l.tar.gz
I need this dependency to install many other applications/tools, e.g., wget or python - and would like to use homebrew to do this.
The brew version I am using is:
Homebrew 3.2.9
Homebrew/homebrew-core (git revision fa395c6627; last commit 2021-08-27)
Homebrew/homebrew-cask (git revision 606ed52390; last commit 2021-08-27)
macOS is: 10.12.6 (Sierra) and I am using a MacBook Pro (13-inch, Early 2011)
Is there any way I can get around this issue to install openssl? Or anyway I can install python specifying a different openssl to use as a dependency?
I was able to install openssl 1.0 using the following brew command:
brew install rbenv/tap/[email protected]
However, python continually tries to use openssl 1.1.1l which is failing with the above error.
macOS has shipped with OpenSSL preinstalled since 2000. You can download a binary distribution of OpenSSL.
I managed to resolve it by editing formula (brew edit openssl
)
and adding
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
to args array in configure_args
.
As below:
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
no-ssl3
no-ssl3-method
no-zlib
##### add the line here ####
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
]
on_linux do
args += (ENV.cflags || "").split
args += (ENV.cppflags || "").split
args += (ENV.ldflags || "").split
args << "enable-md2"
end
args
end
I had to change the following file on Sierra (MacOs 10.12):
sudo chmod a+w /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h
vi /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h
I've added the following line before the typedef
statement:
#include "CommonCrypto/CommonCryptoError.h"
And also followed the advice of @Hulkur - run command:
brew edit openssl
and added
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
to args
array in configure_args
.
Seems a bug of openssl itself. https://github.com/openssl/openssl/issues/16487
~~What about export SDKROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk "
?~~
Homebrew pre-build packages for some versions of macOS. But it keep dropping this pre-building support for old macOS. On macOS 10.12, you're building openssl
from the source code and Xcode command line tool is needed.
xcode-select --install
Then brew install openssl
again.
First, to edit the file:
$ export EDITOR=nano
$ export VISUAL="$EDITOR"
then
brew edit openssl
After file open add the line -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
# help debug inevitable breakage.
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
no-ssl3
no-ssl3-method
no-zlib
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
]
on_linux do
args += (ENV.cflags || "").split
args += (ENV.cppflags || "").split
args += (ENV.ldflags || "").split
args << "enable-md2"
end
args
end
Save edition and install
brew install openssl
Notice: the installation took a long time, but it's worked.
I had the same issue in Mac Sierra 10.13.6 (17G14042)
brew install [email protected]
I have updated the openssl
brew edit openssl
add the line inside def configure_args
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
no-ssl3
no-ssl3-method
no-zlib
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
]
Run the below comment after this.
RUBY_CONFIGURE_OPTS="--disable-install-doc --with-openssl-dir=$(brew --prefix [email protected])" rbenv install 3.0.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With