本文介绍了架构x86_64的未定义符号:用于caffe build的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了 build的错误。如何解决?
我使用Mac OSX Yosemite 10.10.1。



CONSOLE LOG

  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 /层/ cudnn_relu_layer.o .build_release / src目录/朱古力/层/ cudnn_sigmoid_layer.o .build_release / src目录/朱古力/层/ cudnn_softmax_layer.o .build_release / src目录/朱古力/层/ cudnn_tanh_layer.o .build_release / src目录/朱古力/层/ 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目录/朱古力/层/ hinge_loss_layer.o .build_release / src目录/朱古力/层/ im2col_layer.o .build_release / src目录/朱古力/层/ image_data_layer.o .build_release / src目录/朱古力/层/ 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 /层/ 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 / 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-内部声明--verbose -framework加速-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 
苹果LLVM 6.0版本(铛-600.0.56) (基于LLVM 3.5svn)
目标:x86_64-apple-darwin14.0.0
线程模型:posix
clang:warning:参数在编译期间未使用:'-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 / 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 / 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目录/朱古力/层/ cudnn_relu_layer.o .build_release / src目录/朱古力/层/ cudnn_sigmoid_layer.o .build_release / src目录/朱古力/层/ cudnn_softmax_layer.o .build_release / src目录/朱古力/层/ 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目录/朱古力/层/ inner_product_layer.o .build_release / src目录/朱古力/层/ loss_layer.o .build_release / src目录/朱古力/层/ lrn_layer.o .build_release / src目录/朱古力/层/ 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目录/朱古力/层/ power_layer.o .build_release / src目录/朱古力/层/ relu_layer.o .build_release / src目录/朱古力/层/ sigmoid_cross_entropy_loss_layer.o .build_release / src目录/朱古力/层/ 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目录/朱古力/ UTIL / upgrade_proto.o -framework加速-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
架构x86_64的未定义符号:
cv :: imread(cv :: String const& ;,INT),从引用:
朱古力:: WindowDataLayer<浮动> :: InternalThreadEntry()在window_data_layer.o
朱古力:: WindowDataLayer<双> :: InternalThreadEntry()在window_data_layer.o
caffe :: ReadImageToCVMat(std :: string const& int,int,bool)in io.o
cv :: imdecode(cv :: _ InputArray const& int),引用自:
caffe :: DecodeDatumToCVMat(caffe :: Datum const& int,int,bool)in io.o
ld:没有为架构找到符号x86_64
clang:error:linker command失败,退出代码1(使用-v查看调用)

src / caffe / layers / window_data_layer。 cpp include

  #includeopencv2 / core / core.hpp
#includeopencv2 / highgui / highgui。 hpp
#includeopencv2 / 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 ++构建的,因为表示这样。

  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(兼容性版本3.0.0,当前版本3.0.0)
/usr/lib/libstdc++.6.dylib(兼容性版本7.0.0,当前版本104.1.0)
/System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL(兼容性版本1.0。 0,当前版本1.0.0)
/usr/lib/libz.1.dylib(兼容性版本1.0.0,当前版本1.2.5)
/usr/lib/libSystem.B.dylib兼容性版本1.0.0,当前版本1213.0.0)
/usr/local/lib/libopencv_highgui.dylib:
/usr/local/lib/libopencv_highgui.3.0.dylib(兼容性版本3.0.0,
/usr/lib/libstdc++.6.dylib(兼容版本7.0.0,当前版本为104.1.0)
/ usr / local / Cellar / opencv / HEAD / lib / libopencv_videoio.3.0.dylib(兼容性版本3.0.0,当前版本3.0.0)
/usr/lib/libz.1.dylib(兼容性版本1.0.0,当前版本1.2.5)
/系统/库/框架/ Cocoa.framework /版本/ A / Cocoa(兼容性版本1.0.0,当前版本21.0.0)
/usr/local/Cellar/opencv/HEAD/lib/libopencv_imgcodecs.3.0.dylib (兼容性版本3.0.0,当前版本3.0.0)
/usr/local/Cellar/opencv/HEAD/lib/libopencv_imgproc.3.0.dylib(兼容性版本3.0.0,当前版本3.0.0)
/usr/local/Cellar/opencv/HEAD/lib/libopencv_core.3.0.dylib(兼容性版本3.0.0,当前版本3.0.0)
/usr/lib/libSystem.B.dylib(兼容性版本1.0.0,当前版本1213.0.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit(兼容性版本45.0.0,当前版本1343.16.0)
/系统/
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation(兼容性版本300.0.0,当前版本为115.0.1.0)
/ System / Library / CoreFoundation.framework / Versions / A / CoreFoundation .0,当前版本1151.16.0)
/usr/lib/libobjc.A.dylib(兼容性版本1.0.0,当前版本228.0.0)
/usr/local/lib/libopencv_imgproc.dylib :
/usr/local/lib/libopencv_imgproc.3.0.dylib(兼容性版本3.0.0,当前版本3.0.0)
/usr/lib/libstdc++.6.dylib(兼容性版本7.0.0 ,当前版本104.1.0)
/usr/local/Cellar/opencv/HEAD/lib/libopencv_core.3.0.dylib(兼容性版本3.0.0,当前版本3.0.0)
/ usr / lib /libSystem.B.dylib(兼容性版本1.0.0,当前版本1213.0.0)

build命令正确使用-stdlib = libstdc ++选项。

  Machida-no-MacBook-Air:caffe machidahiroaki $ make -n | grep clang | grep -v stdlib = libstdc ++ 

感谢您的帮助!






现在我发现我可以使用带-v选项的ld。
我不断调查。

  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 /层/ 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 / 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 /层/ 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 / 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加速-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项目:ld64-241.9
配置为支持archs:armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7m armv7em
库搜索路径:
/ 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
框架搜索路径:
/ Library / Frameworks /
/ System / Library / Frameworks /
架构x86_64的未定义符号:
CV :: imread(CV ::字符串常量和放大器;,INT),从引用:
朱古力:: WindowDataLayer<浮动> :: InternalThreadEntry()在window_data_layer.o
朱古力:: WindowDataLayer<双> ; :: WindowData_layer.o中的InternalThreadEntry()
caffe :: ReadImageToCVMat(std :: string const& int,int,bool)in io.o
cv :: imdecode(cv :: _ InputArray const& int;,引用自:
caffe :: DecodeDatumToCVMat(caffe :: Datum const& int,int,bool)in io.o
ld: x86_64






Dylibs似乎包含适当的符号。 p>

  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牛逼__ZN2cv6imreadERKNS_6StringEi
-
/usr/local/lib/libopencv_imgcodecs.dylib:
0000000000004eb0牛逼__ZN2cv6imreadERKNS_6StringEi
-
/ USR / local / lib目录/ libopencv_superres.dylib:
ü__ZN2cv6imreadERKNS_6StringEi
ü__ZN2cv6imreadERKNS_6StringEi
ü__ZN2cv6imreadERKNS_6StringEi


町田无的MacBook空中:opencv2 machidahiroaki $ otool-L /usr/local/lib/libopencv_highgui.dylib | grep imgcodec
/usr/local/Cellar/opencv/HEAD/lib/libopencv_imgcodecs.3.0.dylib(兼容性版本3.0.0,当前版本3.0.0)






Dylibs似乎有合适的架构。 mmm ...

  Machida-no-MacBook-Air:opencv2 machidahiroaki $ nm -arch x86_64 / usr / local / libopencv_imgcodecs.dylib | grep imread 
0000000000004eb0 T __ZN2cv6imreadERKNS_6StringEi
0000000000004f50 t __ZN2cvL7imread_ERKNS_6StringEiiPNS_3MatE






为ld找到一个不错的选项,它会记录ld加载的每个文件。

  Machida-no-MacBook - 空气:朱古力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〜
@(#)计划:LD项目:ld64-241.9
配置为支持archs:ARMv6的ARMv7的armv7s arm64的i386 x86_64的x86_64h armv6m armv7m armv7em
库搜索路径:
/ 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
框架搜索路径:
/ 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。框架/版本/ A /框架/ vecLib.framework /版本/ A / libLAPACK.dylib
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra。 dylib
为架构x86_64的未定义符号:
CV :: imread(CV ::字符串常量和放大器;,INT),从引用:
朱古力:: WindowDataLayer<浮动> :: InternalThreadEntry( )在window_data_layer.o
朱古力:: WindowDataLayer<双> :: InternalThreadEntry()在window_data_layer.o
朱古力:: ReadImageToCVMat(在IO标准::字符串常量和放大器;,INT,INT,BOOL)。 o
cv :: imdecode(cv :: _ InputArray const& int),引用自:
caffe :: DecodeDatumToCVMat(caffe :: Datum const& int,int,bool)。 o
ld:未找到用于架构的符号x86_64
Machida-no-MacBook-Air:caffe machidahiroaki $


解决方案

已解决!



cv :: imread :String const& amp; 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


I got this error for caffe build. How can I fix it?I'm using Mac OSX Yosemite 10.10.1.

CONSOLE LOG

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 includes

#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

It seems I have correct libraries. (Is this right thing to check??)

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 libraries seem to be built with libstdc++, because the official install guide suggests so.

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)

All the build commands are correctly with -stdlib=libstdc++ option.

Machida-no-MacBook-Air:caffe machidahiroaki$ make -n | grep clang | grep -v stdlib=libstdc++

Thank for your help in advance!


Now I find I can use ld with -v option.I keep investigating.

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 seems to contain appropriate symbols.

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 seems to have the appropriate architecture. mmm...

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


Found a nice option for ld, which logs each file the ld loads.

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$
解决方案

Solved!

cv::imread(cv::String const&, int) is defined on libopencv_imgcodecs.dylib andMakefile is missing it.

So, I added opencv_imgcodecs to Makefile.

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

这篇关于架构x86_64的未定义符号:用于caffe build的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 17:53