gpt4 book ai didi

ios - clang 错误 -miphoneos-version-min=.sd 中的版本号无效

转载 作者:行者123 更新时间:2023-12-01 18:54:09 25 4
gpt4 key购买 nike

当我编译 librtmp对于 ios,脚本如下所示:

#!/bin/sh

# OS X Yosemite, Xcode 6.1

set -ex

DEVELOPER="/Applications/Xcode.app/Contents/Developer"
DEVICE_SDK="$DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
SIMULATOR_SDK="$DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
CURRPATH=`pwd`
SOURCE="rtmpdump"
DSTDIR="librtmp"
LIBSSL=`cd ../OpenSSL/libssl;pwd`
ARCHS="i386 x86_64 armv7 armv7s arm64"

rm -rf $DSTDIR
mkdir $DSTDIR

if [ ! -d $SOURCE ]; then
git clone git://git.ffmpeg.org/rtmpdump $SOURCE
else
cd $SOURCE
git fetch
cd ..
fi

cd $SOURCE/librtmp

for ARCH in $ARCHS; do
mkdir -p ../$DSTDIR/$ARCH

if [[ $ARCH == arm* ]]; then
SDK=$DEVICE_SDK
else
SDK=$SIMULATOR_SDK
fi

perl -i -pe 's|^AR=\$\(CROSS_COMPILE\)ar|AR=xcrun ar|' Makefile

CROSS_COMPILE="$DEVELOPER/usr/bin/" \
XCFLAGS="-O0 -isysroot $SDK -I$LIBSSL/include -arch $ARCH " \
XLDFLAGS="-isysroot $SDK -L$LIBSSL/lib -arch $ARCH -miphoneos-version-min=7.0 " \
make SYS=darwin
make SYS=darwin prefix="$CURRPATH/$DSTDIR/$ARCH" install
make clean
done


mkdir -p $CURRPATH/$DSTDIR/lib
cd $CURRPATH/$DSTDIR/$ARCH/lib
LIBS=`ls *.a`
cd $CURRPATH
for LIB in $LIBS; do
lipo -create `find $DSTDIR -name $LIB` -output $DSTDIR/lib/$LIB
done

cp -rf $DSTDIR/$ARCH/include $DSTDIR

for ARCH in $ARCHS; do
rm -rf $DSTDIR/$ARCH
done

当声明 make SYS=darwin运行,错误显示:
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -Wall -O0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -I/Users/Smeegol/Desktop/AVCodecs2/OpenSSL/libssl/include -arch armv7   -DRTMPDUMP_VERSION=\"v2.4\" -DUSE_OPENSSL  -O2 -fPIC   -c -o rtmp.o rtmp.c
clang: error: invalid version number in '-miphoneos-version-min=.sd'
make: *** [rtmp.o] Error 1

为什么?我设置了 XLDFLAGS="-isysroot $SDK -L$LIBSSL/lib -arch $ARCH -miphoneos-version-min=7.0 "为什么 invalid version number in '-miphoneos-version-min=.sd'发生?

最佳答案

我遇到了同样的问题并通过更改 -isysroot 解决了它论据来自:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk



到:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk



请注意,后者是我系统上前者的符号链接(symbolic link)。

似乎 clang 正在隐式设置 -miphoneos-version-min=来自 iPhoneOSXXX.sdk 目录名称。使用带有版本号的链接似乎可以解决编译问题。

关于ios - clang 错误 -miphoneos-version-min=.sd 中的版本号无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28823485/

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