macOS 10.12 brew install openssl issue - macos

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/openssl#1.1\"" -DENGINESDIR="\"/usr/local/Cellar/openssl#1.1/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/openssl#1.0
However, python continually tries to use openssl 1.1.1l which is failing with the above error.

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.

I had the same issue in Mac Sierra 10.13.6 (17G14042)
brew install openssl#1.1
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 openssl#1.1)" rbenv install 3.0.2

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.

After brew edit openssl, I end up with a new error:
=> perl ./Configure --prefix=/usr/local/Cellar/openssl#1.1/1.1.1l --openssldir=/usr/local/etc/openssl#1.1 no-ssl3 no-ssl3-method no-zlib -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include darwin64-x86_64-cc enable-ec_nistp_64_gcc_128
==> make
Last 15 lines from /Users/francis/Library/Logs/Homebrew/openssl#1.1/02.make:
include "CommonCrypto/CommonCryptoError.h"
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h:35:9: error: expected identifier or '('
include "CommonCrypto/CommonCryptoError.h"
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h:52:1: error: unknown type name 'CCRNGStatus'
CCRNGStatus CCRandomGenerateBytes(void *bytes, size_t count)
^
crypto/rand/rand_unix.c:385:47: error: use of undeclared identifier 'kCCSuccess'
if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
^
4 errors generated.
make[1]: *** [crypto/rand/rand_unix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
Edit
Silly me, I had:
include "CommonCrypto/CommonCryptoError.h"
Instead of
#include "CommonCrypto/CommonCryptoError.h"
So make sure you have a hash first.

This issue has now been resolved (since 9/11/2021) and patches are no longer required

For MacOS prior to 10.12 (e.g. 10.11 El Capitan) there is another issue - test failure:
Test Summary Report
-------------------
../test/recipes/05-test_rand.t (Wstat: 256 Tests: 2 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=1, Tests=2, 5 wallclock secs ( 0.38 usr 0.06 sys + 5.71 cusr 2.48 csys = 8.63 CPU)
Result: FAIL
make[1]: *** [_tests] Error 1
make: *** [tests] Error 2
There is an issue and a pull request for OpenSSL that is open to fix this:
https://github.com/openssl/openssl/issues/16517
https://github.com/openssl/openssl/pull/16587
If you have this issue go over and vote for them

Related

perl5 macos Regexp::Grammars install dies on B::Hooks::Parser

I am trying to install Damian Conway's cpan Regexp::Grammars on macos. I made sure to install Xcode (gcc, clang), first ran 'capn upgrade' on the macos perl (which is now 5.30.3), and then tried the naive 'install Regexp::Grammars'. Alas,
cpan[2]> install B::Hooks::Parser
Running install for module 'B::Hooks::Parser'
ETHER/B-Hooks-Parser-0.21.tar.gz
Has already been unwrapped into directory /Users/me/.cpan/build/B-Hooks-Parser-0.21-0
ETHER/B-Hooks-Parser-0.21.tar.gz
Has already been prepared
ETHER/B-Hooks-Parser-0.21.tar.gz
Could not make: Unknown error
which appeared after
...many more
cp lib/B/Hooks/Parser.pm blib/lib/B/Hooks/Parser.pm
cp hook_parser.h blib/arch/B/Hooks/Parser/Install/hook_parser.h
Running Mkbootstrap for Parser ()
chmod 644 "Parser.bs"
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Parser.bs blib/arch/auto/B/Hooks/Parser/Parser.bs 644
"/usr/bin/perl" "/System/Library/Perl/5.30/ExtUtils/xsubpp" -typemap '/System/Library/Perl/5.30/ExtUtils/typemap' Parser.xs > Parser.xsc
mv Parser.xsc Parser.c
cc -c -I/System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/B/Hooks/OP/Check/Install -g -pipe -DPERL_USE_SAFE_PUTENV -Wno-error=implicit-function-declaration -Os -DVERSION=\"0.21\" -DXS_VERSION=\"0.21\" -iwithsysroot "/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE" Parser.c
In file included from Parser.xs:16:
./hook_parser.h:5:10: fatal error: 'hook_op_check.h' file not found
#include "hook_op_check.h"
^~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Parser.o] Error 1
ETHER/B-Hooks-Parser-0.21.tar.gz
/usr/bin/make -- NOT OK
... many more
and it failed to install Regexp::Grammars . Regexp::Grammars does seem to install on linux. easy or hard fix?

ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects In Mac M1

I`m using MacBook with M1 chip and seems like multiple things arent optimised for it.
pyodbc didnt work for me, so I wanted to use pymssql.
Though, I encountered this issue when I tried to run pip install pymssql.
The error is as below.
Using cached pymssql-2.2.2.tar.gz (170 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pymssql
Building wheel for pymssql (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
Your project path and someinfo about it.
Complete output (25 lines):
setup.py: platform.system() => Darwin
setup.py: platform.architecture() => ('64bit', '')
setup.py: platform.libc_ver() => ('', '')
setup.py: include_dirs => []
setup.py: library_dirs => []
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-3.9
creating build/lib.macosx-10.9-universal2-3.9/pymssql
copying src/pymssql/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pymssql
running build_ext
cythoning src/pymssql/_mssql.pyx to src/pymssql/_mssql.c
cythoning src/pymssql/_pymssql.pyx to src/pymssql/_pymssql.c
building 'pymssql._mssql' extension
creating build/temp.macosx-10.9-universal2-3.9
creating build/temp.macosx-10.9-universal2-3.9/src
creating build/temp.macosx-10.9-universal2-3.9/src/pymssql
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/lakshayrohilla/SMS Project Files /cracs-backend/.venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/pymssql/_mssql.c -o build/temp.macosx-10.9-universal2-3.9/src/pymssql/_mssql.o -DMSDBLIB
src/pymssql/_mssql.c:682:10: fatal error: 'sqlfront.h' file not found
#include "sqlfront.h"
^~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
**ERROR: Failed building wheel for pymssql**
Failed to build pymssql
**ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects**
On trying loads of solutions for fixing this issue, Seems like something worked out for me.
I`m providing the code below for solving this issue.
Important Note:
Change the path as per your system.
1. brew install freetds
2. brew install openssl
3. export LDFLAGS="-L/opt/homebrew/Cellar/freetds/1.3.3/lib -L/opt/homebrew/Cellar/openssl#1.1/1.1.1l_1/lib"
4. export CFLAGS="-I/opt/homebrew/Cellar/freetds/1.3.3/include"
5. pip install pymssql
Just run the above commands & it should solve your issue, as it worked out for me.
Running the following commands fixed my issue
$ brew install freetds openssl
$ echo 'export LDFLAGS="-L/opt/homebrew/opt/freetds/lib -L/opt/homebrew/opt/openssl#3/lib"' >> ~/.zshrc
$ echo 'export CFLAGS="-I/opt/homebrew/opt/freetds/include"' >> ~/.zshrc
$ echo 'export CPPFLAGS="-I/opt/homebrew/opt/openssl#3/include"' >> ~/.zshrc
$ source ~/.zshrc
$ pip3 install pymssql

Error installing devtools, dplyr,ggplot2 on R-devel 3.4.0 on Windows

I will submitting my package to CRAN. I have already built with R 3.2.4 and I now am trying to build on R-devel 3.4.0 before submitting to CRAN as required. I am having problems installing packages. I have installed Rtools33.exe for Windows. But I get an errors when installing the following packages - devtools, dplyr, ggplot2 etc. Here are the errors for devtools
> install.packages("devtools")
also installing the dependencies ‘mime’, ‘openssl’, ‘httr’, ‘memoise’, ‘digest’, ‘jsonlite’, ‘git2r’
* installing *source* package 'mime' ...
** package 'mime' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
d:/Compiler/gcc-4.9.3/mingw_32/bin/gcc -I"C:/software/R/R- DEVE~1/include" -DNDEBUG -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -Wall -std=gnu99 -mtune=core2 -c rawmatch.c -o rawmatch.o
d:/Compiler/gcc-4.9.3/mingw_32/bin/gcc: not found
make: *** [rawmatch.o] Error 127
Warning: running command 'make -f "C:/software/R/R-DEVE~1/etc/i386/Makeconf" -f "C:/software/R/R-DEVE~1/share/make/winshlib.mk" SHLIB="mime.dll" OBJECTS="rawmatch.o"' had status 2
ERROR: compilation failed for package 'mime'
* removing 'C:/software/R/R-devel-Mar30/library/mime'
Warning in install.packages :
running command '"C:/software/R/R-DEVE~1/bin/x64/R" CMD INSTALL -l "C:\software\R\R-devel-Mar30\library" C:\Users\Ganesh\AppData\Local\Temp\Rtmpq4DzNw/downloaded_packages/mime_0.4.tar.gz' had status 1
Warning in install.packages :
installation of package ‘mime’ had non-zero exit status
* installing *source* package 'openssl' ...
** package 'openssl' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
"C:/software/R/R-DEVE~1/bin/i386/Rscript.exe" "../tools/winlibs.R"
d:/Compiler/gcc-4.9.3/mingw_32/bin/gcc -I"C:/software/R/R-DEVE~1/include" -DNDEBUG -I../windows/openssl-1.0.2d/include -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -Wall -std=gnu99 -mtune=core2 -c win32/ipv6.c -o win32/ipv6.o
d:/Compiler/gcc-4.9.3/mingw_32/bin/gcc: not found
make: *** [win32/ipv6.o] Error 127
Warning: running command 'make -f "Makevars.win" -f "C:/software/R/R- DEVE~1/etc/i386/Makeconf" -f "C:/software/R/R-DEVE~1/share/make/winshlib.mk" SHLIB="openssl.dll" OBJECTS="aes.o base64.o bignum.o cert.o envelope.o error.o hash.o info.o keygen.o onload.o openssh.o rand.o read.o rsa.o signing.o ssl.o stream.o write.o"' had status 2
ERROR: compilation failed for package 'openssl'
* removing 'C:/software/R/R-devel-Mar30/library/openssl'
Warning in install.packages :
running command '"C:/software/R/R-DEVE~1/bin/x64/R" CMD INSTALL -l "C:\software\R\R-devel-Mar30\library" C:\Users\Ganesh\AppData\Local\Temp\Rtmpq4DzNw/downloaded_packages/openssl_0.9.2.tar.gz' had status 1
Warning in install.packages :
installation of package ‘openssl’ had non-zero exit status
* installing *source* package 'digest' ...
** package 'digest' successfully unpacked and MD5 sums checked
** libs
Similar errors regarding gcc occurs. Please let me know what needs to be done
Since R 3.4.0 is still in early development stages the errors are expected. This is the response I got from CRAN. As of now we need to build on a more stable R 3.3.0

Binutils build fails on Mac OS X 10.10.5 Yosemite

After downloading the package of GNU Binutils 2.25
I followed the instructions on "Installing Binutils":
./cnofigure
make
errors happened after build:
../../binutils-gdb/binutils/nm.c:1733:28: error: 'sbrk' is deprecated [-Werror,-Wdeprecated-declarations]
char *lim = (char *) sbrk (0);
/usr/include/unistd.h:582:7: note: 'sbrk' has been explicitly marked deprecated here
void *sbrk(int);
1 error generated.
make[4]: *** [nm.o] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-binutils] Error 2
make: *** [all] Error 2
I did some research on net and they said using this command
./configure --prefix=/usr --disable-werror
and I get
/Library/Developer/CommandLineTools/usr/bin/make all-recursive
make[8]: Nothing to be done for 'all-am'.
make[1]: Nothing to be done for 'all-target'.
(what does that mean "nothing to be done for all-am and all-target")
I don't know what to do anymore.
Is it a bug or it's me doing something wrong?
Please help.
You really would make life easier for yourself if you used homebrew as a package manager on OSX.
Goto the homebrew website and copy and paste the one-line install script into your Terminal.
Then you can install binutils simply by typing
brew install binutils
If, down the line, you want to find GNU sed, or ImageMagick, you can just do
brew search sed
or
brew search imagemagick
then
brew install sed
If you have any problems, just run
brew doctor
If you want to update all your packages, just run
brew update
brew upgrade --all
More cool ideas and suggestions here.
After build failure , you should clean previously generated object files
So,
make clean
./configure --prefix=/usr --disable-werror
make

compile Ruby 2.0 errors without rvm or rbenv , `readline.c:1886:26: error: 'Function' undeclared (first use in this function)`

I want to install gitlab, which don't recommend to use any ruby version manager.
But
This is my OS Linux dqa-dev 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:08:14 UTC 2014 i686 i686 i686 GNU/Linux
linking shared-object psych.so
installing default psych libraries
make[2]: Leaving directory `/home/poc/ruby-2.0.0-p451/ext/psych'
make[2]: Entering directory `/home/poc/ruby-2.0.0-p451/ext/pty'
compiling pty.c
pty.c: In function 'chfunc':
pty.c:143:12: warning: ignoring return value of 'seteuid', declared with attribute warn_unused_result [-Wunused-result]
seteuid(getuid());
^
linking shared-object pty.so
installing default pty libraries
make[2]: Leaving directory `/home/poc/ruby-2.0.0-p451/ext/pty'
make[2]: Entering directory `/home/poc/ruby-2.0.0-p451/ext/racc/cparse'
compiling cparse.c
linking shared-object racc/cparse.so
installing default cparse libraries
make[2]: Leaving directory `/home/poc/ruby-2.0.0-p451/ext/racc/cparse'
make[2]: Entering directory `/home/poc/ruby-2.0.0-p451/ext/readline'
compiling readline.c
readline.c: In function 'Init_readline':
readline.c:1886:26: error: 'Function' undeclared (first use in this function)
rl_pre_input_hook = (Function *)readline_pre_input_hook;
^
readline.c:1886:26: note: each undeclared identifier is reported only once for each function it appears in
readline.c:1886:36: error: expected expression before ')' token
rl_pre_input_hook = (Function *)readline_pre_input_hook;
^
readline.c: At top level:
readline.c:530:1: warning: 'readline_pre_input_hook' defined but not used [-Wunused-function]
readline_pre_input_hook(void)
^
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory `/home/poc/ruby-2.0.0-p451/ext/readline'
make[1]: *** [ext/readline/all] Error 2
make[1]: Leaving directory `/home/poc/ruby-2.0.0-p451'
make: *** [build-ext] Error 2
I also have Ubuntu 14.04 and I got to make it work. Sharing what I did just in case it works for you.
I patched the file ext/readline/readline.c replacing line 1886:
rl_pre_input_hook = (Function *)readline_pre_input_hook;
With
rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
Then I tried to make it again and it worked.
Source: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741825
I also ran into this issue trying to install ruby-2.0.0-p247 with rbenv. Save some time by using this patch.
You can run it like this:
curl -fsSL https://gist.github.com/ference/d3d4cbbe18309a91ad9b/raw/267ea89fa145c536967831e1af4dea030297b53e/ruby-2.0.0-p247.patch | rbenv install --patch 2.0.0-p247
This is my solution on Ubuntu 14.04 Server edition.
I need to install underline
sudo apt-get install libreadline6 libreadline6-dev
Then, the problem was fixed.
Found a solution from https://github.com/sstephenson/ruby-build/issues/690. What actually missing is libffi-dev. I tried on Ubuntu 12.04 and it is successful.
sudo apt-get install libffi-dev

Resources