有没有办法将为macOS构建的库转换为可以在iOS项目中使用的库?我的应用程序中出现以下错误:
/Users/edwardpizzurro/Desktop/LibreriasAlternativas/LibreriasAlternativas.xcodeproj Building for iOS, but the linked library 'libsndfile.a' was built for macOS.发布于 2021-04-12 16:06:06
通常,这是不可能的,您必须指定iOS架构来重新构建您的库。
要获取有关库的更多信息,请运行
lipo -info libsndfile.a它将为您提供像armv7 armv7s i386 x86_64 arm64这样的架构。iOS的默认架构是arm64,而MacOS的默认架构是x86_64 (我们不是在谈论新的M1硬件)。所以,对于你的libsndfile.a来说,最有可能的就是你只会得到x86_64。
这意味着你需要自己构建libsndfile。
这里是这个库的发行版,这里没有arm64:https://github.com/libsndfile/libsndfile/releases
因此,您必须加载repo:https://github.com/libsndfile/libsndfile,并使用smth像Autotools一样为您想要的架构构建它。
这里有一个粗略的例子来说明你需要做什么:Can't cross compile C library for arm (iOS)
虽然它对每个库都是非常具体的。
https://stackoverflow.com/questions/67053061
复制相似问题