编译phantomjs时Xcode没有正确设置

时间:2017-06-16 08:05:48

标签: xcode macos phantomjs

我在phantomjs之后打了一个these instructions的分叉。我已经从Appstore安装了完整的Xcode,并接受了许可协议(例如sudo xcodebuild -license),这似乎是关于此错误的其他SO问题的问题。但是当我尝试编译时:

My-MBPX:phantomjs username$ python build.py
Password:
----------------------------------------
               WARNING
----------------------------------------

Building PhantomJS from source takes a very long time, anywhere from 30 minutes
to several hours (depending on the machine configuration). It is recommended to
use the premade binary packages on supported operating systems.

For details, please go the the web site: http://phantomjs.org/download.html.

Do you want to continue (Y/n)? Y
Executing in /Users/username/Documents/github/phantomjs: git submodule init
Executing in /Users/username/Documents/github/phantomjs: git submodule update --init
configuring Qt Base, please wait...
Found OpenSSL installed via Brew
Executing in /Users/username/Documents/github/phantomjs/src/qt/qtbase: /Users/username/Documents/github/phantomjs/src/qt/qtbase/configure -static -opensource -confirm-license -prefix /Users/username/Documents/github/phantomjs/src/qt/qtbase -qt-zlib -qt-libpng -qt-libjpeg -qt-pcre -nomake examples -nomake tools -nomake tests -no-qml-debug -no-dbus -no-opengl -no-audio-backend -D QT_NO_GRAPHICSVIEW -D QT_NO_GRAPHICSEFFECT -D QT_NO_STYLESHEET -D QT_NO_STYLE_CDE -D QT_NO_STYLE_CLEANLOOKS -D QT_NO_STYLE_MOTIF -D QT_NO_STYLE_PLASTIQUE -D QT_NO_PRINTPREVIEWDIALOG -qpa phantom -openssl -openssl-linked -no-openvg -no-eglfs -no-egl -no-glib -no-gtkstyle -no-cups -no-sm -no-xinerama -no-xkb -no-xcb -no-kms -no-linuxfb -no-directfb -no-mtdev -no-libudev -no-evdev -no-pulseaudio -no-alsa -no-feature-PRINTPREVIEWWIDGET -no-pkg-config -no-c++11 -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -release

   Xcode not set up properly. You may need to confirm the license
   agreement by running /usr/bin/xcodebuild without arguments.

ERROR: Failed to build PhantomJS! Configuration of Qt Base failed.

使用sudo的结果相同。然后按照建议运行/usr/bin/xcodebuild返回:

xcodebuild: error: The directory /Users/username/Documents/github/phantomjs does not contain an Xcode project.

我确实不得不在现有命令行工具版本的基础上升级Xtools,并手动更改路径(sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer),但现在正确报告:

xcode-select -p
/Applications/Xcode.app/Contents/Developer

感谢任何建议。

1 个答案:

答案 0 :(得分:2)

This solution似乎有效:

cd /Applications/Xcode.app/Contents/Developer/usr/bin/
sudo ln -s xcodebuild xcrun