swift 安装OpenSSL-Apple Cocoapod时出错,构建失败

fhg3lkii  于 2022-12-21  发布在  Swift
关注(0)|答案(2)|浏览(284)

我尝试将OpenSSL-Apple Cocoapod安装为项目的依赖项,但构建失败,如下所示

[!] /bin/bash -c
set -e
./build-libssl.sh --version="1.1.1l" --targets="ios-sim-cross-x86_64 ios-sim-cross-arm64 ios64-cross-arm64 ios64-cross-arm64e macos64-x86_64 macos64-arm64 mac-catalyst-x86_64 mac-catalyst-arm64"
./create-openssl-framework.sh dynamic

Build options
  OpenSSL version: 1.1.1l
  Targets: ios-sim-cross-x86_64 ios-sim-cross-arm64 ios64-cross-arm64 ios64-cross-arm64e macos64-x86_64 macos64-arm64 mac-catalyst-x86_64 mac-catalyst-arm64
  iOS SDK: 15.4 (min 12.0)
  macOS SDK: 12.3 (min 10.15)
  macOS SDK (Catalyst): 12.3 (min 10.15)
  watchOS SDK: 8.5 (min 4.0)
  tvOS SDK: 15.4 (min 12.0)
  Number of make threads: 8
  Configure options:  no-deprecated
  Build location: /private/var/folders/mg/vh8gm88n7q9fz88_0zx52b2c0000gn/T/CocoaPods/Try/OpenSSL-Apple

Downloading openssl-1.1.1l.tar.gz...
Building openssl-1.1.1l for iPhoneSimulator 15.4 x86_64...
  Logfile: /private/var/folders/mg/vh8gm88n7q9fz88_0zx52b2c0000gn/T/CocoaPods/Try/OpenSSL-Apple/bin/iPhoneSimulator15.4-x86_64.sdk/build-openssl-1.1.1l.log
  Configure...
  Make (using 8 thread(s))...
Building openssl-1.1.1l for iPhoneSimulator 15.4 arm64...
  Logfile: /private/var/folders/mg/vh8gm88n7q9fz88_0zx52b2c0000gn/T/CocoaPods/Try/OpenSSL-Apple/bin/iPhoneSimulator15.4-arm64.sdk/build-openssl-1.1.1l.log
  Configure...
  Make (using 8 thread(s))...
Building openssl-1.1.1l for iPhoneOS 15.4 arm64...
  Logfile: /private/var/folders/mg/vh8gm88n7q9fz88_0zx52b2c0000gn/T/CocoaPods/Try/OpenSSL-Apple/bin/iPhoneOS15.4-arm64.sdk/build-openssl-1.1.1l.log
  Configure...
  Make (using 8 thread(s))...
Building openssl-1.1.1l for iPhoneOS 15.4 arm64e...
  Logfile: /private/var/folders/mg/vh8gm88n7q9fz88_0zx52b2c0000gn/T/CocoaPods/Try/OpenSSL-Apple/bin/iPhoneOS15.4-arm64e.sdk/build-openssl-1.1.1l.log
  Configure...
  Make (using 8 thread(s))...
Building openssl-1.1.1l for MacOSX 12.3 x86_64...
  Logfile: /private/var/folders/mg/vh8gm88n7q9fz88_0zx52b2c0000gn/T/CocoaPods/Try/OpenSSL-Apple/bin/MacOSX12.3-x86_64.sdk/build-openssl-1.1.1l.log
  Configure...
  Make (using 8 thread(s))...
Building openssl-1.1.1l for MacOSX 12.3 arm64...
  Logfile: /private/var/folders/mg/vh8gm88n7q9fz88_0zx52b2c0000gn/T/CocoaPods/Try/OpenSSL-Apple/bin/MacOSX12.3-arm64.sdk/build-openssl-1.1.1l.log
  Configure...
  Make (using 8 thread(s))...
Building openssl-1.1.1l for Catalyst 12.3 x86_64...
  Logfile: /private/var/folders/mg/vh8gm88n7q9fz88_0zx52b2c0000gn/T/CocoaPods/Try/OpenSSL-Apple/bin/Catalyst12.3-x86_64.sdk/build-openssl-1.1.1l.log
  Configure...
  Make (using 8 thread(s))...
Problem during make - Please check /private/var/folders/mg/vh8gm88n7q9fz88_0zx52b2c0000gn/T/CocoaPods/Try/OpenSSL-Apple/bin/Catalyst12.3-x86_64.sdk/build-openssl-1.1.1l.log
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9603k  100 9603k    0     0  3645k      0  0:00:02  0:00:02 --:--:-- 3658k

而所讨论的文件在结尾处具有此

clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi'
clang: clang: error: clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi'
error: invalid version number in '-target x86_64-apple-ios13.0-macabi'
invalid version number in '-target x86_64-apple-ios13.0-macabi'
clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi'
clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi'
make[1]: *** [Makefile:701: apps/s_cb.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:677: apps/apps.o] Error 1
make[1]: *** [Makefile:693: apps/opt.o] Error 1
make[1]: *** [Makefile:685: apps/bf_prefix.o] Error 1
make[1]: *** [Makefile:709: apps/s_socket.o] Error 1
clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi'
make[1]: *** [Makefile:720: crypto/aes/aes_cbc.o] Error 1
clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi'
make[1]: *** [Makefile:669: apps/app_rand.o] Error 1
make[1]: *** [Makefile:728: crypto/aes/aes_cfb.o] Error 1
make[1]: Leaving directory '/private/var/folders/mg/vh8gm88n7q9fz88_0zx52b2c0000gn/T/CocoaPods/Try/OpenSSL-Apple/src/Catalyst-x86_64/openssl-1.1.1l'
make: *** [Makefile:174: all] Error 2

当我试图直接执行命令时

./build-libssl.sh --version="1.1.1l" --targets="ios-sim-cross-x86_64 ios-sim-cross-arm64 ios64-cross-arm64 ios64-cross-arm64e macos64-x86_64 macos64-arm64 mac-catalyst-x86_64 mac-catalyst-arm64"

该过程是成功的...

Building openssl-1.1.1l for Catalyst 12.3 x86_64...
  Logfile: /Users/steinmacht/Library/Caches/CocoaPods/Pods/Release/OpenSSL-Apple/1.1.1l.11-fb93d/bin/Catalyst12.3-x86_64.sdk/build-openssl-1.1.1l.log
  Configure...
  Make (using 8 thread(s))...
Building openssl-1.1.1l for Catalyst 12.3 arm64...
  Logfile: /Users/steinmacht/Library/Caches/CocoaPods/Pods/Release/OpenSSL-Apple/1.1.1l.11-fb93d/bin/Catalyst12.3-arm64.sdk/build-openssl-1.1.1l.log
  Configure...
  Make (using 8 thread(s))...
Done.

尝试了许多不同的重新安装,但问题仍然存在,阻止我初始化项目。

hrysbysz

hrysbysz1#

我也有同样的问题由于我不需要Catalyst支持(这是构建失败的地方),我通过执行以下操作删除了它:

  • 打开Pod的文件夹(在您的情况下为/Users/steinmacht/Library/Caches/CocoaPods/Pods/Release/OpenSSL-Apple/1.1.1l.11-fb93d-在日志中可见)
  • 复制OpenSSL-Apple.podspec文件并从openssl_targets中删除架构。
openssl_targets   = "ios-sim-cross-x86_64 ios-sim-cross-arm64 ios64-cross-arm64 ios64-cross-arm64e macos64-x86_64 macos64-arm64"
  • 将该文件托管在某个位置,例如https://www.example.com/podspecs/OpenSSL-Apple.podspec
  • 更改您的Podfile以使用私有podspec文件(如本文档页底部所述):
pod 'OpenSSL-Apple', :podspec => 'https://www.project3851.com/podspecs/OpenSSL-Apple.podspec'

(it它可能只使用路径引用,我还没有测试过)
你需要一个私人的podspec文件,因为pod install会从远程库更新它,即使你修改了它。完全有可能有更好的方法来做到这一点,我只是一个非常偶然的Pod用户。
无论如何,在这之后pod install再次为我工作,移动应用程序也工作得很好。

ozxc1zmp

ozxc1zmp2#

我使用本地版本的openSSL

git clone https://github.com/passepartoutvpn/openssl-apple.git

然后编辑文件OpenSSL-Apple.podspec中的运行命令
在PodFile集合中

pod 'OpenSSL-Apple', :path => '/Users/artem/XCode/openssl-apple'

相关问题