Skip to content

[OSX] Undefined symbols for architecture x86_64: #194

@txizzle

Description

@txizzle

Hi,

I have installed OpenCV 3.1 and Torch7. However, when I try to run luarocks install cv, it fails on libobjdetect.dylib with error:

[ 22%] Linking CXX shared library lib/libobjdetect.dylib
Undefined symbols for architecture x86_64:
  "cv::groupRectangles(std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >&, std::__1::vector<int, std::__1::allocator<int> >&, int, double)", referenced from:
      _groupRectangles in objdetect.cpp.o
  "cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >&, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<double, std::__1::allocator<double> >&, double, int, int, cv::Size_<int>, cv::Size_<int>, bool)", referenced from:
      _CascadeClassifier_detectMultiScale3 in objdetect.cpp.o
  "cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >&, std::__1::vector<int, std::__1::allocator<int> >&, double, int, int, cv::Size_<int>, cv::Size_<int>)", referenced from:
      _CascadeClassifier_detectMultiScale2 in objdetect.cpp.o
  "cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)", referenced from:
      _CascadeClassifier_detectMultiScale in objdetect.cpp.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[2]: *** [lib/libobjdetect.dylib] Error 1
make[1]: *** [CMakeFiles/objdetect.dir/all] Error 2
make: *** [all] Error 2

Alternatively, I can clone into this repository and then run: BUILD_CUDA=OFF and then luarocks make, and the installation gets a little further, but still fails at libphoto.dylib and liboptflow.dylib with error:

[ 38%] Linking CXX shared library lib/liboptflow.dylib
[ 41%] Built target videoio
[ 41%] Built target highgui
Undefined symbols for architecture x86_64:
  "cv::groupRectangles(std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >&, std::__1::vector<int, std::__1::allocator<int> >&, int, double)", referenced from:
      _groupRectangles in objdetect.cpp.o
  "cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >&, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<double, std::__1::allocator<double> >&, double, int, int, cv::Size_<int>, cv::Size_<int>, bool)", referenced from:
      _CascadeClassifier_detectMultiScale3 in objdetect.cpp.o
  "cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >&, std::__1::vector<int, std::__1::allocator<int> >&, double, int, int, cv::Size_<int>, cv::Size_<int>)", referenced from:
      _CascadeClassifier_detectMultiScale2 in objdetect.cpp.o
  "cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)", referenced from:
      _CascadeClassifier_detectMultiScale in objdetect.cpp.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[2]: *** [lib/libobjdetect.dylib] Error 1
make[1]: *** [CMakeFiles/objdetect.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Undefined symbols for architecture x86_64:
  "cv::detail::waveCorrect(std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >&, cv::detail::WaveCorrectKind)", referenced from:
      _detail_waveCorrect in stitching.cpp.o
  "cv::detail::estimateFocal(std::__1::vector<cv::detail::ImageFeatures, std::__1::allocator<cv::detail::ImageFeatures> > const&, std::__1::vector<cv::detail::MatchesInfo, std::__1::allocator<cv::detail::MatchesInfo> > const&, std::__1::vector<double, std::__1::allocator<double> >&)", referenced from:
      _detail_estimateFocal in stitching.cpp.o
  "cv::detail::FeatherBlender::createWeightMaps(std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> > const&, std::__1::vector<cv::Point_<int>, std::__1::allocator<cv::Point_<int> > > const&, std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> >&)", referenced from:
      _FeatherBlender_createWeightMaps in stitching.cpp.o
  "cv::detail::FeaturesFinder::operator()(cv::_InputArray const&, cv::detail::ImageFeatures&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > > const&)", referenced from:
      _FeaturesFinder_call2 in stitching.cpp.o
  "cv::detail::createLaplacePyr(cv::_InputArray const&, int, std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> >&)", referenced from:
      _detail_createLaplacePyr in stitching.cpp.o
      _detail_createLaplacePyrGpu in stitching.cpp.o
  "cv::detail::selectRandomSubset(int, int, std::__1::vector<int, std::__1::allocator<int> >&)", referenced from:
      _detail_selectRandomSubset in stitching.cpp.o
  "cv::detail::ExposureCompensator::feed(std::__1::vector<cv::Point_<int>, std::__1::allocator<cv::Point_<int> > > const&, std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> > const&, std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> > const&)", referenced from:
      _ExposureCompensator_feed in stitching.cpp.o
  "cv::detail::findMaxSpanningTree(int, std::__1::vector<cv::detail::MatchesInfo, std::__1::allocator<cv::detail::MatchesInfo> > const&, cv::detail::Graph&, std::__1::vector<int, std::__1::allocator<int> >&)", referenced from:
      _detail_findMaxSpanningTree in stitching.cpp.o
  "cv::detail::matchesGraphAsString(std::__1::vector<cv::String, std::__1::allocator<cv::String> >&, std::__1::vector<cv::detail::MatchesInfo, std::__1::allocator<cv::detail::MatchesInfo> >&, float)", referenced from:
      _detail_matchesGraphAsString in stitching.cpp.o
  "cv::detail::leaveBiggestComponent(std::__1::vector<cv::detail::ImageFeatures, std::__1::allocator<cv::detail::ImageFeatures> >&, std::__1::vector<cv::detail::MatchesInfo, std::__1::allocator<cv::detail::MatchesInfo> >&, float)", referenced from:
      _detail_leaveBiggestComponent in stitching.cpp.o
  "cv::detail::resultRoiIntersection(std::__1::vector<cv::Point_<int>, std::__1::allocator<cv::Point_<int> > > const&, std::__1::vector<cv::Size_<int>, std::__1::allocator<cv::Size_<int> > > const&)", referenced from:
      _detail_resultRoiIntersection in stitching.cpp.o
  "cv::detail::calibrateRotatingCamera(std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> > const&, cv::Mat&)", referenced from:
      _detail_calibrateRotatingCamera in stitching.cpp.o
  "cv::detail::BestOf2NearestRangeMatcher::operator()(std::__1::vector<cv::detail::ImageFeatures, std::__1::allocator<cv::detail::ImageFeatures> > const&, std::__1::vector<cv::detail::MatchesInfo, std::__1::allocator<cv::detail::MatchesInfo> >&, cv::UMat const&)", referenced from:
      _BestOf2NearestRangeMatcher_call in stitching.cpp.o
  "cv::detail::restoreImageFromLaplacePyr(std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> >&)", referenced from:
      _detail_restoreImageFromLaplacePyr in stitching.cpp.o
  "cv::detail::restoreImageFromLaplacePyrGpu(std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> >&)", referenced from:
      _detail_restoreImageFromLaplacePyrGpu in stitching.cpp.o
  "cv::detail::Blender::prepare(std::__1::vector<cv::Point_<int>, std::__1::allocator<cv::Point_<int> > > const&, std::__1::vector<cv::Size_<int>, std::__1::allocator<cv::Size_<int> > > const&)", referenced from:
      _Blender_prepare2 in stitching.cpp.o
  "cv::detail::resultTl(std::__1::vector<cv::Point_<int>, std::__1::allocator<cv::Point_<int> > > const&)", referenced from:
      _detail_resultTl in stitching.cpp.o
  "cv::detail::resultRoi(std::__1::vector<cv::Point_<int>, std::__1::allocator<cv::Point_<int> > > const&, std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> > const&)", referenced from:
      _detail_resultRoi2 in stitching.cpp.o
  "cv::detail::resultRoi(std::__1::vector<cv::Point_<int>, std::__1::allocator<cv::Point_<int> > > const&, std::__1::vector<cv::Size_<int>, std::__1::allocator<cv::Size_<int> > > const&)", referenced from:
      _detail_resultRoi in stitching.cpp.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[2]: *** [lib/libstitching.dylib] Error 1
make[1]: *** [CMakeFiles/stitching.dir/all] Error 2
Undefined symbols for architecture x86_64:
  "cv::motempl::segmentMotion(cv::_InputArray const&, cv::_OutputArray const&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >&, double, double)", referenced from:
      _segmentMotion in optflow.cpp.o
ld: symbol(s) not found for architecture x86_64
clang[ 47%] Linking CXX shared library lib/libphoto.dylib
: error: linker command failed with exit code 1 (use -v to see invocation)
[ 47%] Linking CXX shared library lib/libimgcodecs.dylib
make[2]: *** [lib/liboptflow.dylib] Error 1
make[1]: *** [CMakeFiles/optflow.dir/all] Error 2
Undefined symbols for architecture x86_64:
  "cv::imreadmulti(cv::String const&, std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >&, int)", referenced from:
      _imreadmulti in imgcodecs.cpp.o
  "cv::imwrite(cv::String const&, cv::_InputArray const&, std::__1::vector<int, std::__1::allocator<int> > const&)", referenced from:
      _imwrite in imgcodecs.cpp.o
  "cv::imencode(cv::String const&, cv::_InputArray const&, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >&, std::__1::vector<int, std::__1::allocator<int> > const&)", referenced from:
      _imencode in imgcodecs.cpp.o
ld: symbol(s) not found for architecture x86_64
Undefined symbols for architecture x86_64:
  "cv::denoise_TVL1(std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> > const&, cv::Mat&, double, int)", referenced from:
      _denoise_TVL1 in photo.cpp.o
  "cv::fastNlMeansDenoising(cv::_InputArray const&, cv::_OutputArray const&, std::__1::vector<float, std::__1::allocator<float> > const&, int, int, int)", referenced from:
      _fastNlMeansDenoising2 in photo.cpp.o
  "cv::fastNlMeansDenoisingMulti(cv::_InputArray const&, cv::_OutputArray const&, int, int, std::__1::vector<float, std::__1::allocator<float> > const&, int, int, int)", referenced from:
      _fastNlMeansDenoisingMulti2 in photo.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libimgcodecs.dylib] Error 1
make[1]: *** [CMakeFiles/imgcodecs.dir/all] Error 2
make[2]: *** [lib/libphoto.dylib] Error 1
make[1]: *** [CMakeFiles/photo.dir/all] Error 2
make: *** [all] Error 2```

I saw the previous issues, but the fixes didn't work for me. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions