1

我正在尝试为 iOS 架构编译Sofia-SIP 库armv6armv7但我遇到了问题。下面是我正在做的事情。

export DEVROOT=/Applications/Xcode_4_6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer    
export SDKROOT=$DEVROOT/SDKs/iPhoneOS6.1.sdk    
export CC=$SDKROOT/usr/bin/llvm-gcc-4.2    
export CFLAGS="-pipe -no-cpp-precomp -isysroot $SDKROOT -arch armv7"    
export LDFLAGS="-syslibroot $SDKROOT -arch armv7"    
export CPP=$SDKROOT/usr/bin/llvm-g++-4.2./configure --host=arm-apple-darwin10    
sudo ./configure --host=arm-apple-darwin10

结果

Password:    
configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used    
checking build system type... x86_64-apple-darwin12.5.0    
checking host system type... arm-apple-darwin10    
checking target system type... arm-apple-darwin10    
checking cached information... ok    
checking for a BSD-compatible install... /usr/bin/install -c    
checking whether build environment is sane... yes    
checking for gawk... gawk    
checking whether make sets $(MAKE)... yes    
checking for arm-apple-darwin10-strip... no    
checking for strip... strip    
checking whether to enable maintainer-specific portions of Makefiles... no    
checking for style of include used by make... GNU    
checking for arm-apple-darwin10-gcc... no    
checking for gcc... gcc    
checking for arm-apple-darwin10-gcc... gcc    
checking whether the C compiler works... yes

问题

我希望脚本使用llvm-gcc编译器。但相反,它正在寻找arm-apple-darwin10-gcc它找不到的东西,然后最终使用gcc编译器。

4

2 回答 2

3
于 2015-10-19T17:20:36.920 回答
2

请注意,llvm-gcc已弃用;你应该clang改用:

% ls -l /usr/bin/llvm-gcc
lrwxr-xr-x  1 root  wheel  5 Nov  8  2013 /usr/bin/llvm-gcc@ -> clang

以下似乎对我有用:

export DEVROOT="$(xcrun --sdk iphoneos --show-sdk-platform-path)/Developer"
export SDKROOT="$(xcrun --sdk iphoneos --show-sdk-path)"

export CC="/usr/bin/clang"
export CXX="/usr/bin/clang++"

export LD="${DEVROOT}/usr/bin/ld"
export AR="${DEVROOT}/usr/bin/ar"
export AS="${DEVROOT}/usr/bin/as"
export NM="${DEVROOT}/usr/bin/nm"
export RANLIB="${DEVROOT}/usr/bin/ranlib"
export LDFLAGS="-L${SDKROOT}/usr/lib/"

export ARM_ARCH="armv7"  # or "armv6" and adjust the --host=[...] flag below
export CFLAGS="-arch ${ARM_ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -I${SDKROOT}/usr/include/"

export CPPFLAGS="${CFLAGS}"
export CXXFLAGS="${CFLAGS}"

配置:

./configure --host=armv7-apple-darwin

建造:

make

核实:

file `find . -name \*dylib`

输出:

./libsofia-sip-ua/.libs/libsofia-sip-ua.0.dylib:                                                       Mach-O dynamically linked shared library arm
./libsofia-sip-ua/.libs/libsofia-sip-ua.0.dylib.dSYM/Contents/Resources/DWARF/libsofia-sip-ua.0.dylib: Mach-O dSYM companion file arm
./libsofia-sip-ua/.libs/libsofia-sip-ua.dylib:                                                         Mach-O dynamically linked shared library arm

学分:

笔记:

  • -miphoneos-version-min=[...]从另一个问题中删除了标志,因为我认为它与您的问题无关;如果您想将其重新添加到CFLAGS.
于 2014-05-26T01:38:51.650 回答