# libstdc++ instead of libc++ for CUDA compatibility on 10.9
ifeq ($(OSX), 1)
CXX := /usr/bin/clang++
+ CXXFLAGS += -stdlib=libstdc++
+ LINKFLAGS += -stdlib=libstdc++
# clang throws this warning for cuda headers
WARNINGS += -Wno-unneeded-internal-declaration
- ifneq ($(findstring 10.9, $(shell sw_vers -productVersion)),)
- CXXFLAGS += -stdlib=libstdc++
- LINKFLAGS += -stdlib=libstdc++
- endif
+ # gtest needs to use its own tuple to not conflict with clang
+ CXXFLAGS += -DGTEST_USE_OWN_TR1_TUPLE=1
# boost::thread is called boost_thread-mt to mark multithreading on OS X
LIBRARIES += boost_thread-mt
- NVCCFLAGS += -DOSX
+ NVCCFLAGS += -DOSX
endif
# Custom compiler
endif
else ifeq ($(OSX), 1)
# OS X packages atlas as the vecLib framework
- BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
LIBRARIES += cblas
- LDFLAGS += -framework vecLib
+ # 10.10 has accelerate while 10.9 has veclib
+ XCODE_CLT_VER := $(shell pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep -o 'version: 6')
+ ifneq (,$(findstring version: 6,$(XCODE_CLT_VER)))
+ BLAS_INCLUDE ?= /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/
+ LDFLAGS += -framework Accelerate
+ else
+ BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
+ LDFLAGS += -framework vecLib
+ endif
endif
endif
INCLUDE_DIRS += $(BLAS_INCLUDE)
# Installation
Prior to installing, it is best to read through this guide and take note of the details for your platform.
-We have installed Caffe on Ubuntu 14.04, Ubuntu 12.04, OS X 10.9, and OS X 10.8.
+We have installed Caffe on Ubuntu 14.04, Ubuntu 12.04, OS X 10.10, 10.9, and 10.8.
- [Prerequisites](#prerequisites)
- [Compilation](#compilation)
**Note** that the HDF5 dependency is provided by Anaconda Python in this case.
If you're not using Anaconda, include `hdf5` in the list above.
-#### 10.9-specific Instructions
+#### 10.10- and 10.9-specific Instructions
-In OS X 10.9, clang++ is the default C++ compiler and uses `libc++` as the standard library.
+In OS X 10.9+, clang++ is the default C++ compiler and uses `libc++` as the standard library.
However, NVIDIA CUDA (even version 6.0) currently links only with `libstdc++`.
This makes it necessary to change the compilation settings for each of the dependencies.
git checkout master
cd /usr/local/Library/Taps/homebrew/homebrew-science
git checkout master
-
+
# Update homebrew; hopefully this works without errors!
brew update
-
+
# Switch back to the caffe branches with the forumlae that you modified earlier
cd /usr/local
git rebase master caffe
cd /usr/local/Library/Taps/homebrew/homebrew-science
git rebase master caffe
# Fix any merge conflicts and commit to caffe branch
-
- # Done!
+
+ # Done!
At this point, you should be running the latest Homebrew packages and your Caffe-related modifications will remain in place.