gpt4 book ai didi

ios - 将 GCC makefile 脚本转换为 LLVM 3.0 编译器

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:08:36 25 4
gpt4 key购买 nike

我正在为 iPhone 开发一个开源项目,并已将该项目转换为使用 ARC 和 Apple LLVM 3.0 编译器。然而,该项目依赖于使用 makefile 构建的外部库,因为它是用 C 编写的。目前,它使用 GCC 进行编译,并且在 make 期间它引用了 ARC-ified Objective-C 代码,这会导致一些符号错误(例如作为@autorelease)在 LLVM 之前的编译器上不存在。

但足够了。我的问题是如何转换这段代码:

VERSION=4.3
COPT = -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/System/Library/Frameworks -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/System/Library/PrivateFrameworks -I../../ -I../../Classes/ -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/gcc/arm-apple-darwin9/4.2.1/include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/usr/lib -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/usr/include/
COPT += -march=armv7-a -miphoneos-version-min=${VERSION} -I. -O3 -D__IPHONE__ -D_SNESPPC -DASM_SPC700 -DZLIB -DUNZIP_SUPPORT -DOLD_COLOUR_BLENDING -DUSE_SA1 -DSUPER_FX -DLSB_FIRST -DCPU_SHUTDOWN -DVAR_CYCLES
COPT += -fnested-functions -funsigned-char -ffast-math -fexpensive-optimizations -ftemplate-depth-36 -mstructure-size-boundary=32 -falign-functions=32 -falign-loops -falign-labels -falign-jumps -finline -finline-functions -fno-builtin -fno-common -fomit-frame-pointer -fpeel-loops -fstrength-reduce -funroll-loops -fstrict-aliasing
GCC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1
GXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-g++-4.2.1
STRIP = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/strip

使用 LLVM 编译器?我尝试将其修改为:

VERSION=5.0
COPT = -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/System/Library/Frameworks -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/System/Library/PrivateFrameworks -I../../ -I../../Classes/ -I/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/clang/3.0/include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/usr/lib -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/usr/include/
COPT += -march=armv7-a -miphoneos-version-min=${VERSION} -I. -O3 -D__IPHONE__ -D_SNESPPC -DASM_SPC700 -DZLIB -DUNZIP_SUPPORT -DOLD_COLOUR_BLENDING -DUSE_SA1 -DSUPER_FX -DLSB_FIRST -DCPU_SHUTDOWN -DVAR_CYCLES
COPT += -fnested-functions -funsigned-char -ffast-math -fexpensive-optimizations -ftemplate-depth-36 -mstructure-size-boundary=32 -falign-functions=32 -falign-loops -falign-labels -falign-jumps -finline -finline-functions -fno-builtin -fno-common -fomit-frame-pointer -fpeel-loops -fstrength-reduce -funroll-loops -fstrict-aliasing
GCC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang
GXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++
STRIP = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/strip

但这针对的是 i386 架构,而不是 iOS 的 ARM 架构,所以我得到如下错误:

"i386/types.h" not found

是否有针对 ARM 的特殊版本的 clang?还是我完全错过了什么?

最佳答案

尝试-arch armv7;您需要使用 clang 明确指定要为 ARM 构建的目标。

关于ios - 将 GCC makefile 脚本转换为 LLVM 3.0 编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8696318/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com