homebrew install for gfortran fails for xcode 4.2 - xcode4

I have xcode4.2 installed and because of that, I am unable to get gfortran installed via homebrew.
Here's the error:
calvin$ brew -v install gfortran
Homebrew 0.8
==> Downloading http://r.research.att.com/gfortran-lion-5666-3.pkg
/usr/bin/curl -f#LA Homebrew 0.8 (Ruby 1.8.7-249; Mac OS X 10.7.2) http://r.research.att.com /gfortran-lion-5666-3.pkg -o /Users/calvin/Library/Caches/Homebrew/gfortran-4.2.4-5666.3.pkg
######################################################################## 100.0%^[[B
/usr/bin/xar -xf /Users/calvin/Library/Caches/Homebrew/gfortran-4.2.4-5666.3.pkg
mv *.pkg/Payload Payload.gz
ls | grep -v Payload | xargs rm -r
/usr/bin/gcc
Error: Currently the gfortran compiler provided by this brew is only supported
for:
- XCode 3.1.4 on OS X 10.5.x
- XCode 3.2.2/3.2.3 -- 4.0 on OS X 10.6.x
- XCode 4.1 on OS X 10.7.x
The AppStore and Software Update can help upgrade your copy of XCode.
The latest version of XCode is also available from:
http://developer.apple.com/technologies/xcode.html
rmdir: /usr/local/Cellar/gfortran/4.2.4-5666.3 (empty)
Error: Nothing was installed to /usr/local/Cellar/gfortran/4.2.4-5666.3
How can I get this working (using xcode 4.2, downgrading my xcode 4.2 isn't really a good option) ?

Homebrew in my experience is the worst option to obtain gfortran on OS X.
Did you try binaries from this page?
Another option is MacPorts. And you can also compile gfortran from sources by yourself. It's not that difficult with XCode 3. However the story might be different with XCode 4, because of the default LLVM-compiler.
Is there any specific reason to use the latest version of XCode for you? Try binaries first. I didn't test them with XCode 4 but... Let us know if you try.

Related

Trouble installing R from homebrew formula (Intel Mac Pro)

I'm having trouble installing R from a homebrew formula on our Intel garbage can mac pro at work. I was having trouble installing tidyverse from source code so I removed and have been attempting to reinstalling R, as I thought it might have been a version mismatch somewhere.
I used
brew install R
and after a bunch of output where it's downloading other packages, I get back the following
==> Installing dependencies for r: libpng, freetype, fontconfig, gettext, libffi, pcre, glib, pkg-config, libpthread-stubs, xorgproto, libxau, libxdmcp, libxcb, libx11, libxext, libxrender, lzo, pixman, cairo, gmp, isl, mpfr, libmpc, lz4, xz, zstd, gcc, jpeg-turbo, openblas, pcre2, readline, ca-certificates, openssl#1.1 and tcl-tk
==> Installing r dependency: libpng
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
Error: Command failed with exit 129: git
Is this in fact a git error? What is the -C command?
Things I've tried:
removing and reinstalling command line tools
removing and reinstalling Homebrew
My machine:
Mac Pro (Late 2013)
2.7 GHz 12-Core Xeon E5
Thanks!
Sam
I think it tries to use an old version of git at /usr/bin/git, but you need to run brew install git to install a newer version of git to /usr/local/bin/git.
If /usr/local/bin/ isn't on your PATH before /usr/bin/, then you can add a line like this to ~/.bash_profile:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
However /usr/local/bin is included in /etc/paths by default, so it should be added to PATH by programs that run path_helper (like Terminal and iTerm 2 but not Script Editor or Emacs.app).

Can I use homebrew's qt5 with capybara-webkit?

I want to use qt5's QtWebKit with capybara-webkit.
brew uninstall qt
Uninstalling /usr/local/Cellar/qt/4.8.4...
brew install qt5
This formula is keg-only: so it was not symlinked into /usr/local.
🍺 /usr/local/Cellar/qt5/5.0.2: 3103 files, 140M, built in 60.9 minutes
If I force brew to create the symlinks for qt5 I can build the native extension for capybara-webkit ..
brew link --force qt5
Linking /usr/local/Cellar/qt5/5.0.2... 122 symlinks created
gem install capybara-webkit -v '1.0.0'
Successfully installed capybara-webkit-1.0.0
.. but webkit_server crashes hard ..
bundle exec rake test:integration
Errno::EADDRNOTAVAIL: Can't assign requested address - connect(2)
dyld: Library not loaded: /private/tmp/qt5-KytU/qt-everywhere-opensource-src-5.0.2/qtwebkit/lib/QtWebKit.framework/Versions/5/QtWebKit
Referenced from: /usr/local/opt/qt5/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets
Reason: image not found
See full osx crash report.
I tried installing capybara-webkit with LDFLAGS and CPPFLAGS but webkit_server still crashes hard.
env LDFLAGS=-L/usr/local/opt/qt5/lib \
CPPFLAGS=-I/usr/local/opt/qt5/include \
gem install capybara-webkit -v '1.0.0'
NOTE: IAmNaN here... this answer worked find for El Cap and Yosemite but it is no longer relevant as of MacOS Sierra. Instead follow the instructions from Thoughtbot. To summarize...
Download and install a new Qt from here.
Edit ~/Qt5.5.1/5.5/clang_64/mkspecs/features/mac/default_pre.prf.
Around line 15 find and replace -find xcrun 2 with -find xcodebuild 2.
Save and run PATH=~/Qt5.5.1/5.5/clang_64/bin:$PATH gem install capybara-webkit
Now back to our regularly scheduled answer....
I got this to work on OSX Yosemite. The reason for building against Qt5 was to get some fixes not in Qt4 that prevented capybara-webkit from using font and stylesheet assets in some circumstances.
Comment out the capybara and capybara-webkit gems from your gemfile. Then:
bundle
gem uninstall capybara-webkit
gem uninstall capybara # if it complains about dependencies 'gem uninstall' them first
brew remove qt
brew remove qt5 # if you've been playing around
From a clean environment (restart your terminal):
brew tap homebrew/versions
brew install qt55
brew linkapps qt55
brew link --force qt55
Uncomment capybara and capybara-webkit in the gemfile and then:
bundle install
Note: You may safely ignore the "brew unlink" warnings issued by brew doctor.
Two years later, the same steps from my question now work. Thanks, whoever fixed it.
gem uninstall --all capybara-webkit
brew remove qt
brew install qt5
brew linkapps qt5 # optional?
brew link --force qt5
gem install capybara-webkit
After installing qt5, I no longer see this message from my test suite:
WARNING: The next major version of capybara-webkit will require at least version 5.0 of Qt.
Uninstalling the capybara gem is not necessary (as other answers suggest) because it has no native extensions, thus no direct dependency on QT.
According to https://github.com/thoughtbot/capybara-webkit/issues/885 , QT stopped working with webkit at version 5.6. However, there is a qt55 brew available, so use qt55 (instead of qt5) in the answers above.
I suggest to brew update, brew remove qt5 and brew install qt5, because I find on my system, that:
xcrun otool -L /usr/local/Cellar/qt5/5.0.2/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets
[snip]
/usr/local/Cellar/qt5/5.0.2/src/qtwebkit/lib/QtWebKit.framework/Versions/5/QtWebKit (compatibility version 5.0.0, current version 5.0.2)
So Qt5 does link against QtWebKit and the link is valid on my system in contrast to yours.
Therefore the suggestion to reinstall. If homebrew installs the prebuilt bottle and still has this issue, please report on Homebrew's issue tracker on github. I installed mine from source.
However, I guess an upstream issue (a minor one) is that the link points into src which should probably lib. But that is up to Qt to fix.

How to install Allegro 5 on Mac oSX Lion with XCode

I am new to mac development and was wondering how I can install Allegro 5 on my Mac. I want to use allegro with Xcode, and I am running Lion. How do I install allegro?
This can found here: http://wiki.allegro.cc/index.php?title=OSX,_Xcode_4,_Framework
If you are using OS X Lion (10.7.x) and Xcode 4.3 you will run into an issue that is not explained in the wiki. When I would attempt to create a new project and include all the frameworks as instructed and after several hours of truing to find an answer I finally stumbled across my issue.
What you may see is an error similar to:
Undefined symbols for architecture x86_64:
"_main", referenced from: ......
This is because for whatever reason AllegroMain-5.0.framework was not added to Summary->Linked Frameworks and Libraries. once you add this its should work!
Install homebrew in Link
Use the Brew by following these steps:
brew install cmake
brew install zlib
brew install freetype
brew install jpeg
brew install libogg
brew install physfs
brew install libpng
brew install flac
brew install ffmpeg
brew install allegro5
Works for me

How can I install QT on Lion 10.7.3 with XCode 4.3 installed?

I'm having problems installing QT on my MacBook with Lion 10.7.3 and XCode 4.3.1 installed. I tried to install with brew, and got a compiler error. Below is the end of the error, and the "brew doctor" output. It seems to be using the wrong version of gcc... although I just installed the latest XCode. Any ideas? I'm trying to install QT, so I can run headless browser tests with capybara-webkit. (I also tried with --install-from-source and got the same error.)
gstroup$ brew install qt
....
kernel/qcocoaview_mac.mm:1386:61: error: cannot initialize a parameter of type 'NSString *' with an lvalue of type 'const NSString *'
return [[[NSAttributedString alloc] initWithString:tmpString] autorelease];
^~~~~~~~~
/System/Library/Frameworks/Foundation.framework/Headers/NSAttributedString.h:28:34: note: passing argument to parameter 'str' here
- (id)initWithString:(NSString )str;
^
2 errors generated.
make[2]: [.obj/release-shared/qcocoaview_mac.o] Error 1
make[1]: [release] Error 2
make: ** [sub-gui-make_default-ordered] Error 2
==> Exit Status: 2
http://github.com/mxcl/homebrew/blob/master/Library/Formula/qt.rb#L76
==> Environment
/usr/bin/gcc
HOMEBREW_VERSION: 0.8
HEAD: 64e489663add868db679cca2186ff8d7796e5d9e
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: 8-core 64-bit dunno
OS X: 10.7.3
Kernel Architecture: x86_64
Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode: 4.3.1
GCC-4.0: N/A
GCC-4.2: build 401 (5664 or newer recommended)
LLVM: build 2336
MacPorts or Fink? false
X11 installed? true
==> Build Flags
CC: /usr/bin/cc => /usr/bin/clang
CXX: /usr/bin/c++ => /usr/bin/clang
LD: /usr/bin/cc => /usr/bin/clang
CFLAGS: -O3 -w -pipe
CXXFLAGS: -O3 -w -pipe -fvisibility=hidden
MAKEFLAGS: -j8
Error: Failed executing: make
Please report this bug: https://github.com/mxcl/homebrew/wiki/new-issue
Also try:
brew doctor to check your setup for common problems.
brew missing to check installed packages for missing deps.
gstroup$ brew doctor
/usr/bin/gcc
Your gcc 4.2.x version is older than the recommended version. It may be advisable
to upgrade to the latest release of Xcode.
We couldn't detect gcc 4.0.x. Some formulae require this compiler.
/usr/bin is in your PATH before Homebrew's bin. This means that system-
provided programs will be used before Homebrew-provided ones. This is an
issue if you install, for instance, Python.
Consider editing your .bashrc to put:
/usr/local/bin
ahead of /usr/bin in your $PATH.
Some brews install binaries to sbin instead of bin, but Homebrew's
sbin was not found in your path.
Consider editing your .bashrc to add:
/usr/local/sbin
to $PATH.
/usr/bin/gcc
gstroup$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Xcode 4.3.x switched away from gcc as the compiler. Now Apple uses llvm. This maybe the root of your issue. There is a Github project https://github.com/kennethreitz/osx-gcc-installer/downloads that will let you download a gcc compiler.
You may have to prefix your brew command with env CC=/usr/bin/gcc to specify the gcc compiler.

Help to fix strange sqlite3 error - dyld: Library not loaded: /usr/lib/libsqlite3.0.dylib

I am suddenly getting an sqlite3 error:
ActionView::Template::Error (dyld: Library not loaded: /usr/lib/libsqlite3.0.dylib
Referenced from: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
Reason: no suitable image found. Did find:
/usr/lib/libsqlite3.0.dylib: mach-o, but wrong architecture
/usr/local/lib/libsqlite3.0.dylib: mach-o, but wrong architecture
/usr/lib/libsqlite3.0.dylib: mach-o, but wrong architecture
I have no idea why I am suddenly getting this error. Rails 3.1.0 and Ruby 1.9.2 Mac OSX 10.5.8
Okay so this is a messed up sqlite3 install and it seems that lots of people run into this problem but solutions are a little hard to come by. After a lot of googling I did the following:
Step1: went to http://www.sqlite.org/download.html and downloaded sqlite-autoconf-3070800.tar.gz under source code
Step2: expand file and cd into the resultant directory
Step3: sudo CFLAGS='-arch i686 -arch x86_64' LDFLAGS='-arch i686 -arch x86_64' ./configure --disable-dependency-tracking
Step4: sudo make install
Step5: added /usr/local/lib to the path
I was doing an awful lot of tinkering during this time. It's possible that I have done something else along the way and not realized and not included it here. But these steps seemed to fix the problem for me.
My environment: Mac OSX 10.5.8 MacBookPro4, Intel Core 2 Duo, 2.5 GHz
Thank you so much, in my case I had to rearrange the parameters and I didn't use sudo to configure nor to make:
make clean
./configure --disable-dependency-tracking --prefix=/usr CFLAGS='-arch i686 -arch x86_64' LDFLAGS='-arch i686 -arch x86_64'
make
sudo make install
I didn't have to modify the path, I specified in the --prefix="my path"
Environment Mac OS X v.10.5.8 2GHz Intel Core 2 Duo
Exactly same problem but the solutions here didn't work for me.
Instead reinstalling sqlite3 gem fixed the problem for me.
Environment: Mac OS X v. 10.6.8, iMac

Resources