My GPU: Intel HD Graphics 4000 + NVIDIA GeForce GT 650M
I have downgrade my XCode to V6.4 and my clang Version:
Apple LLVM version 6.1.0 (clang-602.0.51) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
Now when I try to install Mxnet with either clang or clang-omp, I always get this error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: lib/libmxnet.a(mxrtc.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: lib/libmxnet.a(cudnn_batch_norm.o) has no symbols
Undefined symbols for architecture x86_64:
...
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libmxnet.so] Error 1
Here is my osx.mk:
export CC = clang
export CXX = clang++
export NVCC = nvcc
DEBUG = 0
ADD_LDFLAGS = -L/usr/local/opt/openblas/lib
ADD_LDFLAGS += -Xlinker -F/Library/Frameworks -Xlinker -framework -Xlinker CUDA
ADD_CFLAGS = -I/usr/local/opt/openblas/include
USE_CUDA = 1
USE_CUDA_PATH = /usr/local/cuda
USE_CUDNN = 1
USE_NVRTC = 0
USE_OPENMP = 0
USE_BLAS = openblas
USE_INTEL_PATH = NONE
I checked my make version:
make -v
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
Is i386 a problem?
you might want to disable CUDNN and RTC, as they might not be supporting 32 bit?
Still the same error, this seems not work for me:(
One thing we might try, is to simply manually delete the cudnn_batchnorm.cu and mxrtc.cc and clean and recompile again
Hi, thanks for your help. This still doesn't work for me. And here is a full version of error msg.
ld: symbol(s) not found for architecture x86_64
clang-3.5: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libmxnet.so] Error 1
make: *** Waiting for unfinished jobs....
In file included from tools/im2rec.cc:22:
In file included from /usr/local/Cellar/opencv/2.4.12_2/include/opencv2/opencv.hpp:56:
/usr/local/Cellar/opencv/2.4.12_2/include/opencv2/ml/ml.hpp:961:18: warning: 'CvForestTree::train'
hides overloaded virtual functions [-Woverloaded-virtual]
virtual bool train( CvDTreeTrainData* trainData, const CvMat* _subsample_idx, CvRTrees* forest );
^
/usr/local/Cellar/opencv/2.4.12_2/include/opencv2/ml/ml.hpp:867:18: note: hidden overloaded virtual
function 'CvDTree::train' declared here: different number of parameters (2 vs 3)
virtual bool train( CvMLData* trainData, CvDTreeParams params=CvDTreeParams() );
^
/usr/local/Cellar/opencv/2.4.12_2/include/opencv2/ml/ml.hpp:877:26: note: hidden overloaded virtual
function 'CvDTree::train' declared here: different number of parameters (8 vs 3)
CV_WRAP virtual bool train( const cv::Mat& trainData, int tflag,
^
/usr/local/Cellar/opencv/2.4.12_2/include/opencv2/ml/ml.hpp:1149:18: warning: 'CvBoostTree::train'
hides overloaded virtual functions [-Woverloaded-virtual]
virtual bool train( CvDTreeTrainData* trainData,
^
/usr/local/Cellar/opencv/2.4.12_2/include/opencv2/ml/ml.hpp:867:18: note: hidden overloaded virtual
function 'CvDTree::train' declared here: different number of parameters (2 vs 3)
virtual bool train( CvMLData* trainData, CvDTreeParams params=CvDTreeParams() );
^
/usr/local/Cellar/opencv/2.4.12_2/include/opencv2/ml/ml.hpp:877:26: note: hidden overloaded virtual
function 'CvDTree::train' declared here: different number of parameters (8 vs 3)
CV_WRAP virtual bool train( const cv::Mat& trainData, int tflag,
^
2 warnings generated.
Undefined symbols for architecture x86_64:
"__ZNKSt13runtime_error4whatEv", referenced from:
__ZTVN4dmlc5ErrorE in im2rec-5afd5e.o
__ZTVN4dmlc5ErrorE in resource.o
__ZTVN4dmlc10ParamErrorE in resource.o
__ZTVN4dmlc5ErrorE in c_api.o
__ZTVN4dmlc5ErrorE in c_predict_api.o
__ZTVN4dmlc5ErrorE in engine.o
__ZTVN4dmlc5ErrorE in naive_engine.o
...
"__ZNKSt9exception4whatEv", referenced from:
__ZTVNSt3__117bad_function_callE in c_api.o
__ZTVNSt3__117bad_function_callE in naive_engine.o
__ZTVNSt3__117bad_function_callE in threaded_engine.o
__ZTVNSt3__117bad_function_callE in threaded_engine_perdevice.o
__ZTVNSt3__117bad_function_callE in threaded_engine_pooled.o
__ZTVNSt3__117bad_function_callE in image_aug_default.o
__ZTVNSt3__117bad_function_callE in iter_csv.o
...
"__ZNSt12length_errorD1Ev", referenced from:
__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv in im2rec-5afd5e.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in im2rec-5afd5e.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv in resource.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in resource.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv in c_api.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in c_api.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in c_api_error.o
...
"__ZNSt12out_of_rangeD1Ev", referenced from:
__ZNK4dmlc9parameter10FieldEntryIiE10PrintValueERNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEEi in resource.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_out_of_rangeEv in c_api.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_out_of_rangeEv in threaded_engine.o
__ZNK4dmlc9parameter10FieldEntryIiE10PrintValueERNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEEi in threaded_engine_perdevice.o
__ZN5mxnet6engine13StreamManagerILm16ELm16EE15GetIORunContextERKNS_7ContextE in threaded_engine_pooled.o
__ZN5mxnet6engine13StreamManagerILm16ELm16EE13GetRunContextERKNS_7ContextE in threaded_engine_pooled.o
__ZNK4dmlc9parameter10FieldEntryIiE10PrintValueERNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEEi in image_aug_default.o
...
"__ZNSt13runtime_errorD2Ev", referenced from:
__ZN4dmlc5ErrorD1Ev in im2rec-5afd5e.o
__ZN4dmlc5ErrorD0Ev in im2rec-5afd5e.o
__ZN4dmlc5ErrorD1Ev in resource.o
__ZN4dmlc5ErrorD0Ev in resource.o
__ZN4dmlc10ParamErrorD1Ev in resource.o
__ZN4dmlc10ParamErrorD0Ev in resource.o
__ZN4dmlc5ErrorD1Ev in c_api.o
...
"__ZNSt9exceptionD2Ev", referenced from:
__ZNSt3__117bad_function_callD1Ev in c_api.o
__ZNSt3__117bad_function_callD0Ev in c_api.o
__ZNSt3__117bad_function_callD1Ev in naive_engine.o
__ZNSt3__117bad_function_callD0Ev in naive_engine.o
__ZNSt3__117bad_function_callD1Ev in threaded_engine.o
__ZNSt3__117bad_function_callD0Ev in threaded_engine.o
__ZNSt3__117bad_function_callD1Ev in threaded_engine_perdevice.o
...
"__ZSt9terminatev", referenced from:
___clang_call_terminate in im2rec-5afd5e.o
___clang_call_terminate in resource.o
___clang_call_terminate in c_api.o
___clang_call_terminate in c_predict_api.o
___clang_call_terminate in engine.o
___clang_call_terminate in naive_engine.o
___clang_call_terminate in threaded_engine.o
...
"__ZTISt12length_error", referenced from:
__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv in im2rec-5afd5e.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in im2rec-5afd5e.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv in resource.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in resource.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv in c_api.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in c_api.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in c_api_error.o
...
"__ZTISt12out_of_range", referenced from:
__ZNK4dmlc9parameter10FieldEntryIiE10PrintValueERNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEEi in resource.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_out_of_rangeEv in c_api.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_out_of_rangeEv in threaded_engine.o
__ZNK4dmlc9parameter10FieldEntryIiE10PrintValueERNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEEi in threaded_engine_perdevice.o
__ZN5mxnet6engine13StreamManagerILm16ELm16EE15GetIORunContextERKNS_7ContextE in threaded_engine_pooled.o
__ZN5mxnet6engine13StreamManagerILm16ELm16EE13GetRunContextERKNS_7ContextE in threaded_engine_pooled.o
__ZNK4dmlc9parameter10FieldEntryIiE10PrintValueERNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEEi in image_aug_default.o
...
"__ZTISt13runtime_error", referenced from:
__ZTIN4dmlc5ErrorE in im2rec-5afd5e.o
__ZTIN4dmlc5ErrorE in resource.o
__ZTIN4dmlc5ErrorE in c_api.o
__ZTIN4dmlc5ErrorE in c_predict_api.o
__ZTIN4dmlc5ErrorE in engine.o
__ZTIN4dmlc5ErrorE in naive_engine.o
__ZTIN4dmlc5ErrorE in threaded_engine.o
...
"__ZTISt9exception", referenced from:
__ZTINSt3__117bad_function_callE in c_api.o
__ZTINSt3__117bad_function_callE in naive_engine.o
__ZTINSt3__117bad_function_callE in threaded_engine.o
__ZTINSt3__117bad_function_callE in threaded_engine_perdevice.o
__ZTINSt3__117bad_function_callE in threaded_engine_pooled.o
__ZTINSt3__117bad_function_callE in image_aug_default.o
__ZTINSt3__117bad_function_callE in iter_csv.o
...
"__ZTVSt12length_error", referenced from:
__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv in im2rec-5afd5e.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in im2rec-5afd5e.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv in resource.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in resource.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv in c_api.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in c_api.o
__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv in c_api_error.o
...
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"__ZTVSt12out_of_range", referenced from:
__ZNK4dmlc9parameter10FieldEntryIiE10PrintValueERNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEEi in resource.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_out_of_rangeEv in c_api.o
__ZNKSt3__120__vector_base_commonILb1EE20__throw_out_of_rangeEv in threaded_engine.o
__ZNK4dmlc9parameter10FieldEntryIiE10PrintValueERNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEEi in threaded_engine_perdevice.o
__ZN5mxnet6engine13StreamManagerILm16ELm16EE15GetIORunContextERKNS_7ContextE in threaded_engine_pooled.o
__ZN5mxnet6engine13StreamManagerILm16ELm16EE13GetRunContextERKNS_7ContextE in threaded_engine_pooled.o
__ZNK4dmlc9parameter10FieldEntryIiE10PrintValueERNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEEi in image_aug_default.o
...
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"___kmpc_cancel_barrier", referenced from:
_.omp_microtask. in libdmlc.a(data.o)
_.omp_microtask.13 in libdmlc.a(data.o)
_.omp_microtask.30 in libdmlc.a(data.o)
_.omp_microtask.47 in libdmlc.a(data.o)
_.omp_microtask.48 in libdmlc.a(data.o)
_.omp_microtask.49 in libdmlc.a(data.o)
"___kmpc_fork_call", referenced from:
__ZN4dmlc4data18CreateLibSVMParserIjEEPNS_6ParserIT_EERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEERKNS6_3mapISC_SC_NS6_4lessISC_EENSA_INS6_4pairISD_SC_EEEEEEjj in libdmlc.a(data.o)
__ZN4dmlc4data18CreateLibSVMParserIyEEPNS_6ParserIT_EERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEERKNS6_3mapISC_SC_NS6_4lessISC_EENSA_INS6_4pairISD_SC_EEEEEEjj in libdmlc.a(data.o)
__ZN4dmlc4data9CSVParserIjEC2EPNS_10InputSplitERKNSt3__13mapINS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEESC_NS5_4lessISC_EENSA_INS5_4pairIKSC_SC_EEEEEEi in libdmlc.a(data.o)
__ZN4dmlc4data14TextParserBaseIjE8FillDataEPNSt3__16vectorINS0_17RowBlockContainerIjEENS3_9allocatorIS6_EEEE in libdmlc.a(data.o)
__ZN4dmlc4data14TextParserBaseIyE8FillDataEPNSt3__16vectorINS0_17RowBlockContainerIyEENS3_9allocatorIS6_EEEE in libdmlc.a(data.o)
"___kmpc_global_thread_num", referenced from:
__ZN4dmlc4data14TextParserBaseIjE8FillDataEPNSt3__16vectorINS0_17RowBlockContainerIjEENS3_9allocatorIS6_EEEE in libdmlc.a(data.o)
__ZN4dmlc4data14TextParserBaseIyE8FillDataEPNSt3__16vectorINS0_17RowBlockContainerIyEENS3_9allocatorIS6_EEEE in libdmlc.a(data.o)
"___kmpc_push_num_threads", referenced from:
__ZN4dmlc4data14TextParserBaseIjE8FillDataEPNSt3__16vectorINS0_17RowBlockContainerIjEENS3_9allocatorIS6_EEEE in libdmlc.a(data.o)
__ZN4dmlc4data14TextParserBaseIyE8FillDataEPNSt3__16vectorINS0_17RowBlockContainerIyEENS3_9allocatorIS6_EEEE in libdmlc.a(data.o)
"_omp_get_num_procs", referenced from:
_.omp_microtask.30 in libdmlc.a(data.o)
_.omp_microtask.49 in libdmlc.a(data.o)
"_omp_get_num_threads", referenced from:
_.omp_microtask. in libdmlc.a(data.o)
_.omp_microtask.47 in libdmlc.a(data.o)
"_omp_get_thread_num", referenced from:
_.omp_microtask.13 in libdmlc.a(data.o)
_.omp_microtask.48 in libdmlc.a(data.o)
ld: symbol(s) not found for architecture x86_64
clang-3.5: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/im2rec] Error 1
Same issue for Mac El Capitan 10.11.5
@celestesosmart @tlkahn Have you disabled tried to disable OpenMP in dmlc-core? See https://github.com/dmlc/dmlc-core/pull/135
@sxjscience yes, we have disabled OpenMP by setting up config.mx. But still seeing errors in linking stage... My log (part on errors) is as follows:
Undefined symbols for architecture x86_64:
"_cblas_dgemm", referenced from:
mxnet::op::ConvolutionOp
mxnet::op::ConvolutionOp
mxnet::op::DeconvolutionOp
mxnet::op::DeconvolutionOp
mxnet::op::FullyConnectedOp
mxnet::op::FullyConnectedOp
"_cblas_sdot", referenced from:
void mshadow::VectorDot
void mshadow::VectorDot
"_cblas_sgemm", referenced from:
mxnet::op::ConvolutionOp
mxnet::op::ConvolutionOp
mxnet::op::DeconvolutionOp
mxnet::op::DeconvolutionOp
mxnet::op::FullyConnectedOp
mxnet::op::FullyConnectedOp
void mxnet::op::DotForward_mshadow::cpu(mshadow::TBlob const&, mshadow::TBlob const&, mxnet::op::EnvArguments const&, mshadow::TBlob_, mxnet::OpReqType, mxnet::RunContext) in matrix_op.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: *_* [bin/im2rec] Error 1
@tqchen Please help, we are stuck (and bleeding).......
@shi27feng, According to the error message, the problem is in linking blas libraries. Also, on OSX, directly setting the USE_OPENMP flag in config.mk will not disable OpenMP completely, you'd better apply the fix in https://github.com/dmlc/dmlc-core/pull/135
@shi27feng Do you know how to fix this issue now? I have the same problem on make
I ran into the same issue. I set USE_OPENMP = 1 and it's compiled.
I ran into the same issue with Macbook Pro late 2015, 10.12.3 Sierra, gcc-7.
I believe that the issue is cause by two versions of OpenCV (2.4.13 and 3.2), because I ran into OpenCV issue several times on my MBP.
So, I tried 2.4.13.2 and 3.20 and HEAD-3649ee3, and only 2.4.13 works, with g++/clang++, not g++-7.
mxnet daodao$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
The most important thing here is to setup OpenCV version explicitly:
# setup opencv
ifeq ($(USE_OPENCV), 1)
CFLAGS += -DMXNET_USE_OPENCV=1 -I/usr/local/Cellar/opencv/2.4.13.2/include -I/usr/local/include
LDFLAGS += $(filter-out -lopencv_ts, -L/usr/local/Cellar/opencv/2.4.13.2/lib -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core)
#CFLAGS += -DMXNET_USE_OPENCV=1 $(shell pkg-config --cflags opencv)
#LDFLAGS += $(filter-out -lopencv_ts, $(shell pkg-config --libs opencv))
BIN += bin/im2rec
else
CFLAGS+= -DMXNET_USE_OPENCV=0
endif
Mac OSX python users have the option to use pre-built pip packages now. The package names are mxnet and mxnet-mkl. We also offer nightly builds as beta pre-release, available through pip's --pre switch. Starting from 0.11.0, the pip packages depend on opencv 3.3. Though a hack is needed to use the compatible header in imgcodecs.
Feel free to ping me to reopen if there's still issue in building OSX version.
Most helpful comment
Same issue for Mac El Capitan 10.11.5