-ngiphoneos-version-min = .sd中的clang错误无效版本号 [英] clang error invalid version number in -miphoneos-version-min=.sd
问题描述
当我为ios编译 librtmp
时,脚本显示如下:
#!/ 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];然后
git clone git://git.ffmpeg.org/rtmpdump $ SOURCE
else
cd $ SOURCE
git fetch
cd ..
fi
cd $ SOURCE / librtmp
用于ARCH中$ ARCHS; do
mkdir -p ../$DSTDIR/$ARCH
if [[$ ARCH == arm *]];那么
SDK = $ DEVICE_SDK
else
SDK = $ SIMULATOR_SDK
fi
perl -i -pe'| ^ AR = \ $ \\ \\(CROSS_COMPILE \)ar | AR = xcrun ar |'Makefile
$ b 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 / $ ARCHinstall
make clean
完成
mkdir -p $ $ LIBS中的LIB的CURRPATH / $ DSTDIR / lib
cd $ CURRPATH / $ DSTDIR / $ ARCH / lib
LIBS =`ls * .a`
cd $ CURRPATH
; do
lipo -create`find $ DSTDIR -name $ LIB` -output $ DSTDIR / lib / $ LIB
完成
cp -rf $ DSTDIR / $ ARCH / include $ DSTDIR
用于ARCH中$ ARCHS;做
rm -rf $ DSTDIR / $ ARCH
完成
when statement 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
铛:错误:无效的版本号'-miphoneos-version-min = .sd'
make:*** [rtmp.o]错误1
为什么?我设置了 XLDFLAGS = - isysroot $ SDK -L $ LIBSSL / lib -arch $ ARCH -miphoneos-version-min = 7.0
为什么无效的版本号在'-miphoneos-version-min = .sd'
发生?
I通过改变 -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
请注意,后者是我系统中前者的符号链接。
它看起来,clang隐式地从iPhoneOSXXX.sdk目录名称中设置 -miphoneos-version-min =
。使用链接中的版本号似乎解决了编译问题。
When i compile librtmp
for ios, the script shows below:
#!/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
when statement make SYS=darwin
runs, error shows:
/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
Why? I have set XLDFLAGS="-isysroot $SDK -L$LIBSSL/lib -arch $ARCH -miphoneos-version-min=7.0 "
and why invalid version number in '-miphoneos-version-min=.sd'
occurs?
I had the same problem and resolved it by changing the -isysroot
argument from:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
to:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk
Note that the latter is a symlink to the former on my system.
It appears that clang is implicitly setting -miphoneos-version-min=
from the iPhoneOSXXX.sdk directory name. Using the link with the version number in it seems to fix the compilation issue.
这篇关于-ngiphoneos-version-min = .sd中的clang错误无效版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!