c++macosqtcapybara-webkitosx-yosemite

capybara-webkit on yosemite g++: error: unrecognized command line option '-Xarch_x86_64'


I'm having problem installing on OS X 10.10 Yosemite, running with gcc4.9.2 and qt 4.8.6 installed via Brew.

gem install capybara-webkit

Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.

 /usr/local/var/rbenv/versions/2.1.4/bin/ruby extconf.rb
cd src/ && /usr/local/bin/qmake /usr/local/rbenv/gem/gems/capybara-webkit-1.3.1/src/webkit_server.pro -spec /usr/local/Cellar/qt/4.8.6/mkspecs/macx-g++ -o Makefile.webkit_server
cd src/ && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile.webkit_server 
g++ -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.6/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.8.6/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/include -Ibuild -F/usr/local/Cellar/qt/4.8.6/lib -x c++-header -c stable.h -o build/webkit_server.gch/c++

g++: error: unrecognized command line option '-Xarch_x86_64'

make[1]: *** [build/webkit_server.gch/c++] Error 1

make: *** [sub-src-webkit_server-pro-make_default-ordered] Error 2

Command 'make' failed

Solution

  • I had the same problem using GCC installed via MacPorts (tested several versions up to gcc5). The solution for me was using g++ supplied with the XCode command line tools. I uninstalled all MacPorts GCC versions. Below version details of the g++ command that worked.

    $ g++ --version
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
    Target: x86_64-apple-darwin13.4.0
    Thread model: posix
    

    A similar problem was asked here: QT Creator adds -Xarch.