Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS / osx] lib path problems with ofxOpenCv and ofxKinect(libusb) [buildAllExamples] #8170

Open
Tracked by #8192
artificiel opened this issue Nov 1, 2024 · 11 comments
Assignees

Comments

@artificiel
Copy link
Contributor

artificiel commented Nov 1, 2024

had to swap macos to osx in the libs of these addons to get through buildAllExamples.sh.

with the macos transition not sure what is correct/incorrect in this case (other that it should compile!)

using fresh from git, scripts/osx/download_libs.sh and PG from last week to multi-update the examples files.

NB: Makefiles do compile.

@danoli3
Copy link
Member

danoli3 commented Nov 1, 2024

projectGenerator not adding the xcframeworks again in last few versions.

For now just add the opencv.xcframework and it will work instantly, no headers needed.
image

image image

@dimitre
Copy link
Member

dimitre commented Nov 1, 2024

@roymacdonald is this working in your branch?
if not I can take a look at PG

@roymacdonald
Copy link
Member

@roymacdonald is this working in your branch? if not I can take a look at PG
it is solved.

@eloimaduell
Copy link

eloimaduell commented Nov 13, 2024

hi @danoli3, I'm trying to run the OpenCV examples from the of_v20241109_osx_release nightlybuild. I just added as you mentioned the opencv.xcframework and it keeps poping an error at linking stage :
Screenshot 2024-11-13 at 17 43 49

ld: Undefined symbols:
carotene_o4t::bitwiseAnd(carotene_o4t::Size2D const&, unsigned char const*, long, unsigned char const*, long, unsigned char*, long), referenced from:
cv::hal::and8u(unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned char*, unsigned long, int, int, void*) in opencv.a[arm64]494
and some hundreds more like this ...

Screenshot 2024-11-13 at 17 42 33

In my case the error is : ld Undefined Symbols. What I'm doing wrong ?

( I'm on a M2 MacbookPro with MacOS Sonoma 14.5 and XCode 15.2. )

@roymacdonald
Copy link
Member

Hi @eloimaduell which version of project generator do you have?
I am not sure which one is being packaged but this is solved with the newest version of it

@roymacdonald
Copy link
Member

I just checked it and it works with the newest PG versions > 0.78.0 (you can check this by clicking the cog icon on the top right of PG).
ALthough, there is a mistake in the code itself, in the peopleDetector.h file you need to remove the line that says
#include <opencv2/videoio.hpp>

@danoli3
Copy link
Member

danoli3 commented Nov 14, 2024

hi @danoli3, I'm trying to run the OpenCV examples from the of_v20241109_osx_release nightlybuild. I just added as you mentioned the opencv.xcframework and it keeps poping an error at linking stage : Screenshot 2024-11-13 at 17 43 49

ld: Undefined symbols:
carotene_o4t::bitwiseAnd(carotene_o4t::Size2D const&, unsigned char const*, long, unsigned char const*, long, unsigned char*, long), referenced from:
cv::hal::and8u(unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned char*, unsigned long, int, int, void*) in opencv.a[arm64]494
and some hundreds more like this ...

Screenshot 2024-11-13 at 17 42 33

In my case the error is : ld Undefined Symbols. What I'm doing wrong ?

( I'm on a M2 MacbookPro with MacOS Sonoma 14.5 and XCode 15.2. )

Yeah I think in the build commands the NEON/Instrinics were turned off, so it shouldn't have been trying to use those, maybe config is overridden by x86_64 with custom headers included.

I wonder if you remove the manually added headers and leave just the XCFrameworks (with sub headers) if that works.

Let's test with it on again, I'll see if it builds, better the have these optimisations for performance anyway

-DCV_ENABLE_INTRINSICS=ON -DWITH_CAROTENE=ON

@ofTheo
Copy link
Member

ofTheo commented Nov 19, 2024

@roymacdonald - I just tried the packaged nightly which is using projectGenerator 0.83.0 and I am still seeing the issue:


ld: Undefined symbols:
  cv::cvarrToMat(void const*, bool, bool, int, cv::AutoBuffer<double, 136ul>*), referenced from:
      ofxCvImage::getCvMat() in ofxCvColorImage.o
      ofxCvImage::getCvMat() const in ofxCvColorImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
  cv::Mat::~Mat(), referenced from:
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
      ...
  cv::error(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, char const*, char const*, int), referenced from:
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
  cv::noArray(), referenced from:
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
  cv::undistort(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&), referenced from:
      ofxCvImage::undistort(float, float, float, float, float, float, float, float) in ofxCvImage.o
  _cvAbsDiff, referenced from:
      ofxCvGrayscaleImage::absDiff(ofxCvGrayscaleImage&) in ofxCvGrayscaleImage.o
      ofxCvGrayscaleImage::absDiff(ofxCvGrayscaleImage&, ofxCvGrayscaleImage&) in ofxCvGrayscaleImage.o
  _cvAdaptiveThreshold, referenced from:
      ofxCvGrayscaleImage::adaptiveThreshold(int, int, bool, bool) in ofxCvGrayscaleImage.o
  _cvAdd, referenced from:
      ofxCvImage::operator+=(ofxCvImage&) in ofxCvImage.o
  _cvAddS, referenced from:

@ofTheo
Copy link
Member

ofTheo commented Nov 19, 2024

@danoli3 if I drag the opencv.xcframework into the allAddonsExamples project I get:

ld: Undefined symbols:
  carotene_o4t::bitwiseAnd(carotene_o4t::Size2D const&, unsigned char const*, long, unsigned char const*, long, unsigned char*, long), referenced from:
      cv::hal::and8u(unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned char*, unsigned long, int, int, void*) in opencv.a[arm64][494](arithm.dispatch.cpp.o)
  carotene_o4t::bitwiseNot(carotene_o4t::Size2D const&, unsigned char const*, long, unsigned char*, long), referenced from:
      cv::hal::not8u(unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned char*, unsigned long, int, int, void*) in opencv.a[arm64][494](arithm.dispatch.cpp.o)
  carotene_o4t::bitwiseXor(carotene_o4t::Size2D const&, unsigned char const*, long, unsigned char const*, long, unsigned char*, long), referenced from:
      cv::hal::xor8u(unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned char*, unsigned long, int, int, void*) in opencv.a[arm64][494](arithm.dispatch.cpp.o)
  carotene_o4t::reciprocal(carotene_o4t::Size2D const&, signed char const*, long, signed char*, long, float, carotene_o4t::CONVERT_POLICY), referenced from:
      cv::hal::recip8s(signed char const*, unsigned long, signed char const*, unsigned long, signed char*, unsigned long, int, int, void*) in opencv.a[arm64][494](arithm.dispatch.cpp.o)
  carotene_o4t::reciprocal(carotene_o4t::Size2D const&, float const*, long, float*, long, float), referenced from:
      cv::hal::recip32f(float const*, unsigned long, float const*, unsigned long, float*, unsigned long, int, int, void*) in opencv.a[arm64][494](arithm.dispatch.cpp.o)
  carotene_o4t::reciprocal(carotene_o4t::Size2D const&, unsigned char const*, long, unsigned char*, long, float, carotene_o4t::CONVERT_POLICY), referenced from:
      cv::hal::recip8u(unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned char*, unsigned long, int, int, void*) in opencv.a[arm64][494](arithm.dispatch.cpp.o)
  carotene_o4t::reciprocal(carotene_o4t::Size2D const&, int const*, long, int*, long, float, carotene_o4t::CONVERT_POLICY), referenced from:
      cv::hal::recip32s(int const*, unsigned long, int const*, unsigned long, int*, unsigned long, int, int, void*) in opencv.a[arm64][494](arithm.dispatch.cpp.o)
  carotene_o4t::reciprocal(carotene_o4t::Size2D const&, short const*, long, short*, long, float, carotene_o4t::CONVERT_POLICY), referenced from:
      cv::hal::recip16s(short const*, unsigned long, short const*, unsigned long, short*, unsigned long, int, int, void*) in opencv.a[arm64][494](arithm.dispatch.cpp.o)
  carotene_o4t::reciprocal(carotene_o4t::Size2D const&, unsigned short const*, long, unsigned short*, long, float, carotene_o4t::CONVERT_POLICY), referenced from:
      cv::hal::recip16u(unsigned short const*, unsigned long, unsigned short const*, unsigned long, unsigned short*, unsigned long, int, int, void*) in opencv.a[arm64][494](arithm.dispatch.cpp.o)
  carotene_o4t::rgb2bgr565(carotene_o4t::Size2D const&, unsigned char const*, long, unsigned char*, long), referenced from:
      TegraCvtColor_rgb2bgr565_Invoker::operator()(cv::Range const&) const in opencv.a[arm64][1182](color_rgb.dispatch.cpp.o)
  carotene_o4t::rgb2rgb565(carotene_o4t::Size2D const&, unsigned char const*, long, unsigned char*, long), referenced from:
      TegraCvtColor_rgb2rgb565_Invoker::operator()(cv::Range const&) const in opencv.a[arm64][1182](color_rgb.dispatch.cpp.o)
  carotene_o4t::addWeighted(carotene_o4t::Size2D const&, signed char const*, long, signed char const*, long, signed char*, long, float, float, float), referenced from:
      cv::

Looks like it might need to be built with:
"WITH_CAROTENE": "OFF".

@eloimaduell
Copy link

@roymacdonald :: > Hi @eloimaduell which version of project generator do you have? I am not sure which one is being packaged but this is solved with the newest version of it

I'm using Project Generator 0.84.0

@eloimaduell
Copy link

@roymacdonald :: > I just checked it and it works with the newest PG versions > 0.78.0 (you can check this by clicking the cog icon on the top right of PG). ALthough, there is a mistake in the code itself, in the peopleDetector.h file you need to remove the line that says #include <opencv2/videoio.hpp>

Thanks for pointing this out ! Anyway the linking issue happened with any OfxOpenCV example. I solved with a weird that I don't understand which was createing a folder names /opencv/include/opencv4 with folder opencv2 inside. It doesn't make any sense to me, but it worked like this .... ?¿

Screenshot 2024-11-19 at 08 26 16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants