caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Caffe on OS X 10.10 - architecture x86_64 issue

Open abhisheksimhadri opened this issue 11 years ago • 5 comments

Hi

I followed the steps on the caffe installation page. The libstdc++ installation is tricky, however everything worked like a charm.

All installations through Homebrew.

""Warning: boost-1.57.0 already installed Warning: snappy-1.1.1 already installed Warning: leveldb-1.18 already installed Warning: protobuf-2.6.1 already installed Warning: gflags-2.1.2 already installed Warning: glog-0.3.4 already installed Warning: szip-2.1 already installed Warning: lmdb-0.9.14 already installed Warning: opencv-2.4.10.1 already installed""

I also added the following edits to the "def install" procedure of each of the above.

"" # ADD THE FOLLOWING: ENV.append "CXXFLAGS", "-stdlib=libstdc++" ENV.append "CFLAGS", "-stdlib=libstdc++" ENV.append "LDFLAGS", "-stdlib=libstdc++ -lstdc++" # The following is necessary because libtool likes to strip LDFLAGS: ENV["CXX"] = "/usr/bin/clang++ -stdlib=libstdc++" ""

There were no linking errors in the following snippet and everything worked just fine:

""for x in snappy leveldb gflags glog szip lmdb homebrew/science/opencv; do brew uninstall $x; brew install --build-from-source --fresh -vd $x; done brew uninstall protobuf; brew install --build-from-source --with-python --fresh -vd protobuf brew install --build-from-source --fresh -vd boost boost-python ""

There were no errors in Brew update either ""Abhisheks-iMac:caffe abhisheksimhadri$ brew update Already up-to-date. Abhisheks-iMac:caffe abhisheksimhadri$ ""

If I try to make all in caffe, I get the following architecture X86_64 error. Why is this happening? "" Abhisheks-iMac:caffe abhisheksimhadri$ make all PROTOC src/caffe/proto/caffe.proto CXX .build_release/src/caffe/proto/caffe.pb.cc CXX src/caffe/blob.cpp CXX src/caffe/common.cpp CXX src/caffe/data_transformer.cpp CXX src/caffe/internal_thread.cpp CXX src/caffe/layer_factory.cpp CXX src/caffe/layers/absval_layer.cpp CXX src/caffe/layers/accuracy_layer.cpp CXX src/caffe/layers/argmax_layer.cpp CXX src/caffe/layers/base_conv_layer.cpp CXX src/caffe/layers/base_data_layer.cpp CXX src/caffe/layers/bnll_layer.cpp CXX src/caffe/layers/concat_layer.cpp CXX src/caffe/layers/contrastive_loss_layer.cpp CXX src/caffe/layers/conv_layer.cpp CXX src/caffe/layers/cudnn_conv_layer.cpp CXX src/caffe/layers/cudnn_pooling_layer.cpp CXX src/caffe/layers/cudnn_relu_layer.cpp CXX src/caffe/layers/cudnn_sigmoid_layer.cpp CXX src/caffe/layers/cudnn_softmax_layer.cpp CXX src/caffe/layers/cudnn_tanh_layer.cpp CXX src/caffe/layers/data_layer.cpp CXX src/caffe/layers/deconv_layer.cpp CXX src/caffe/layers/dropout_layer.cpp CXX src/caffe/layers/dummy_data_layer.cpp CXX src/caffe/layers/eltwise_layer.cpp CXX src/caffe/layers/euclidean_loss_layer.cpp CXX src/caffe/layers/exp_layer.cpp CXX src/caffe/layers/flatten_layer.cpp CXX src/caffe/layers/hdf5_data_layer.cpp CXX src/caffe/layers/hdf5_output_layer.cpp CXX src/caffe/layers/hinge_loss_layer.cpp CXX src/caffe/layers/im2col_layer.cpp CXX src/caffe/layers/image_data_layer.cpp CXX src/caffe/layers/infogain_loss_layer.cpp CXX src/caffe/layers/inner_product_layer.cpp CXX src/caffe/layers/loss_layer.cpp CXX src/caffe/layers/lrn_layer.cpp CXX src/caffe/layers/memory_data_layer.cpp CXX src/caffe/layers/multinomial_logistic_loss_layer.cpp CXX src/caffe/layers/mvn_layer.cpp CXX src/caffe/layers/neuron_layer.cpp CXX src/caffe/layers/pooling_layer.cpp CXX src/caffe/layers/power_layer.cpp CXX src/caffe/layers/prelu_layer.cpp CXX src/caffe/layers/relu_layer.cpp CXX src/caffe/layers/sigmoid_cross_entropy_loss_layer.cpp CXX src/caffe/layers/sigmoid_layer.cpp CXX src/caffe/layers/silence_layer.cpp CXX src/caffe/layers/slice_layer.cpp CXX src/caffe/layers/softmax_layer.cpp CXX src/caffe/layers/softmax_loss_layer.cpp CXX src/caffe/layers/split_layer.cpp CXX src/caffe/layers/tanh_layer.cpp CXX src/caffe/layers/threshold_layer.cpp CXX src/caffe/layers/window_data_layer.cpp CXX src/caffe/net.cpp CXX src/caffe/solver.cpp CXX src/caffe/syncedmem.cpp CXX src/caffe/util/benchmark.cpp CXX src/caffe/util/db.cpp CXX src/caffe/util/im2col.cpp CXX src/caffe/util/insert_splits.cpp CXX src/caffe/util/io.cpp CXX src/caffe/util/math_functions.cpp CXX src/caffe/util/upgrade_proto.cpp AR -o .build_release/lib/libcaffe.a /opt/local/bin/ranlib: file: .build_release/lib/libcaffe.a(cudnn_conv_layer.o) has no symbols /opt/local/bin/ranlib: file: .build_release/lib/libcaffe.a(cudnn_pooling_layer.o) has no symbols /opt/local/bin/ranlib: file: .build_release/lib/libcaffe.a(cudnn_relu_layer.o) has no symbols /opt/local/bin/ranlib: file: .build_release/lib/libcaffe.a(cudnn_sigmoid_layer.o) has no symbols /opt/local/bin/ranlib: file: .build_release/lib/libcaffe.a(cudnn_softmax_layer.o) has no symbols /opt/local/bin/ranlib: file: .build_release/lib/libcaffe.a(cudnn_tanh_layer.o) has no symbols LD -o .build_release/lib/libcaffe.so clang: warning: argument unused during compilation: '-pthread' Undefined symbols for architecture x86_64: "cv::imread(std::string const&, int)", referenced from: caffe::WindowDataLayer::InternalThreadEntry() in window_data_layer.o caffe::WindowDataLayer::InternalThreadEntry() in window_data_layer.o caffe::ReadImageToCVMat(std::string const&, int, int, bool) in io.o "cv::imencode(std::string const&, cv::InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)", referenced from: caffe::ReadImageToDatum(std::string const&, int, int, int, bool, std::string const&, caffe::Datum) in io.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *_* [.build_release/lib/libcaffe.so] Error 1

""

I am not using cuDNN and have commented it in the makefile.config

thanks for the help.

abhisheksimhadri avatar Apr 04 '15 19:04 abhisheksimhadri

Please ask installation questions on the caffe-users group. The already installed warnings mean that none of those packages are linked to libstdc++ if that was your edit. However on OS X 10.10 it is best to use CUDA 7 and libc++ and not re-link anything.

shelhamer avatar Apr 27 '15 08:04 shelhamer

@abhisheksimhadri I have the same problem, but it is solved after using cmake to configure your project.

zhangtemplar avatar Apr 28 '15 04:04 zhangtemplar

I got it to work. the CUDA had upgraded to 7 and hence I had to remove all the libstd++ lines ... thanks  Just FYI ... cuDNN v2 is not compatible with CUDA 7 on Mac OSX. 

 On Tuesday, 28 April 2015 9:45 AM, Qiang Zhang <[email protected]> wrote:

@abhisheksimhadri I have the same problem, but it is solved after using cmake to configure your project.— Reply to this email directly or view it on GitHub.

abhisheksimhadri avatar Apr 28 '15 08:04 abhisheksimhadri

Hi, I encounter the same problem with you, and you say remove all the libstd++ lines, I get a little confused, do you mean remove libstd++ lines in brew formula file or caffe makefile? Thanks

yinchuandong avatar Apr 29 '15 13:04 yinchuandong

Use the following command in your terminal:

for x in snappy leveldb protobuf gflags glog szip boost boost-python lmdb homebrew/science/opencv; do brew edit $x; done

remove the following lines from def install

  ENV.append "CXXFLAGS", "-stdlib=libstdc++"
  ENV.append "CFLAGS", "-stdlib=libstdc++"
  ENV.append "LDFLAGS", "-stdlib=libstdc++ -lstdc++"
  # The following is necessary because libtool likes to strip LDFLAGS:
  ENV["CXX"] = "/usr/bin/clang++ -stdlib=libstdc++"

abhisheksimhadri avatar Apr 29 '15 18:04 abhisheksimhadri