安装Xcode 4.3后无法获得MacPortfunction

我无法使MacPorts正常工作。 我刚刚安装了OSX Lion 10.7.3,我先下载并安装了MacPorts,然后在阅读要求之后,我从App Store下载了Xcode4.3,然后安装它。 我推出了Xcode,它看起来是可操作的和function性的。 但是,当我试图与MacPorts端口,它给了我这个错误信息(摘录):

Warning: xcodebuild exists but failed to execute Warning: Xcode does not appear to be installed; most ports will likely fail to build. 

我遵循以下build议:

如何在OSX Lion上为Xcode安装其他软件包以允许MacPorts工作

并从Xcode中的首选项安装command_line_tools_for_xcode。 我closures了Xcode,并再次得到错误:

 $ sudo port install libsocketsPassword: Warning: xcodebuild exists but failed to execute Warning: Xcode does not appear to be installed; most ports will likely fail to build. ---> Computing dependencies for libsockets ---> Dependencies to be installed: openssl zlib ---> Extracting zlib Error: Couldn't determine your Xcode version (from '/usr/bin/xcodebuild -version'). Error: Error: If you have not installed Xcode, install it now; see: Error: http://guide.macports.org/chunked/installing.xcode.html Error: Error: Target org.macports.extract returned: unable to find Xcode Error: Failed to install zlib Log for zlib is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_zlib/zlib/main.log Error: The following dependencies were not installed: openssl zlib Error: Status 1 encountered during processing. 

我不确定下一步该怎么做。 我如何解决我的Xcode和MacPort接口问题?

理论上这应该工作,如果你有Xcode4.3安装(在/应用程序):

 $ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/ 

(你已经安装了可选的命令行工具)

在安装“用于Xcode的命令行工具”包后,一切都将开始正常工作。 你可以从这里得到它: https : //developer.apple.com/downloads/index.action#

请参阅Xcode 4.3的MacPorts迁移说明 。

这些说明很相关。 您需要运行xcode-select来设置一个新的工具path,在macports.conf更新developer_dir (如Henk Poley所述 ),重新安装MacPorts(ouch),最后卸载并重新安装所有的端口(双击)。

编辑: libpvx仍然不会安装上面的。 需要两个额外的步骤:

  1. sudo ln -s /Developer /
  2. sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs /SDKs

YMMV如果你有不同的端口安装!

同样在/opt/local/etc/macports/macports.confdeveloper_dir改为指向/而不是/Developer

 sudo xcode-select -switch /Applications/Xcode.app 

我也必须跑

 sudo xcodebuild -license 

并接受许可证

这是一个为我工作的解决scheme:

  1. 安装Xcode的命令行工具

     Xcode -> Preferences -> Downloads 
  2. 帮助MacPortsfind正确的Xcode文件夹

     sudo /usr/bin/xcode-select -switch /Applications/Xcode.app 
  3. 为叮当编译器创build符号链接,因为他们现在住在其他地方

     sudo ln -s `which clang` /Applications/Xcode.app/Contents/Developer/usr/bin/ sudo ln -s `which clang++` /Applications/Xcode.app/Contents/Developer/usr/bin/ 

尝试使用主干,还没有支持Xcode 4.3的发布。

在/opt/local/etc/macports.conf中设置开发者path对我有效,

 developer_dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain 

因为大多数编译器现在存储在那里,而不是在Developer下的/ usr / bin。

这对我来说没有任何作用。 等待macports发布官方支持XCode 4.3+的新版本

 sudo mv /usr/bin/xcodebuild /usr/bin/xcodebuild.old sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild /usr/bin/xcodebuild 

从Xcode 4.3开始,默认情况下不会安装命令行构build工具。 启动Xcode,打开首选项,然后转到下载选项卡。 从那里你应该有一个选项来安装命令行工具。

您也可以从网上下载它们: https : //developer.apple.com/downloads/index.action

免责声明:我还没有安装Xcode 4.3。 我只是在网上阅读。

截至2012年2月27日,MacPorts的官方build议似乎是不使用XCode 4.3,而是使用4.1到4.2.1,可以从苹果下载。

有一个错误票据可能会有助于跟随这个演变。

顺便说一下,正如我在该错误报告的评论#11中所报告的那样,通过使用在这个问题中find的2个最为理智的build议,我能够build立没有警告的端口: sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer并将/opt/local/etc/macports/macports.conf中的developer_dir更改为/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain

我有没有pipe理员/ root权限安装macports,所以我无法testingxcodeselect答案。 不过,我观察到,颇尔·迈尔斯特德的答案奏效了,但最初并没有。 我发现,我没有接受Xcode 4.5许可协议

如果您刚刚安装了用于macports的Xcode,并且尚未接受Xcode许可证,则可能会收到原始post提供的错误。 当我使用/usr/bin/xcodebuild -version检查我的Xcode版本时,我被提示阅读并接受许可证。 这样做之后,在将Pallbuild议的更改提交到macports.conf developer_dir ,现在所有的工作都已经完成。

作为select:您可以将Xcode降级到4.2.1版本。 Xcode 4.2.1的DMG放在这里: https : //developer.apple.com/downloads/index.action

在这之后MacPorts变得对我来说很好。

这在MacPorts 2.0.4中修复。

升级:

  1. 从安装站点下载MacPorts 2.0.4或运行sudo port selfupdate
  2. 运行此处描述的MacPorts迁移以重新安装所有端口。 这是痛苦的,但需要恢复到工作状态。

你应该像在这里所有人一样运行sudo xcode-select -switch /Applications/Xcode.app ,这将解决许多问题,但肯定不是全部。

Afaik,所有其余的问题都存在于各种软件包的configuration信息中。 您可能只需按照迁移说明中的描述重新安装MacPorts,但是我find了另一个解决scheme。


你应该开始使用像grep /Developer/ ...这样的命令,在执行sudo bashcd /opt/local自然地查找所有受影响的端口文件。

你应该通过使用port provides ...来识别所有受到影响的端口,我通过sedsort | uniq sort | uniq 。 您可以简单地重新安装所有这些端口使用port -n upgrade --force ...或单独的port uninstall ...port install ...命令。

我build议使用一个大的port -n upgrade --force ...命令来避免重复的依赖性重build,之后使用单独的卸载和安装命令。

当然有不同的端口,只有在文本configuration文件里面有/Developer ,这意味着你可以使用sed -i -e 's/\/Developer//g' ...来手动修复它们,但是你不能用二进制文件明显。

恐怕你至less要重build所有的Python和Perl安装,这个升级是清理依赖老版本ala python26perl5.8软件包的理想时间。

有几个技术上受到影响的端口,我决定不重build像fuse4x-kext ,其中包含Library/Extensions/fuse4x.kext/Contents/MacOS/fuse4x但并没有阻止sshfs正常工作。

我最初安装了xcode 3.2.2,之后我安装了4.3。 当我运行xcode-select时,我仍然得到了关于/ Applications中没有xcode项目的错误。 然后我深入到/ usr / bin / xcodebuild脚本中,发现这个工作正常,xcodebuild的另一个实例(与xcode 4.3一起安装,不在/ usr / bin中)正在运行并返回错误:

xcodebuild:错误:目录/应用程序不包含Xcode项目。

看来/ usr / bin / xcode-select对xcode 4.3不起作用,(它被编译,所以你不能真正明白为什么它不工作)。 string不给任何线索。 好事情OSX有strace ..哦,等等。

无论如何,我能做的最好的是修改/opt/local/etc/macports.conf并取消注释包含xcode安装path的行。 这似乎解决了我的问题的大部分。