虚拟机安装OSX10.11.4+编译libVLC和VLC源码

一、安装虚拟机

虚拟机使用的是VMware® Workstation 12 Pro  12.1.0 build-3272444

参考:http://jingyan.baidu.com/article/3f16e003eac66e2591c103e0.html

虚拟机设置

内存 4G

处理器数量2每个处理器核心数量2,虚拟化引擎中勾上“虚拟化Intel VT-x 或AMD-V/RVI(V)”和“虚拟化CPU性能计数器”

硬盘60G,原先分配40G,在升级系统和XCode版本后占用较大空间,建议60G

CD/DVD(SATA):手动选择“使用ISO映像文件”,浏览打开iso文件

网络适配器:选择桥接模式,这样可自动分配局域网IP

显示器:选择“加速3D图形”,图形内存768MB

遇到的问题:

1、报错:

解决办法:用记事本打开对应的虚拟机配置文件vmx,添加一句smc.version = "0"

2、安装VMWare Tools:需要在osx系统里“推出光盘”,然后在虚拟机VMWare Tools的设置里,重新加载iso(也可能osx自动弹出界面安装)

http://blog.itpub.net/25990299/viewspace-1245320/

二、安装osx苹果Mac系统

1、安装后基本不能使用,性能太差,去掉不必要的设置,可以提升性能,

1)参考:http://www.3lian.com/edu/2015/05-05/209925.html

2)请装beamoff!详见:https://github.com/JasF/beamoff.git

CSDN下载:http://download.csdn.net/download/bytige/8371825

 本站下载:http://files.cnblogs.com/files/yipu/beamoff.zip

使用方法:系统偏好设置 - 用户与群组 - 选中你自己的用户名 - 选择 “登录项” 选项卡 - 点 + 号

找到你下载的beamoff.app

2、对于不习惯OSX中的Command键操作的地方更换为Windows熟悉的Control键方法:

系统偏好设置->键盘->修饰键:将Control和Command键互换


三、准备编译环境

相关参考链接

a、libVLC和VLC源码的区别

http://blog.csdn.net/buyicn/article/details/22756141

b、libVLC即VLCKit和VLC编译方式

libVLC参考:https://wiki.videolan.org/VLCKit/

VLC参考:https://wiki.videolan.org/IOSCompile/

四、遇到的问题

1、编译libVLC时报错(SDK找不到、CoreText等系统库找不到、其它configure、build阶段的错误)

<strong>a、SDK找不到</strong>
sh-3.2# sh ./buildMobileVLCKit.sh 
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'SDKVersion' in SDK 'iphoneos'

<strong>b、CoreText系统库找不到等等</strong>
configure: error: CoreText support requested but libcoretext not found

原因是:xcode版本不对,编译环境设置不对、翻墙代理不给力等等。

1、系统和XCode版本升级到最新。虚拟机中OSX系统版本是10.10,之后自动更新到osx10.10.5,但是下载的xcode是最新的xcode beta版本,因为系统无法自动升级到osx10.11,所以无法使用最新的xcode。在这种环境上编译多次,并且手动修改buildMobileKit.sh和extras\packages\ios\build.sh文件,同样出现问题。所以改变思路,将操作系统升级到最新的osx10.11.4,并将xcode升级到Version 7.3 (7D175)。


备忘:附旧版本下载办法:到官网https://developer.apple.com/downloads/上下载与osx10.10匹配的xcode版本v6.4

2、无需手动修改环境变量。

       有的同仁的经验文档中写道,需要修改环境变量,将MobileVLCKit\ImportedSources\vlc\extras\tools\build\bin目录增加到$PATH中,其实不需要。至少现在的新版本中编译脚本不需要了。在MobileVLCKit\ImportedSources\vlc\extras\package\ios\build.sh中已经将该路径增加到环境变量中了。

       另外:像MobileVLCKit\ImportedSources\vlc\extras\tools中的ant、autoconf、automake、gas、libtool、m4、pkgconfig等工具以及MobileVLCKit\ImportedSources\vlc\contrib\tarballs下载的库不要手动安装,由脚本自动安装到指定目录。比如extras下的tools均安装到tools\build目录下了,在编译vlc时,会引用该目录下的所有工具。

如果无法下载,可以到我的下载中心下载:

tarballs库:http://download.csdn.net/detail/yagerfgcs/9521269

extras\tools库:http://download.csdn.net/detail/yagerfgcs/9521425

3、推荐旗鱼vpn代理。使用给osx设置vpn代理,直接翻墙下载对应文件,如果下载不了,更换另一个vpn地址再尝试。最好使用美国的代理,我编译过程中遇到使用香港、台湾代理无法下载的情况,更换为美国的就可以了。尽量不要手动通过浏览器下载,不然会出现SHA512SUMS校验码问题,参考http://www.cnblogs.com/zjjcy/p/3858759.html

附上OSX下如何使用旗鱼vpn的链接:http://www.nb195.com/vpnjc/13.html

4、找不到install-ios-iPhoneOS目录

./buildMobileVLCKit.sh: line 44: pushd: MobileVLCKit/ImportedSources/vlc/install-ios-iPhoneOS: No such file or directory
原因:在MobileVLCKit\ImportedSources\vlc\extras\package\ios\build.sh脚本中会configure、make vlc的源码,在此过程中会在vlc根目录下创建install-ios-iPhoneOS和install-ios-iPhoneSimlator。然后在MobileVLCKit\buildMobilekit.sh脚本中会打开该目录。所以找不到该目录的原因有两种:1、使用sh ./buildMobileKit.sh -f命令同时编译Device、Simulator、static framework。不能仅编译模拟器的版本,否则install-ios-iPhoneOS目录没创建。 2、执行build.sh过程失败了,更换个美国的vpn再试试,参考上一条vpn代理。

5、build.sh中make失败,报libaccess_archive_plugin.la错误。

+ make -j3
grep: /Users/yager/vlc_ios/vlc/MobileVLCKit/ImportedSources/vlc/extras/tools/build/lib/liblzma.la: No such file or directory
sed: /Users/yager/vlc_ios/vlc/MobileVLCKit/ImportedSources/vlc/extras/tools/build/lib/liblzma.la: No such file or directory
libtool: link: `/Users/yager/vlc_ios/vlc/MobileVLCKit/ImportedSources/vlc/extras/tools/build/lib/liblzma.la' is not a valid libtool archive
make[4]: *** [libaccess_archive_plugin.la] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1

五、libVLC编译脚本解析

1、脚本的调用顺序

a、sh -x ./buildMobileVLCKit.sh -f -->解析命令参数->git下载vlc源码->调用buildMobileKit函数编译MobileKit->根据参数判断编译模拟器版本、真机版本,调用vlc/extras/package/ios目录下的build.sh脚本(build.sh脚本单独详述)->调用build_universal_static_lib函数编译静态库->(展开静态库调用方式:清理头文件,创建install-ios-$OSSTYLE文件夹,为后续拷贝做准备->遍历真机和模拟器编译中生成的install-ios-"$OSSTYLE"OS和install-ios-"$OSSTYLE"Simulator目录,准备拷贝所有的.a文件到刚才创建的install-ios-"$OSSTYLE"文件夹中。)->如果需要编译静态framework,则执行buildxcodeproj命令将对应文件打包到framework中。

b、build.sh的执行过程:解析命令参数->Building libvlc for Apple embedded OS style ->配置SDK版本路径->配置BUILDDIR路径为"${VLCROOT}/build-ios-${OSSTYLE}${PLATFORM}/${ACTUAL_ARCH}"->添加环境变量${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin,这样就屏蔽了自带的环境变量中自带的autoconfig等工具对本次编译的影响。->Building tools。打开extras/tools工具,make编译所有额外工具->Building contrib for iOS->打开"${VLCROOT}/contrib/${OSSTYLE}${PLATFORM}-${ARCH}"目录执行../bootstrap命令->make -j3->Bootstraping vlc->配置vlc->Building libvlc:make libVLC->Installing libvlc

2、参考我的下载链接中libVLC编译成功的shell脚本执行过程,作为参考项,可以对比编译中出现的错误

下载链接:http://download.csdn.net/detail/yagerfgcs/9510588

200-100-1-190:~ yager$ su root
Password:
sh-3.2# cd VLCKit/
sh-3.2# ls
.DS_Store			MobileVLCKit.podspec
.git				MobileVLCKit.xcodeproj
.gitignore			MobileVLCKit_Prefix.pch
CONTRIBUTING.md			NEWS
COPYING				Packaging
Configure.sh			Pre-Compile.sh
DynamicMobileVLCKit		README.md
DynamicTVVLCKit			Resources
Examples_OSX			Sources
Examples_iOS			StaticLibVLC
Headers				TVVLCKit
Makefile			VLCKit-Info.plist
MobileVLCKit			VLCKit.xcodeproj
MobileVLCKit-dynamic		VLC_Prefix.pch
MobileVLCKit-prod.podspec	buildMobileVLCKit.sh
MobileVLCKit-unstable.podspec
sh-3.2# sh -x ./buildMobileVLCKit.sh -f
+ set -e
+ BUILD_DEVICE=yes
+ BUILD_SIMULATOR=yes
+ BUILD_STATIC_FRAMEWORK=no
++ xcrun --sdk iphoneos --show-sdk-version
+ SDK=9.3
+ SDK_MIN=7.0
+ VERBOSE=no
+ CONFIGURATION=Release
+ NONETWORK=no
+ SKIPLIBVLCCOMPILATION=no
+ SCARY=yes
+ TVOS=no
+ BITCODE=no
+ TESTEDHASH=ac4658d2
+ getopts hvwsfbdntlk: OPTION
+ case $OPTION in
+ BUILD_DEVICE=yes
+ BUILD_SIMULATOR=yes
+ BUILD_STATIC_FRAMEWORK=yes
+ getopts hvwsfbdntlk: OPTION
+ shift 1
+ out=/dev/null
+ '[' no = yes ']'
+ '[' x '!=' x ']'
+ spushd .
+ pushd .
++ pwd
+ aspen_root_dir=/Users/yager/VLCKit

......................................................省略.........................................................................

$(PROJECT_DIR)/MobileVLCKit/ImportedSources/vlc/install-ios-iPhone/plugins/libaccess_concat_plugin.a $(PROJECT_DIR)/MobileVLCKit/ImportedSources/vlc/install-ios-iPhone/plugins/libaccess_archive_plugin.a $(PROJECT_DIR)/MobileVLCKit/ImportedSources/vlc/install-ios-iPhone/plugins/liba52tospdif_plugin.a $(PROJECT_DIR)/MobileVLCKit/ImportedSources/vlc/install-ios-iPhone/plugins/liba52_plugin.a '
+ spopd
+ popd
+ info 'all done'
+ local 'green=\033[1;32m'
+ local 'normal=\033[0m'
+ echo '[\033[1;32minfo\033[0m] all done'
[info] all done
+ '[' yes '!=' no ']'
+ info 'Building static MobileVLCKit.framework'
+ local 'green=\033[1;32m'
+ local 'normal=\033[0m'
+ echo '[\033[1;32minfo\033[0m] Building static MobileVLCKit.framework'
[info] Building static MobileVLCKit.framework
+ buildxcodeproj MobileVLCKit MobileVLCKit iphoneos
+ local target=MobileVLCKit
+ local PLATFORM=iphoneos
+ info 'Building MobileVLCKit (MobileVLCKit, Release, iphoneos)'
+ local 'green=\033[1;32m'
+ local 'normal=\033[0m'
+ echo '[\033[1;32minfo\033[0m] Building MobileVLCKit (MobileVLCKit, Release, iphoneos)'
[info] Building MobileVLCKit (MobileVLCKit, Release, iphoneos)
+ local architectures=
+ '[' iphoneos = iphonesimulator ']'
+ architectures='armv7 armv7s arm64'
+ local defs=
+ '[' yes = no ']'
+ xcodebuild -project MobileVLCKit.xcodeproj -target MobileVLCKit -sdk iphoneos9.3 -configuration Release 'ARCHS=armv7 armv7s arm64' IPHONEOS_DEPLOYMENT_TARGET=7.0 GCC_PREPROCESSOR_DEFINITIONS=
2016-05-05 10:17:47.545 xcodebuild[34742:870095] Failed to locate a valid instance of CoreSimulatorService in the bootstrap.  Adding it now.
+ buildxcodeproj MobileVLCKit MobileVLCKit iphonesimulator
+ local target=MobileVLCKit
+ local PLATFORM=iphonesimulator
+ info 'Building MobileVLCKit (MobileVLCKit, Release, iphonesimulator)'
+ local 'green=\033[1;32m'
+ local 'normal=\033[0m'
+ echo '[\033[1;32minfo\033[0m] Building MobileVLCKit (MobileVLCKit, Release, iphonesimulator)'
[info] Building MobileVLCKit (MobileVLCKit, Release, iphonesimulator)
+ local architectures=
+ '[' iphonesimulator = iphonesimulator ']'
+ architectures='i386 x86_64'
+ local defs=
+ '[' yes = no ']'
+ xcodebuild -project MobileVLCKit.xcodeproj -target MobileVLCKit -sdk iphonesimulator9.3 -configuration Release 'ARCHS=i386 x86_64' IPHONEOS_DEPLOYMENT_TARGET=7.0 GCC_PREPROCESSOR_DEFINITIONS=
+ spushd build
+ pushd build
+ rm -rf MobileVLCKit.framework
+ mkdir MobileVLCKit.framework
+ lipo -create Release-iphoneos/libMobileVLCKit.a Release-iphonesimulator/libMobileVLCKit.a -o MobileVLCKit.framework/MobileVLCKit
+ chmod a+x MobileVLCKit.framework/MobileVLCKit
+ cp -pr Release-iphoneos/MobileVLCKit MobileVLCKit.framework/Headers
+ spopd
+ popd
+ info 'Build of static MobileVLCKit.framework completed'
+ local 'green=\033[1;32m'
+ local 'normal=\033[0m'
+ echo '[\033[1;32minfo\033[0m] Build of static MobileVLCKit.framework completed'
[info] Build of static MobileVLCKit.framework completed 

六、libVLC需翻墙下载的主要是tarballs和tools目录下的软件。可以访问我的下载链接,直接获取




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值