构建 libetpan 项目期间的 ARM64 构建错误

Posted

技术标签:

【中文标题】构建 libetpan 项目期间的 ARM64 构建错误【英文标题】:ARM64 build error during building libetpan project 【发布时间】:2014-04-17 06:18:06 【问题描述】:

在为 ios-ARM64 构建 libetpan 时,

我已经在 libetpan for mac 项目的准备脚本中添加了日志记录功能。 Xcode 失败并出现奇怪的错误,仅在构建 ARM64 目标期间。 这是下面的xcode日志:

configuring
running prepare-cyrus-sasl.sh
prepare sources
patching file lib/client.c
building tools
generated makemd5i386 properly

building for iPhoneOS - armv7
CPPFLAGS=-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
CFLAGS=-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -Os -miphoneos-version-min=7.0
./configure --host=arm --prefix=/Users/user/Developer/Workspace/myapp/libetpan/build-mac/dependencies/build/libsasl/workdir/20140417150520/tmp/build/cyrus-sasl-2.1.25/iPhoneOS7.1armv7 --enable-shared=no --enable-static=yes --with-pam=/Users/user/Developer/Workspace/MyApp/libetpan/build-mac/dependencies/build/libsasl/workdir/20140417150520/tmp/build/openpam-20071221/universal --enable-otp=no --enable-digest=no --with-des=no --enable-login

building for iPhoneOS - armv7s
CPPFLAGS=-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
CFLAGS=-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -Os -miphoneos-version-min=7.0
./configure --host=arm --prefix=/Users/user/Developer/Workspace/myapp/libetpan/build-mac/dependencies/build/libsasl/workdir/20140417150520/tmp/build/cyrus-sasl-2.1.25/iPhoneOS7.1armv7s --enable-shared=no --enable-static=yes --with-pam=/Users/user/Developer/Workspace/myapp/libetpan/build-mac/dependencies/build/libsasl/workdir/20140417150520/tmp/build/openpam-20071221/universal --enable-otp=no --enable-digest=no --with-des=no --enable-login

building for iPhoneOS - arm64
CPPFLAGS=-arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
CFLAGS=-arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -Os -miphoneos-version-min=7.0
./configure --host=arm --prefix=/Users/user/Developer/Workspace/myapp/libetpan/build-mac/dependencies/build/libsasl/workdir/20140417150520/tmp/build/cyrus-sasl-2.1.25/iPhoneOS7.1arm64 --enable-shared=no --enable-static=yes --with-pam=/Users/user/Developer/Workspace/myapp/libetpan/build-mac/dependencies/build/libsasl/workdir/20140417150520/tmp/build/openpam-20071221/universal --enable-otp=no --enable-digest=no --with-des=no --enable-login
CONFIGURE FAILED.

构建脚本生成了自己的构建日志文件。它以“格式错误的对象”消息结束,如下所示:

ar cru .libs/libsasldb.a db_ndbm.o allockey.o
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: object: .libs/libsasldb.a(allockey.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make[2]: *** [libsasldb.a] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

有什么想法吗?提前致谢。

【问题讨论】:

【参考方案1】:

在将 iPhone SDK 从 7.0 更新到 7.1 后,我遇到了同样的问题。 我通过更改 ranlib 和 ar 路径来修复它,它们指向这些应用程序的一些旧版本(/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib 和 /Applications/Xcode .app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar)。

我将路径更改为: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar

【讨论】:

以上是关于构建 libetpan 项目期间的 ARM64 构建错误的主要内容,如果未能解决你的问题,请参考以下文章

为arm64交叉编译googletest

在哪里可以找到用于 arm64 架构的 openssl iOS 7 libcrypto.a 和 libssl.a 静态库

Docker镜像多架构构建

使用 Objective-C 框架构建 Swift 项目时出现“架构 arm64 的未定义符号”错误

部分开源项目着手支持macOS ARM64

文件是为 arm64 构建的,它不是被链接的架构 (x86_64)