openssl: OpenSSL master (and 3.0 branch) won't build on MacOS 10.11 (El Capitan)

Trying to compile 3.0.0 via Homebrew on MacOS 10.11 fails.

==> perl ./Configure --prefix=/usr/local/Cellar/openssl@3/3.0.0 --openssldir=/us
==> make
lang -fPIC -arch x86_64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/etc/openssl@3\"" -DENGINESDIR="\"/usr/local/Cellar/openssl@3/3.0.0/lib/engines-3\"" -DMODULESDIR="\"/usr/local/Cellar/openssl@3/3.0.0/lib/ossl-modules\"" -D_REENTRANT -DOPENSSL_BUILDING_OPENSSL -DNDEBUG  -c -o crypto/bn/liblegacy-lib-rsaz-x86_64.o crypto/bn/rsaz-x86_64.s
crypto/bn/rsaz-avx512.s:36:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpxord %ymm0,%ymm0,%ymm0
 ^
crypto/bn/rsaz-avx512.s:37:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vmovdqa64 %ymm0,%ymm1
 ^
crypto/bn/rsaz-avx512.s:38:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vmovdqa64 %ymm0,%ymm16
 ^
crypto/bn/rsaz-avx512.s:39:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vmovdqa64 %ymm0,%ymm17
 ^
crypto/bn/rsaz-avx512.s:40:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vmovdqa64 %ymm0,%ymm18
 ^
crypto/bn/rsaz-avx512.s:41:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vmovdqa64 %ymm0,%ymm19
 ^
crypto/bn/rsaz-avx512.s:55:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpbroadcastq %r13,%ymm3
 ^
crypto/bn/rsaz-avx512.s:66:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpbroadcastq %r13,%ymm4
 ^
crypto/bn/rsaz-avx512.s:76:2: error: invalid instruction mnemonic 'vpmadd52luq'
 vpmadd52luq 0(%rsi),%ymm3,%ymm1
 ^~~~~~~~~~~
crypto/bn/rsaz-avx512.s:77:2: error: invalid instruction mnemonic 'vpmadd52luq'
 vpmadd52luq 32(%rsi),%ymm3,%ymm16
 ^~~~~~~~~~~
crypto/bn/rsaz-avx512.s:78:2: error: invalid instruction mnemonic 'vpmadd52luq'
 vpmadd52luq 64(%rsi),%ymm3,%ymm17
 ^~~~~~~~~~~
crypto/bn/rsaz-avx512.s:79:2: error: invalid instruction mnemonic 'vpmadd52luq'
 vpmadd52luq 96(%rsi),%ymm3,%ymm18
 ^~~~~~~~~~~
crypto/bn/rsaz-avx512.s:80:2: error: invalid instruction mnemonic 'vpmadd52luq'
....
clang  -I. -Icrypto -Iinclude -Iproviders/implementations/include -Iproviders/common/include  -DMD5_ASM -DOPENSSL_BN_ASM_GF2m -DOPENSSL_BN_ASM_MONT -D
OPENSSL_BN_ASM_MONT5 -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -fPIC -arch x86_64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/etc/open
ssl@3\"" -DENGINESDIR="\"/usr/local/Cellar/openssl@3/3.0.0/lib/engines-3\"" -DMODULESDIR="\"/usr/local/Cellar/openssl@3/3.0.0/lib/ossl-modules\"" -D_R
EENTRANT -DOPENSSL_BUILDING_OPENSSL -DNDEBUG  -MMD -MF crypto/bn/liblegacy-lib-rsaz_exp.d.tmp -MT crypto/bn/liblegacy-lib-rsaz_exp.o -c -o crypto/bn/l
iblegacy-lib-rsaz_exp.o crypto/bn/rsaz_exp.c
crypto/bn/rsaz-avx512.s:676:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpandq %ymm4,%ymm1,%ymm1
 ^
crypto/bn/rsaz-avx512.s:677:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpandq %ymm4,%ymm16,%ymm16
 ^
crypto/bn/rsaz-avx512.s:678:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpandq %ymm4,%ymm17,%ymm17
 ^
crypto/bn/rsaz-avx512.s:679:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpandq %ymm4,%ymm18,%ymm18
 ^
crypto/bn/rsaz-avx512.s:680:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpandq %ymm4,%ymm19,%ymm19
 ^
crypto/bn/rsaz-avx512.s:682:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpbroadcastq %r15,%ymm3
 ^
crypto/bn/rsaz-avx512.s:687:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpsrlq $52,%ymm2,%ymm24
 ^
crypto/bn/rsaz-avx512.s:688:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpsrlq $52,%ymm20,%ymm25
 ^
crypto/bn/rsaz-avx512.s:689:2: error: instruction requires: AVX-512 ISA AVX-512 VL ISA
 vpsrlq $52,%ymm21,%ymm26
 ^

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Did this change ever make it into release?

I ran into this issue yesterday when I was trying to install ruby on my computer running 10.13. I’m unable to upgrade macos as my computer is too old, so here’s what I had to do to get openssl 3.0 compiling:

$ brew fetch openssl

This gives you a file path, use that in the next command to unzip the files: $ cd ~/Library/Caches/Homebrew/downloads/ $ tar xvf 2bd005bb37d33fcc49b50e48959a45801d2e989cb693e93a9528df0e5e8ed950--openssl-3.0.5.tar.gz

Open the file in your editor of choice and update line 52 in the if statement from: $ vim openssl3.0/crypto/bn/asm/rsaz-avx512.pl

https://github.com/openssl/openssl/blob/52f7e44ec88a4d803dc9783cd7c71f87014ae3ee/crypto/bn/asm/rsaz-avx512.pl#L51-L53

To:

if (!$avx512 && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { 
    $avx512ifma = 0; 
}

Zip everything up, replacing the old tar file: $tar cvf 2bd005bb37d33fcc49b50e48959a45801d2e989cb693e93a9528df0e5e8ed950--openssl-3.0.5.tar.gz openssl3.0/

Try to do: $brew install openssl

This will give you a sha256 hash mismatch error. Copy the new hash value, and update by doing: $brew edit openssl

Update line 6 with the new hash: sha256 "new hash here"

Then install, making sure we don’t auto update (which will rewrite the previous hash change): $ HOMEBREW_NO_AUTO_UPDATE=1 brew install openssl

That should work! If, like me, you were installing ruby, run this command: $ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)"

Now you should be able to run the following no problem! $rbenv install 3.1.2

What conditional can be used to distinguish the two?

We much prefer assembly code that run-time detects processor features and that works across OS/compiler/CPU versions but there are always exceptions

If the answer to my previous question is how I suspect, the fix I believe would be to adjust this conditional:

https://github.com/openssl/openssl/blob/52f7e44ec88a4d803dc9783cd7c71f87014ae3ee/crypto/bn/asm/rsaz-avx512.pl#L51-L53

Apple’s Clang uses a different versioning scheme. Clang 7 is equivalent to Apple Clang 10.0.1 (not 10.0.0 which is Clang 6.0.1). Apple Clang 10.0.1 is first used in Xcode 10.2.

If it’s CLA trivial then I can potentially open a PR, otherwise hopefully what I’ve suggested makes sense.

I did a bit of research, and came up with a possible fix, see #19352.

Please help me test that change, as I don’t have older hardware to test on myself.

I’m re-opening this one, 'cause there does seem to be a way to fix this.

On 10.14 (Mojave) it builds fine with Xcode 10, but not with Xcode 9. So it’s not just the OS, or just the compiler version…

Can you clarify which Xcode 10 version? Because there’s a big difference between Xcode 10.1 (the latest High Sierra can run) and Xcode 10.3.

On 10.14 (Mojave) it builds fine with Xcode 10, but not with Xcode 9. So it’s not just the OS, or just the compiler version…