`

IOS开发环境搭建1(Xcode4.3.2+MacPorts2.1.1+OpenCV2.4.0)

阅读更多

开发硬件设备:MacBook Air/Pro

应用硬件设备:iPad、iPhone

 

开发环境搭建:

1.推荐系统升级到最新版本,我当前的版本Mac OS X 10.7.4

2.在AppStore下载Xcode,我下载的版本:Xcode 4.3.2

配置Xcode,安装Command Line Tools
xcode → Preferences –> downloads → Command Line Tools(180M)

     如果不配置Command Line Tools,在使用MacPorts安装软件的时候会出现如下错误信息

Warning: The Command Line Tools for Xcode don't appear to be installed; most ports will likely fail to build.

Warning: See http://guide.macports.org/chunked/installing.xcode.html for more information.

---> Computing dependencies for axelError: Unable to execute port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?

     会出现上述错误的原因

安装完Xcode识不了命令行工具
所以需要在Xcode使用偏好设置-->download 下面进行下载安装Command Line Tools,这样make、gcc、ports等命令行才可以用。
 

3.安装openCV(用MacPorts安装)

 

MacPorts简介

MacPorts是开源社区发起的一项方便开发者在Shell下进行软件的编译、安装和升级等操作的开源项目,旨在方便Mac环境下的开发者。更多的关于MacPorts的信息,你可以登陆官网查看:http://www.macports.org

 

  下载MacPorts 2.1.1

https://distfiles.macports.org/MacPorts/MacPorts-2.1.1-10.7-Lion.pkg

 

安装MacPorts 

与其他Mac的软件的安装方式相同,挂载dmg后,打开pkg,按照引导一步步next,然后没有drag到Application的动作。

(注:这一步骤非常慢。有的网友说是断了网就好了,如果这样的话,或许是在更新一些多余信息。)
检查MacPorts的环境变量
经过1和2两步后,可以到Shell下查看~/.profile文件,会发现MacPorts在安装时已经把环境变量写入到该文件中了,如下:
# MacPorts Installer addition on 2012-01-21_at_00:18:10: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.

 

更新MacPorts索引

什么是MacPorts索引?如果你用过Linux的话,你一定用过apt-get或者yum,或者如果你用过BSD,一定用过ports。我们在键入这些命令时,按Tab键都会得到一些想要安装的软件的提示,这些提示信息,就来自于它们各自的索引。而MacPorts也与它们有类似的功能,所以索引也必不可少。在Shell下,执行如下命令:
sudo port -v selfupdate

其中-v表示verbose(冗余),即把信息都显示到Shell上。selfupdate即官网上说的“for users who already have MacPorts installed and wish to upgrade to a newer release.”
(注:这个要看网速,我的是10M光纤,基本上一下就过去了) 
MacPorts的常用命令
搜索MacPorts索引中的软件
port search NAME

安装新的软件
sudo port install NAME

卸载已安装的软件
sudo port uninstall NAME

查看版本较低的软件
port outdated

升级版本较低的软件
sudo port upgrade outdated

 

MacPorts安装好后,开始安装OpenCV 

sudo port install opencv
分享到:
评论
1 楼 小月峰 2012-06-05  
楼主,为什么我跟你的操作一样,在第二步就开住了!port dpkg not found

相关推荐

Global site tag (gtag.js) - Google Analytics