美文网首页
Mac OS 10.13系统下安装openssl的坑

Mac OS 10.13系统下安装openssl的坑

作者: SeanZK | 来源:发表于2021-09-06 17:07 被阅读0次

    在升级了mac os 10.13后发现原先的openssl失效了,于是在使用Homebrew命令安装,安装过程中出现以下错误:

    ==> Downloading [https://www.openssl.org/source/openssl-1.1.1l.tar.gz](https://www.openssl.org/source/openssl-1.1.1l.tar.gz)
    Already downloaded: /Users/imac/Library/Caches/Homebrew/downloads/b6ccc5a2a602c2af3480bbcf1656bd9844595974ba60501871ac12504508e818--openssl-1.1.1l.tar.gz
    ==> Downloading [https://rubygems.org/rubygems/rubygems-3.2.22.tgz](https://rubygems.org/rubygems/rubygems-3.2.22.tgz)
    Already downloaded: /Users/imac/Library/Caches/Homebrew/downloads/96236626599ffcc0af13d9f63baa57c2f6edce88c0aa994959a310cb40d5eb2f--rubygems-3.2.22.tgz
    ==> Downloading [https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.2.tar.xz](https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.2.tar.xz)
    Already downloaded: /Users/imac/Library/Caches/Homebrew/downloads/ae908512efc45d73090c1c3acbd8dce15ab9827300ae2caefab164ed6c2a356a--ruby-3.0.2.tar.xz
    ==> Installing dependencies for ruby: openssl@1.1
    ==> Installing ruby dependency: openssl@1.1
    ==> perl ./Configure --prefix=/usr/local/Cellar/openssl@1.1/1.1.1l --openssldir=/usr/l
    ==> make
    Last 15 lines from /Users/imac/Library/Logs/Homebrew/openssl@1.1/02.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/rand_egd.d.tmp -MT crypto/rand/rand_egd.o -c -o crypto/rand/rand_egd.o crypto/rand/rand_egd.c
    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/rand_err.d.tmp -MT crypto/rand/rand_err.o -c -o crypto/rand/rand_err.o crypto/rand/rand_err.c
    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/rand_lib.d.tmp -MT crypto/rand/rand_lib.o -c -o crypto/rand/rand_lib.o crypto/rand/rand_lib.c
    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/rand_unix.d.tmp -MT crypto/rand/rand_unix.o -c -o crypto/rand/rand_unix.o crypto/rand/rand_unix.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!
    
    Error: You are using macOS 10.13.
    We (and Apple) do not provide support for this old version.
    You will encounter build failures with some formulae.
    Please create pull requests instead of asking for help on Homebrew's GitHub,
    Twitter or any other official channels. You are responsible for resolving
    any issues you experience while you are running this
    old version.
    
    

    重点来了,在查阅了无数的关于“ [crypto/rand/rand_unix.o] Error 1”的错误语法之后还是无果,于是考虑是不是这个文件本身有问题,所以尝试,打开finder

    shift + command + G
    //输入以下文件路径
    /usr/include/CommonCrypto/CommonRandom.h
    

    查阅系统的文档发现 kCCSuccess、CCCryptorStatus 是 <CommonCrypto/CommonCrypto.h>里的定义的变量,而error: use of undeclared identifier表示正是找不大这几个变量,于是在打开的CommonRandom.h里添加

    #import <CommonCrypto/CommonCrypto.h>
    

    如果修改不了,将文档复制出来,修改完放回去替换即可。
    重启终端,输入

    brew install openssl
    

    完美解决!

    相关文章

      网友评论

          本文标题:Mac OS 10.13系统下安装openssl的坑

          本文链接:https://www.haomeiwen.com/subject/bdxywltx.html