I am trying to compile opencv for Cortex-r5 MCU's. I have used the "gcc-arm-none-eabi-10.3-2021.10" version and I was able to get most of the things compiled correctly without any issues. However in one of the files the opencv used std::mutex and this is where the compilation failed with the following error
In file included from /home/kowshik/Desktop/opencv_porting/opencv/modules/core/src/algorithm.cpp:43:
/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();
This greatly seems to be an issue with the compiler and I wanna know how should I proceed here? Are there any other flavors of arm-none-eabi-gcc that supports mutexes out of the box and I can run for Corte-R5 cores. Apologies if I didn't understand anything properly.
The arm-none-eabi compiler is a baremetal targeted compiler. That is to say, there's no OS, and since there isn't there's no threading support and such no `std::mutex`.
So in OpenCV you need to disable threading by passing `-DOPENCV_DISABLE_THREAD_SUPPORT=ON` to cmake.
Alternatively, did you mean to actually use arm-none-linux-gnueabihf? That version of the compiler targets linux hosts and so will have std::mutex support, See https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads