AN13725 - how is opencv compiled without having Mutex errors?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AN13725 - how is opencv compiled without having Mutex errors?

1,116 Views
kowshik1729
Contributor II

I tried to compile opencv according to the AN13725 appnote document and I am getting the following errors 

/home/kowshik/Desktop/opencv_porting/opencv/modules/core/src/precomp.hpp:369:5: error: 'Mutex' in namespace 'cv' does not name a type 369 | cv::Mutex& getInitializationMutex(); | ^~~~~

/home/kowshik/Desktop/opencv_porting/opencv/modules/core/include/opencv2/core/utility.hpp:718:14: error: no type named 'recursive_mutex' in namespace 'std'
typedef std::recursive_mutex Mutex;
~~~~~^
/home/kowshik/Desktop/opencv_porting/opencv/modules/core/include/opencv2/core/utility.hpp:719:14: error: no template named 'lock_guard' in namespace 'std'
typedef std::lock_guard<cv::Mutex> AutoLock;

This basically says the compiler doesn't support threading, but my query is how come NXP got it compiled at their end using the same arm-none-eabi-gcc compiler? Please help about this as I can use it at my end.

Tags (2)
0 Kudos
11 Replies

263 Views
nikolayyakovenk
Contributor III

Hi!

I looked at your post, and I am also trying to port the opencv.

However, I am having issues even on earlier stage, when CMake is trying to test the compiler. 

I have problems when CMake seem to create a temporary random name directory with extension .dir but then it does not recognize that directory name itself,

Have you had something similar in your attempts?

 

Compilation failed:
source file: 'C:/job/projects/bio/prize/gita/opencv_mcu/cmake/checks/cxx11.cpp'
check option: '-std=c++11'
===== BUILD LOG =====
Change Dir: C:/job/projects/bio/prize/gita/opencv_mcu/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/job/projects/bio/nobel/MinGW/msys/1.0/bin/make.exe" "cmTC_6d5dc/fast"
/usr/bin/make -f CMakeFiles\cmTC_6d5dc.dir\build.make CMakeFiles/cmTC_6d5dc.dir/build
'mTC_6d5dc.dir' is not recognized as an internal or external command,

 

0 Kudos

255 Views
kowshik1729
Contributor II

@nikolayyakovenk 

I haven't seen any such issue for me, but with the experience getting it compiled and ported I'd highly recommend not to use the GUI and compile it with the terminal directly. Also, please download the arm-none-eabi-gcc compiler if you don't have it or if you have MCUXpresso IDE give the correct compiler path in the Cmakelist file. Don't use the MinGW for this.

243 Views
nikolayyakovenk
Contributor III

Hi!

 

Thank you very much, I will do that. Also, I was thinking that perhaps better to use cross-compiler GCC (arm-none-eabi) on Linux? At least there is no issues with forward/backward slash. :-).

0 Kudos

240 Views
gkowshik
Contributor I

@nikolayyakovenk Yes, cross-compiling and then linking to your MCU is the better way I can think of, unless you're compiling it for any MPU's cross compiling is the best way. It makes the build faster and easier to port.

0 Kudos

1,083 Views
kowshik1729
Contributor II

More about the error I received while compiling the library

In file included from C:\Users\a0500376\Documents\opencv_porting\opencv_mcu\modules\core\src\precomp.hpp:53,
                 from C:\Users\a0500376\Documents\opencv_porting\opencv_mcu\modules\core\src\algorithm.cpp:43:
C:\Users\a0500376\Documents\opencv_porting\opencv_mcu\modules\core\include/opencv2/core/utility.hpp:718:14: error: 'recursive_mutex' in namespace 'std' does not name a type
  718 | typedef std::recursive_mutex Mutex;
      |              ^~~~~~~~~~~~~~~
C:\Users\a0500376\Documents\opencv_porting\opencv_mcu\modules\core\include/opencv2/core/utility.hpp:63:1: note: 'std::recursive_mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
   62 | #include <mutex>  // std::mutex, std::lock_guard
  +++ |+#include <mutex>
   63 | #endif
C:\Users\a0500376\Documents\opencv_porting\opencv_mcu\modules\core\include/opencv2/core/utility.hpp:719:29: error: 'Mutex' is not a member of 'cv'
  719 | typedef std::lock_guard<cv::Mutex> AutoLock;
      |                             ^~~~~
C:\Users\a0500376\Documents\opencv_porting\opencv_mcu\modules\core\include/opencv2/core/utility.hpp:719:29: error: 'Mutex' is not a member of 'cv'
C:\Users\a0500376\Documents\opencv_porting\opencv_mcu\modules\core\include/opencv2/core/utility.hpp:719:34: error: template argument 1 is invalid
  719 | typedef std::lock_guard<cv::Mutex> AutoLock;
      |                                  ^
In file included from C:\Users\a0500376\Documents\opencv_porting\opencv_mcu\modules\core\src\algorithm.cpp:43:
C:\Users\a0500376\Documents\opencv_porting\opencv_mcu\modules\core\src\precomp.hpp:369:5: error: 'Mutex' in namespace 'cv' does not name a type
  369 | cv::Mutex& getInitializationMutex();
      |     ^~~~~
modules\world\CMakeFiles\opencv_world.dir\build.make:159: recipe for target 'modules/world/CMakeFiles/opencv_world.dir/__/core/src/algorithm.cpp.obj' failed
mingw32-make[2]: *** [modules/world/CMakeFiles/opencv_world.dir/__/core/src/algorithm.cpp.obj] Error 1
CMakeFiles\Makefile2:809: recipe for target 'modules/world/CMakeFiles/opencv_world.dir/all' failed
mingw32-make[1]: *** [modules/world/CMakeFiles/opencv_world.dir/all] Error 2
Makefile:164: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
0 Kudos

968 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @kowshik1729 ,

Please make sure CMAKE version is cmake-3.10.2-win64-x64. Other version can't get good result. THREAD support must be disabled.

jingpan_0-1685588744832.png

 

Regards,

Jing

 

1,066 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kowshik1729 ,

  What's the code you are using now? the AN13725 attached software directly?

https://www.nxp.com/docs/en/application-note-software/AN13725SW.zip

  Which IDE you are using now, and the version.

  If you work this issue for your company, please use the company email to create the question again, then it will have higher support priority than the 3rd part email, thanks.

 

Best Regards,

Kerry

0 Kudos

1,062 Views
kowshik1729
Contributor II

Hi,

With all due respect, have you cross checked the content of the zip you've sent vs the content of the appnote? 

There should be fake_root, opencv sources etc., present in that zip as per the appnote but the sw you've shared is a hello world expresso project. Please cross check and let me know.

Thanks

0 Kudos

1,055 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kowshik1729 ,

  AN13725SW is for the AN13725, it is also used the opencv:

kerryzhou_0-1685079264905.png

That's why I ask what the code you are running, we need more information for your issues.

And, it's better to use your company email to create the question instead of the gmail, then we can put more working time for your question,thanks a lot for your understanding.

 

Best Regards,

Kerry

 

0 Kudos

1,042 Views
kowshik1729
Contributor II

Hi kerry,

I understand that the SW uses the expresso project in the end, but I would need the zip to perform the rest of the appnote steps like compiling opencv etc., I have searched around the community and found this the correct package https://gitee.com/crist_xu/opencv_mcu 

Also, how do I directly change from my gmail to company mail? Do I have to create a new account and post a new question?

Thanks

 

0 Kudos

1,014 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kowshik1729 ,

  Thanks for your updated information.

  Yes, you need to create a new account and post a new question, then you can AT me, then I can help you to check internally with our opencv expert about your issues.

    In your new question, please also tell me, which AN content you have tried, and have issues, then I can talk with our AN author internally about your issues.

    Thanks  a lot for your understanding.

 

Best Regards,

Kerry

0 Kudos