对于caffe构建,我收到了此错误。我该如何解决?
我正在使用Mac OSX Yosemite 10.10.1。

控制台日志

Machida-no-MacBook-Air:caffe machidahiroaki$ /usr/bin/clang++ -shared -o .build_release/lib/libcaffe.so .build_release/src/caffe/proto/caffe.pb.o .build_release/src/caffe/proto/caffe_pretty_print.pb.o .build_release/src/caffe/blob.o .build_release/src/caffe/common.o .build_release/src/caffe/data_transformer.o .build_release/src/caffe/dataset_factory.o .build_release/src/caffe/internal_thread.o .build_release/src/caffe/layer_factory.o .build_release/src/caffe/layers/absval_layer.o .build_release/src/caffe/layers/accuracy_layer.o .build_release/src/caffe/layers/argmax_layer.o .build_release/src/caffe/layers/base_data_layer.o .build_release/src/caffe/layers/bnll_layer.o .build_release/src/caffe/layers/concat_layer.o .build_release/src/caffe/layers/contrastive_loss_layer.o .build_release/src/caffe/layers/conv_layer.o .build_release/src/caffe/layers/cudnn_conv_layer.o .build_release/src/caffe/layers/cudnn_pooling_layer.o .build_release/src/caffe/layers/cudnn_relu_layer.o .build_release/src/caffe/layers/cudnn_sigmoid_layer.o .build_release/src/caffe/layers/cudnn_softmax_layer.o .build_release/src/caffe/layers/cudnn_tanh_layer.o .build_release/src/caffe/layers/data_layer.o .build_release/src/caffe/layers/dropout_layer.o .build_release/src/caffe/layers/dummy_data_layer.o .build_release/src/caffe/layers/eltwise_layer.o .build_release/src/caffe/layers/euclidean_loss_layer.o .build_release/src/caffe/layers/exp_layer.o .build_release/src/caffe/layers/flatten_layer.o .build_release/src/caffe/layers/hdf5_data_layer.o .build_release/src/caffe/layers/hdf5_output_layer.o .build_release/src/caffe/layers/hinge_loss_layer.o .build_release/src/caffe/layers/im2col_layer.o .build_release/src/caffe/layers/image_data_layer.o .build_release/src/caffe/layers/infogain_loss_layer.o .build_release/src/caffe/layers/inner_product_layer.o .build_release/src/caffe/layers/loss_layer.o .build_release/src/caffe/layers/lrn_layer.o .build_release/src/caffe/layers/memory_data_layer.o .build_release/src/caffe/layers/multinomial_logistic_loss_layer.o .build_release/src/caffe/layers/mvn_layer.o .build_release/src/caffe/layers/neuron_layer.o .build_release/src/caffe/layers/pooling_layer.o .build_release/src/caffe/layers/power_layer.o .build_release/src/caffe/layers/relu_layer.o .build_release/src/caffe/layers/sigmoid_cross_entropy_loss_layer.o .build_release/src/caffe/layers/sigmoid_layer.o .build_release/src/caffe/layers/silence_layer.o .build_release/src/caffe/layers/slice_layer.o .build_release/src/caffe/layers/softmax_layer.o .build_release/src/caffe/layers/softmax_loss_layer.o .build_release/src/caffe/layers/split_layer.o .build_release/src/caffe/layers/tanh_layer.o .build_release/src/caffe/layers/threshold_layer.o .build_release/src/caffe/layers/window_data_layer.o .build_release/src/caffe/leveldb_dataset.o .build_release/src/caffe/lmdb_dataset.o .build_release/src/caffe/net.o .build_release/src/caffe/solver.o .build_release/src/caffe/syncedmem.o .build_release/src/caffe/util/benchmark.o .build_release/src/caffe/util/im2col.o .build_release/src/caffe/util/insert_splits.o .build_release/src/caffe/util/io.o .build_release/src/caffe/util/math_functions.o .build_release/src/caffe/util/upgrade_proto.o -stdlib=libstdc++ -pthread -fPIC -DNDEBUG -O2 -DCPU_ONLY -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/atlas/include -Wall -Wno-sign-compare -Wno-unneeded-internal-declaration --verbose -framework Accelerate -L/usr/lib -L/usr/local/include -L/usr/local/lib -L/usr/lib -L/usr/local/atlas/lib -L.build_release/lib  -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lm -lopencv_core -lopencv_highgui -lopencv_imgproc -lboost_thread-mt -lcblas
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
clang: warning: argument unused during compilation: '-pthread'
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -dylib -arch x86_64 -macosx_version_min 10.10.0 -o .build_release/lib/libcaffe.so -L/usr/lib -L/usr/local/include -L/usr/local/lib -L/usr/lib -L/usr/local/atlas/lib -L.build_release/lib .build_release/src/caffe/proto/caffe.pb.o .build_release/src/caffe/proto/caffe_pretty_print.pb.o .build_release/src/caffe/blob.o .build_release/src/caffe/common.o .build_release/src/caffe/data_transformer.o .build_release/src/caffe/dataset_factory.o .build_release/src/caffe/internal_thread.o .build_release/src/caffe/layer_factory.o .build_release/src/caffe/layers/absval_layer.o .build_release/src/caffe/layers/accuracy_layer.o .build_release/src/caffe/layers/argmax_layer.o .build_release/src/caffe/layers/base_data_layer.o .build_release/src/caffe/layers/bnll_layer.o .build_release/src/caffe/layers/concat_layer.o .build_release/src/caffe/layers/contrastive_loss_layer.o .build_release/src/caffe/layers/conv_layer.o .build_release/src/caffe/layers/cudnn_conv_layer.o .build_release/src/caffe/layers/cudnn_pooling_layer.o .build_release/src/caffe/layers/cudnn_relu_layer.o .build_release/src/caffe/layers/cudnn_sigmoid_layer.o .build_release/src/caffe/layers/cudnn_softmax_layer.o .build_release/src/caffe/layers/cudnn_tanh_layer.o .build_release/src/caffe/layers/data_layer.o .build_release/src/caffe/layers/dropout_layer.o .build_release/src/caffe/layers/dummy_data_layer.o .build_release/src/caffe/layers/eltwise_layer.o .build_release/src/caffe/layers/euclidean_loss_layer.o .build_release/src/caffe/layers/exp_layer.o .build_release/src/caffe/layers/flatten_layer.o .build_release/src/caffe/layers/hdf5_data_layer.o .build_release/src/caffe/layers/hdf5_output_layer.o .build_release/src/caffe/layers/hinge_loss_layer.o .build_release/src/caffe/layers/im2col_layer.o .build_release/src/caffe/layers/image_data_layer.o .build_release/src/caffe/layers/infogain_loss_layer.o .build_release/src/caffe/layers/inner_product_layer.o .build_release/src/caffe/layers/loss_layer.o .build_release/src/caffe/layers/lrn_layer.o .build_release/src/caffe/layers/memory_data_layer.o .build_release/src/caffe/layers/multinomial_logistic_loss_layer.o .build_release/src/caffe/layers/mvn_layer.o .build_release/src/caffe/layers/neuron_layer.o .build_release/src/caffe/layers/pooling_layer.o .build_release/src/caffe/layers/power_layer.o .build_release/src/caffe/layers/relu_layer.o .build_release/src/caffe/layers/sigmoid_cross_entropy_loss_layer.o .build_release/src/caffe/layers/sigmoid_layer.o .build_release/src/caffe/layers/silence_layer.o .build_release/src/caffe/layers/slice_layer.o .build_release/src/caffe/layers/softmax_layer.o .build_release/src/caffe/layers/softmax_loss_layer.o .build_release/src/caffe/layers/split_layer.o .build_release/src/caffe/layers/tanh_layer.o .build_release/src/caffe/layers/threshold_layer.o .build_release/src/caffe/layers/window_data_layer.o .build_release/src/caffe/leveldb_dataset.o .build_release/src/caffe/lmdb_dataset.o .build_release/src/caffe/net.o .build_release/src/caffe/solver.o .build_release/src/caffe/syncedmem.o .build_release/src/caffe/util/benchmark.o .build_release/src/caffe/util/im2col.o .build_release/src/caffe/util/insert_splits.o .build_release/src/caffe/util/io.o .build_release/src/caffe/util/math_functions.o .build_release/src/caffe/util/upgrade_proto.o -framework Accelerate -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lm -lopencv_core -lopencv_highgui -lopencv_imgproc -lboost_thread-mt -lcblas -L. -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lstdc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "cv::imread(cv::String const&, int)", referenced from:
      caffe::WindowDataLayer<float>::InternalThreadEntry() in window_data_layer.o
      caffe::WindowDataLayer<double>::InternalThreadEntry() in window_data_layer.o
      caffe::ReadImageToCVMat(std::string const&, int, int, bool) in io.o
  "cv::imdecode(cv::_InputArray const&, int)", referenced from:
      caffe::DecodeDatumToCVMat(caffe::Datum const&, int, int, bool) 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)

src/caffe/layers/window_data_layer.cpp包括
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

看来我有正确的库。 (这是正确的检查吗?)
Machida-no-MacBook-Air:caffe machidahiroaki$ find /usr/local/lib -name libopencv_*.dylib | grep 'core\|highgui\|imgproc' | xargs ls -ltr
lrwxr-xr-x  1 machidahiroaki  admin  49  1 10 10:23 /usr/local/lib/libopencv_imgproc.dylib -> ../Cellar/opencv/HEAD/lib/libopencv_imgproc.dylib
lrwxr-xr-x  1 machidahiroaki  admin  53  1 10 10:23 /usr/local/lib/libopencv_imgproc.3.0.dylib -> ../Cellar/opencv/HEAD/lib/libopencv_imgproc.3.0.dylib
lrwxr-xr-x  1 machidahiroaki  admin  55  1 10 10:23 /usr/local/lib/libopencv_imgproc.3.0.0.dylib -> ../Cellar/opencv/HEAD/lib/libopencv_imgproc.3.0.0.dylib
lrwxr-xr-x  1 machidahiroaki  admin  49  1 10 10:23 /usr/local/lib/libopencv_highgui.dylib -> ../Cellar/opencv/HEAD/lib/libopencv_highgui.dylib
lrwxr-xr-x  1 machidahiroaki  admin  53  1 10 10:23 /usr/local/lib/libopencv_highgui.3.0.dylib -> ../Cellar/opencv/HEAD/lib/libopencv_highgui.3.0.dylib
lrwxr-xr-x  1 machidahiroaki  admin  55  1 10 10:23 /usr/local/lib/libopencv_highgui.3.0.0.dylib -> ../Cellar/opencv/HEAD/lib/libopencv_highgui.3.0.0.dylib
lrwxr-xr-x  1 machidahiroaki  admin  46  1 10 10:23 /usr/local/lib/libopencv_core.dylib -> ../Cellar/opencv/HEAD/lib/libopencv_core.dylib
lrwxr-xr-x  1 machidahiroaki  admin  50  1 10 10:23 /usr/local/lib/libopencv_core.3.0.dylib -> ../Cellar/opencv/HEAD/lib/libopencv_core.3.0.dylib
lrwxr-xr-x  1 machidahiroaki  admin  52  1 10 10:23 /usr/local/lib/libopencv_core.3.0.0.dylib -> ../Cellar/opencv/HEAD/lib/libopencv_core.3.0.0.dylib

Machida-no-MacBook-Air:caffe machidahiroaki$ ls -ltr /usr/local/Cellar/opencv/HEAD/lib/libopencv_*.dylib | grep 'core\|highgui\|imgproc'
lrwxr-xr-x  1 machidahiroaki  admin       24  1 10 10:23 /usr/local/Cellar/opencv/HEAD/lib/libopencv_core.dylib -> libopencv_core.3.0.dylib
lrwxr-xr-x  1 machidahiroaki  admin       26  1 10 10:23 /usr/local/Cellar/opencv/HEAD/lib/libopencv_core.3.0.dylib -> libopencv_core.3.0.0.dylib
lrwxr-xr-x  1 machidahiroaki  admin       27  1 10 10:23 /usr/local/Cellar/opencv/HEAD/lib/libopencv_imgproc.dylib -> libopencv_imgproc.3.0.dylib
lrwxr-xr-x  1 machidahiroaki  admin       29  1 10 10:23 /usr/local/Cellar/opencv/HEAD/lib/libopencv_imgproc.3.0.dylib -> libopencv_imgproc.3.0.0.dylib
lrwxr-xr-x  1 machidahiroaki  admin       27  1 10 10:23 /usr/local/Cellar/opencv/HEAD/lib/libopencv_highgui.dylib -> libopencv_highgui.3.0.dylib
lrwxr-xr-x  1 machidahiroaki  admin       29  1 10 10:23 /usr/local/Cellar/opencv/HEAD/lib/libopencv_highgui.3.0.dylib -> libopencv_highgui.3.0.0.dylib
-r--r--r--  1 machidahiroaki  admin  4305392  1 10 10:23 /usr/local/Cellar/opencv/HEAD/lib/libopencv_imgproc.3.0.0.dylib
-r--r--r--  1 machidahiroaki  admin    75352  1 10 10:23 /usr/local/Cellar/opencv/HEAD/lib/libopencv_highgui.3.0.0.dylib
-r--r--r--  1 machidahiroaki  admin  3437740  1 10 10:23 /usr/local/Cellar/opencv/HEAD/lib/libopencv_core.3.0.0.dylib

OpenCV库似乎是用libstdc++构建的,因为the official install guide暗示了这一点。
Machida-no-MacBook-Air:caffe machidahiroaki$ find /usr/local/lib -name libopencv_*.dylib | grep 'core\|highgui\|imgproc' | grep -v '3.0' | xargs otool -L
/usr/local/lib/libopencv_core.dylib:
    /usr/local/lib/libopencv_core.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
    /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/usr/local/lib/libopencv_highgui.dylib:
    /usr/local/lib/libopencv_highgui.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
    /usr/local/Cellar/opencv/HEAD/lib/libopencv_videoio.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 21.0.0)
    /usr/local/Cellar/opencv/HEAD/lib/libopencv_imgcodecs.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/Cellar/opencv/HEAD/lib/libopencv_imgproc.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/Cellar/opencv/HEAD/lib/libopencv_core.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1343.16.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1151.16.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1151.16.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/local/lib/libopencv_imgproc.dylib:
    /usr/local/lib/libopencv_imgproc.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
    /usr/local/Cellar/opencv/HEAD/lib/libopencv_core.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

使用-stdlib = libstdc++选项,所有构建命令均正确。
Machida-no-MacBook-Air:caffe machidahiroaki$ make -n | grep clang | grep -v stdlib=libstdc++

预先感谢您的帮助!

现在,我发现可以将ld与-v选项一起使用。
我一直在调查。
Machida-no-MacBook-Air:caffe machidahiroaki$ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -dylib -arch x86_64 -macosx_version_min 10.10.0 -o .build_release/lib/libcaffe.so -L/usr/lib -L/usr/local/include -L/usr/local/lib -L/usr/lib -L/usr/local/atlas/lib -L.build_release/lib .build_release/src/caffe/proto/caffe.pb.o .build_release/src/caffe/proto/caffe_pretty_print.pb.o .build_release/src/caffe/blob.o .build_release/src/caffe/common.o .build_release/src/caffe/data_transformer.o .build_release/src/caffe/dataset_factory.o .build_release/src/caffe/internal_thread.o .build_release/src/caffe/layer_factory.o .build_release/src/caffe/layers/absval_layer.o .build_release/src/caffe/layers/accuracy_layer.o .build_release/src/caffe/layers/argmax_layer.o .build_release/src/caffe/layers/base_data_layer.o .build_release/src/caffe/layers/bnll_layer.o .build_release/src/caffe/layers/concat_layer.o .build_release/src/caffe/layers/contrastive_loss_layer.o .build_release/src/caffe/layers/conv_layer.o .build_release/src/caffe/layers/cudnn_conv_layer.o .build_release/src/caffe/layers/cudnn_pooling_layer.o .build_release/src/caffe/layers/cudnn_relu_layer.o .build_release/src/caffe/layers/cudnn_sigmoid_layer.o .build_release/src/caffe/layers/cudnn_softmax_layer.o .build_release/src/caffe/layers/cudnn_tanh_layer.o .build_release/src/caffe/layers/data_layer.o .build_release/src/caffe/layers/dropout_layer.o .build_release/src/caffe/layers/dummy_data_layer.o .build_release/src/caffe/layers/eltwise_layer.o .build_release/src/caffe/layers/euclidean_loss_layer.o .build_release/src/caffe/layers/exp_layer.o .build_release/src/caffe/layers/flatten_layer.o .build_release/src/caffe/layers/hdf5_data_layer.o .build_release/src/caffe/layers/hdf5_output_layer.o .build_release/src/caffe/layers/hinge_loss_layer.o .build_release/src/caffe/layers/im2col_layer.o .build_release/src/caffe/layers/image_data_layer.o .build_release/src/caffe/layers/infogain_loss_layer.o .build_release/src/caffe/layers/inner_product_layer.o .build_release/src/caffe/layers/loss_layer.o .build_release/src/caffe/layers/lrn_layer.o .build_release/src/caffe/layers/memory_data_layer.o .build_release/src/caffe/layers/multinomial_logistic_loss_layer.o .build_release/src/caffe/layers/mvn_layer.o .build_release/src/caffe/layers/neuron_layer.o .build_release/src/caffe/layers/pooling_layer.o .build_release/src/caffe/layers/power_layer.o .build_release/src/caffe/layers/relu_layer.o .build_release/src/caffe/layers/sigmoid_cross_entropy_loss_layer.o .build_release/src/caffe/layers/sigmoid_layer.o .build_release/src/caffe/layers/silence_layer.o .build_release/src/caffe/layers/slice_layer.o .build_release/src/caffe/layers/softmax_layer.o .build_release/src/caffe/layers/softmax_loss_layer.o .build_release/src/caffe/layers/split_layer.o .build_release/src/caffe/layers/tanh_layer.o .build_release/src/caffe/layers/threshold_layer.o .build_release/src/caffe/layers/window_data_layer.o .build_release/src/caffe/leveldb_dataset.o .build_release/src/caffe/lmdb_dataset.o .build_release/src/caffe/net.o .build_release/src/caffe/solver.o .build_release/src/caffe/syncedmem.o .build_release/src/caffe/util/benchmark.o .build_release/src/caffe/util/im2col.o .build_release/src/caffe/util/insert_splits.o .build_release/src/caffe/util/io.o .build_release/src/caffe/util/math_functions.o .build_release/src/caffe/util/upgrade_proto.o -framework Accelerate -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lm -lopencv_core -lopencv_highgui -lopencv_imgproc -lboost_thread-mt -lcblas -L. -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lstdc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib/darwin/libclang_rt.osx.a -v
@(#)PROGRAM:ld  PROJECT:ld64-241.9
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7m armv7em
Library search paths:
    /usr/lib
    /usr/local/include
    /usr/local/lib
    /usr/lib
    /usr/local/atlas/lib
    .build_release/lib
    .
    /usr/local/lib
    /usr/local/lib
    /usr/local/lib
    /usr/local/lib
    /usr/lib
    /usr/local/lib
Framework search paths:
    /Library/Frameworks/
    /System/Library/Frameworks/
Undefined symbols for architecture x86_64:
  "cv::imread(cv::String const&, int)", referenced from:
      caffe::WindowDataLayer<float>::InternalThreadEntry() in window_data_layer.o
      caffe::WindowDataLayer<double>::InternalThreadEntry() in window_data_layer.o
      caffe::ReadImageToCVMat(std::string const&, int, int, bool) in io.o
  "cv::imdecode(cv::_InputArray const&, int)", referenced from:
      caffe::DecodeDatumToCVMat(caffe::Datum const&, int, int, bool) in io.o
ld: symbol(s) not found for architecture x86_64

Dylibs似乎包含适当的符号。
Machida-no-MacBook-Air:opencv2 machidahiroaki$ nm -g /usr/local/lib/libopencv_* | grep 'imread\|dylib' | grep -B 1 imread
/usr/local/lib/libopencv_imgcodecs.3.0.0.dylib:
0000000000004eb0 T __ZN2cv6imreadERKNS_6StringEi
--
/usr/local/lib/libopencv_imgcodecs.3.0.dylib:
0000000000004eb0 T __ZN2cv6imreadERKNS_6StringEi
--
/usr/local/lib/libopencv_imgcodecs.dylib:
0000000000004eb0 T __ZN2cv6imreadERKNS_6StringEi
--
/usr/local/lib/libopencv_superres.dylib:
                 U __ZN2cv6imreadERKNS_6StringEi
                 U __ZN2cv6imreadERKNS_6StringEi
                 U __ZN2cv6imreadERKNS_6StringEi


Machida-no-MacBook-Air:opencv2 machidahiroaki$ otool -L /usr/local/lib/libopencv_highgui.dylib | grep imgcodec
    /usr/local/Cellar/opencv/HEAD/lib/libopencv_imgcodecs.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)

Dylibs似乎具有适当的体系结构。嗯...
Machida-no-MacBook-Air:opencv2 machidahiroaki$ nm -arch x86_64 /usr/local/lib/libopencv_imgcodecs.dylib | grep imread
0000000000004eb0 T __ZN2cv6imreadERKNS_6StringEi
0000000000004f50 t __ZN2cvL7imread_ERKNS_6StringEiiPNS_3MatE

为ld找到了一个不错的选项,该选项记录了ld加载的每个文件。
Machida-no-MacBook-Air:caffe machidahiroaki$ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -t -demangle -dynamic -dylib -arch x86_64 -macosx_version_min 10.10.0 ~
@(#)PROGRAM:ld  PROJECT:ld64-241.9
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7m armv7em
Library search paths:
    /usr/lib
    /usr/local/include
    /usr/local/lib
    /usr/lib
    /usr/local/atlas/lib
    .build_release/lib
    .
    /usr/local/lib
    /usr/local/lib
    /usr/local/lib
    /usr/local/lib
    /usr/lib
    /usr/local/lib
Framework search paths:
    /Library/Frameworks/
    /System/Library/Frameworks/
.build_release/src/caffe/proto/caffe.pb.o
.build_release/src/caffe/proto/caffe_pretty_print.pb.o
.build_release/src/caffe/blob.o
.build_release/src/caffe/common.o
.build_release/src/caffe/data_transformer.o
.build_release/src/caffe/dataset_factory.o
.build_release/src/caffe/internal_thread.o
.build_release/src/caffe/layer_factory.o
.build_release/src/caffe/layers/absval_layer.o
.build_release/src/caffe/layers/accuracy_layer.o
.build_release/src/caffe/layers/argmax_layer.o
.build_release/src/caffe/layers/base_data_layer.o
.build_release/src/caffe/layers/bnll_layer.o
.build_release/src/caffe/layers/concat_layer.o
.build_release/src/caffe/layers/contrastive_loss_layer.o
.build_release/src/caffe/layers/conv_layer.o
.build_release/src/caffe/layers/cudnn_conv_layer.o
.build_release/src/caffe/layers/cudnn_pooling_layer.o
.build_release/src/caffe/layers/cudnn_relu_layer.o
.build_release/src/caffe/layers/cudnn_sigmoid_layer.o
.build_release/src/caffe/layers/cudnn_softmax_layer.o
.build_release/src/caffe/layers/cudnn_tanh_layer.o
.build_release/src/caffe/layers/data_layer.o
.build_release/src/caffe/layers/dropout_layer.o
.build_release/src/caffe/layers/dummy_data_layer.o
.build_release/src/caffe/layers/eltwise_layer.o
.build_release/src/caffe/layers/euclidean_loss_layer.o
.build_release/src/caffe/layers/exp_layer.o
.build_release/src/caffe/layers/flatten_layer.o
.build_release/src/caffe/layers/hdf5_data_layer.o
.build_release/src/caffe/layers/hdf5_output_layer.o
.build_release/src/caffe/layers/hinge_loss_layer.o
.build_release/src/caffe/layers/im2col_layer.o
.build_release/src/caffe/layers/image_data_layer.o
.build_release/src/caffe/layers/infogain_loss_layer.o
.build_release/src/caffe/layers/inner_product_layer.o
.build_release/src/caffe/layers/loss_layer.o
.build_release/src/caffe/layers/lrn_layer.o
.build_release/src/caffe/layers/memory_data_layer.o
.build_release/src/caffe/layers/multinomial_logistic_loss_layer.o
.build_release/src/caffe/layers/neuron_layer.o
.build_release/src/caffe/layers/pooling_layer.o
.build_release/src/caffe/layers/power_layer.o
.build_release/src/caffe/layers/relu_layer.o
.build_release/src/caffe/layers/sigmoid_cross_entropy_loss_layer.o
.build_release/src/caffe/layers/sigmoid_layer.o
.build_release/src/caffe/layers/silence_layer.o
.build_release/src/caffe/layers/slice_layer.o
.build_release/src/caffe/layers/softmax_layer.o
.build_release/src/caffe/layers/softmax_loss_layer.o
.build_release/src/caffe/layers/split_layer.o
.build_release/src/caffe/layers/tanh_layer.o
.build_release/src/caffe/layers/threshold_layer.o
.build_release/src/caffe/layers/window_data_layer.o
.build_release/src/caffe/leveldb_dataset.o
.build_release/src/caffe/lmdb_dataset.o
.build_release/src/caffe/layers/mvn_layer.o
.build_release/src/caffe/net.o
.build_release/src/caffe/solver.o
.build_release/src/caffe/syncedmem.o
.build_release/src/caffe/util/benchmark.o
.build_release/src/caffe/util/im2col.o
.build_release/src/caffe/util/insert_splits.o
.build_release/src/caffe/util/io.o
.build_release/src/caffe/util/math_functions.o
.build_release/src/caffe/util/upgrade_proto.o
/usr/local/lib/libglog.dylib
/usr/local/lib/libgflags.dylib
/usr/local/lib/libprotobuf.dylib
/usr/local/lib/libleveldb.dylib
/usr/local/lib/libsnappy.dylib
/usr/local/lib/liblmdb.dylib
/usr/local/lib/libboost_system.dylib
/usr/local/lib/libhdf5_hl.dylib
/usr/local/lib/libhdf5.dylib
/System/Library/Frameworks//Accelerate.framework/Accelerate
/usr/lib/libm.dylib
/usr/local/lib/libopencv_core.dylib
/usr/local/lib/libopencv_highgui.dylib
/usr/local/lib/libopencv_imgproc.dylib
/usr/local/lib/libboost_thread-mt.dylib
/usr/lib/libcblas.dylib
/usr/lib/libstdc++.dylib
/usr/lib/libSystem.dylib
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib
/usr/lib/system/libcache.dylib
/usr/lib/system/libcommonCrypto.dylib
/usr/lib/system/libcompiler_rt.dylib
/usr/lib/system/libcopyfile.dylib
/usr/lib/system/libcorecrypto.dylib
/usr/lib/system/libdispatch.dylib
/usr/lib/system/libdyld.dylib
/usr/lib/system/libkeymgr.dylib
/usr/lib/system/liblaunch.dylib
/usr/lib/system/libmacho.dylib
/usr/lib/system/libquarantine.dylib
/usr/lib/system/libremovefile.dylib
/usr/lib/system/libsystem_asl.dylib
/usr/lib/system/libsystem_blocks.dylib
/usr/lib/system/libsystem_c.dylib
/usr/lib/system/libsystem_configuration.dylib
/usr/lib/system/libsystem_coreservices.dylib
/usr/lib/system/libsystem_coretls.dylib
/usr/lib/system/libsystem_dnssd.dylib
/usr/lib/system/libsystem_info.dylib
/usr/lib/system/libsystem_kernel.dylib
/usr/lib/system/libsystem_m.dylib
/usr/lib/system/libsystem_malloc.dylib
/usr/lib/system/libsystem_network.dylib
/usr/lib/system/libsystem_networkextension.dylib
/usr/lib/system/libsystem_notify.dylib
/usr/lib/system/libsystem_platform.dylib
/usr/lib/system/libsystem_pthread.dylib
/usr/lib/system/libsystem_sandbox.dylib
/usr/lib/system/libsystem_secinit.dylib
/usr/lib/system/libsystem_stats.dylib
/usr/lib/system/libsystem_trace.dylib
/usr/lib/system/libunc.dylib
/usr/lib/system/libunwind.dylib
/usr/lib/system/libxpc.dylib
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib
Undefined symbols for architecture x86_64:
  "cv::imread(cv::String const&, int)", referenced from:
      caffe::WindowDataLayer<float>::InternalThreadEntry() in window_data_layer.o
      caffe::WindowDataLayer<double>::InternalThreadEntry() in window_data_layer.o
      caffe::ReadImageToCVMat(std::string const&, int, int, bool) in io.o
  "cv::imdecode(cv::_InputArray const&, int)", referenced from:
      caffe::DecodeDatumToCVMat(caffe::Datum const&, int, int, bool) in io.o
ld: symbol(s) not found for architecture x86_64
Machida-no-MacBook-Air:caffe machidahiroaki$

最佳答案

解决了!
cv::imread(cv::String const&, int)是在libopencv_imgcodecs.dylib上定义的,
Makefile丢失了它。

因此,我将opencv_imgcodecs添加到Makefile中。

LIBRARIES += glog gflags protobuf leveldb snappy \
        lmdb \
        boost_system \
        hdf5_hl hdf5 \
        opencv_imgcodecs opencv_highgui opencv_imgproc opencv_core pthread

关于c++ - 体系结构x86_64 : for caffe build的 undefined symbol ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27890137/

10-13 05:11