Error while building OpenCV 3.1.0 with extra modules on OS X Mavericks - c++

I am a beginner in OpenCV, using OpenCV 3.1.0 (downloaded from OpenCV.org) with Mac OS X 10.9.5.
I was trying to run a code which needs contrib.hpp, then I found the extra modules from Github. There is a command from the page:
$ cd <opencv_build_directory>
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
$ make -j5
Everything was successful before I did make, it shows an error of no matching function for call to 'calibrateCamera' :
[ 92%] Building CXX object modules/aruco/CMakeFiles/opencv_aruco.dir/src/aruco.cpp.o
/Users/Youko/downloads/opencv_contrib-master/modules/aruco/src/aruco.cpp:1583:12: error:
no matching function for call to 'calibrateCamera'
return calibrateCamera(processedObjectPoints, processedImagePoints, ...
^~~~~~~~~~~~~~~
/Users/Youko/downloads/opencv-3.1.0/modules/calib3d/include/opencv2/calib3d.hpp:844:21: note:
candidate function not viable: requires at most 9 arguments, but 12 were
provided
CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints,
^
1 error generated.
make[2]: *** [modules/aruco/CMakeFiles/opencv_aruco.dir/src/aruco.cpp.o] Error 1
make[1]: *** [modules/aruco/CMakeFiles/opencv_aruco.dir/all] Error 2
make: *** [all] Error 2
In the case of I wanna keep the version of Mac OSX, I was thinking of change the version of OpenCV, so I've downloaded OpenCV from Github, and tried to install the OpenCV with following command (it was the same way as how I've installed OpenCV 3.1.0 successfully):
$ cd <opencv_source_directory>
$ mkdir release
$ cd release
$ cmake -G "Unix Makefiles" ..
$ make
$ sudo make install
But there is another problem when I tried make:
[ 44%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_mjpeg_decoder.cpp.o
[ 44%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_avfoundation_mac.mm.o
[ 44%] Linking CXX shared library ../../lib/libopencv_videoio.dylib
ld: framework not found CoreImage
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libopencv_videoio.3.1.0.dylib] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2
I thought maybe there was something wrong with cmake, so I tried the following command as well but the same error occurred with make:
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
I've googled for the problem and it seems like I must need the QuartzCore, but most of people said it should be included in the Xcode (I am using Xcode 6.2 btw). I tried both ways to figure it out but I still have no idea why I can't build the extra modules. (I think the most weird problem is that I cannot install OpenCV cloned from Github, but I just wanna show I tried this way but it wasn't successful FYI.)
I'd be most grateful for any help and suggestions!

Related

Building TBB on Windows using MingW & Cmake

Hey I'm trying to build TBB on my Windows computer using MinGW & CMake. (gcc,,g++, ..)
I have already tried using the premade binaries but I keep getting undefined reference issues.
My cmake for the project I'm trying to import it in looks as following:
find_package(TBB REQUIRED tbb)
target_link_libraries(projectName PRIVATE ${TBB_IMPORTED_TARGETS})
I use the source code of https://github.com/oneapi-src/oneTBB/releases/tag/v2021.3.0 (latest)
and I make a build dir and cd into it and execute:
cmake .. -G "MinGW Makefiles"
followed by:
cmake --build .
also tried:
mingw32-make
Both result into
[ 1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj
In file included from c:\users\refactor\downloads\onetbb-2021.3.0\onetbb-2021.3.0\include\oneapi\tbb\detail\_utils.h:26,
from C:\Users\Refactor\Downloads\oneTBB-2021.3.0\oneTBB-2021.3.0\src\tbb\address_waiter.cpp:17:
c:\users\refactor\downloads\onetbb-2021.3.0\onetbb-2021.3.0\include\oneapi\tbb\detail\_machine.h:67: error: ignoring '#pragma intrinsic ' [-Werror=unknown-pragmas]
67 | #pragma intrinsic(_mm_mfence)
|
compilation terminated due to -Wfatal-errors.
cc1plus.exe: all warnings being treated as errors
mingw32-make[2]: *** [src\tbb\CMakeFiles\tbb.dir\build.make:76: src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:454: src/tbb/CMakeFiles/tbb.dir/all] Error 2
mingw32-make: *** [makefile:165: all] Error 2```
As mentioned in the comments there are issues building with MinGW with the latest versions of TBB.
The last version of TBB I was able to build was 2020.0 using this command (replace intel64 with ia32 for 32-bit):
mingw32-make compiler=gcc arch=intel64 runtime=mingw tbb tbbmalloc CPLUS="g++ -static-libstdc++ -static-libgcc"

can't run c++ file (.cpp) in CLion

I am a level -1 C++ programmer and this is my first program running c++ and I'm trying to run hello world in C++ but when I run ''myfirstprogram.cpp'' after compiling it.
CLion gives error
it can't run the .cpp file because it can't build it for some reason can someone help me?
I already have Xcode installed and command line tools.
in preferences CLion detected Xcode automatically.
gcc, cc and c++ is already correctly installed.
mehmetalibayram#MacBook-Pro-van-Mehmet ~> whereis gcc
/usr/bin/gcc
mehmetalibayram#MacBook-Pro-van-Mehmet ~> whereis cc
/usr/bin/cc
mehmetalibayram#MacBook-Pro-van-Mehmet ~> whereis g++
/usr/bin/g++
mehmetalibayram#MacBook-Pro-van-Mehmet ~>
/Applications/Jetbrains/CLion.app/Contents/bin/cmake/mac/bin/cmake --build "/Users/mehmetalibayram/OneDrive/CLion/cpp/cmake-build-debug" --target cpp -- -j 12
[ 33%] Linking CXX executable cpp
duplicate symbol '_main' in:
CMakeFiles/cpp.dir/main.cpp.o
CMakeFiles/cpp.dir/myfirstprogram/myfirstprogram.cpp.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [CMakeFiles/cpp.dir/build.make:119: cpp] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:96: CMakeFiles/cpp.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:103: CMakeFiles/cpp.dir/rule] Error 2
gmake: *** [Makefile:138: cpp] Error 2
what did I do wrong, can someone help me please?
A function needs to be uniquely identifiable. In our case you have two functions with the same name, main, to be specific. Make sure that you have a single main function (which will be the entry point, by the way), so rename the other function to something else and call it from your main.

Ipopt installation

I tried to install the Ipopt package on my Mac (macOS Catalina, 10.15.0) following this installation guide:
https://coin-or.github.io/Ipopt/INSTALL.html
I installed ASL as the linear solver and made it to the point 3. makewithout any further issues. However, when I run make test, I receive the following error message:
cd test; /Applications/Xcode.app/Contents/Developer/usr/bin/make test
CXX hs071_main.o
CXX hs071_nlp.o
CXXLD hs071_cpp
CC hs071_c.o
CCLD hs071_c
ln -s ../examples/hs071_f/hs071_f.f hs071_f.f
F77 hs071_f.o
F77LD hs071_f
ld: library not found for -lmkl_core
collect2: error: ld returned 1 exit status
make[1]: *** [hs071_f] Error 1
make: *** [unitTest] Error 2
Does anyone know how to fix this issue? It seems like it can't find the mkl library...
Yes, you have to install the Intel MKL library https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html since it is not part of Mac OS.

certain headers arent being found, even though I've included them. Aside from using quotes, how can I fix this?

Ive downloaded the SDL2 library using brew install SDL2 but when I am trying to compile melonDS for Mac, I keep banging my head against the wall of the annoying error of
bash-3.2$ make
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/bigman/melonDS/build
[ 1%] Building CXX object CMakeFiles/melonDS.dir/src/libui_sdl/main.cpp.o
/Users/bigman/melonDS/src/libui_sdl/main.cpp:24:10: fatal error:
'SDL2/SDL.h' file not found
#include <SDL2/SDL.h>
^~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/melonDS.dir/src/libui_sdl/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/melonDS.dir/all] Error 2
make: *** [all] Error 2
bash-3.2$
I've uninstalled, reinstalled, tried to use compiler flags in the makefile (which did't work because the project uses cmake) but to no avail. Any other reccomendations would be great.

Compile Lua 5.3 Mingw64 MSys2

I have installed mingw64 and MSYS2 from the official site (http://mingw-w64.org/doku.php) following the instructions. Added bin folders to win7 PATH var. Everything seems to work. I run this command from MSYS2:
gcc --version
and it works.
Now I´m trying to install Lua 5.3 (lua-5.3.1.tar.gz from lua.org). I decompressed the file using WinRAR. From MSYS2, I go to my Lua directory
cd /e/Programming/Libs/lua-5.3.1/
then I run the make command
mingw32-make mingw
But it doesn´t work. I got this message...
cd src && E:/Programming/mingw64/mingw64/bin/mingw32-make mingw
mingw32-make[1]: Entering directory 'E:/Programming/Libs/lua-5.3.1/src'
E:/Programming/mingw64/mingw64/bin/mingw32-make "LUA_A=lua53.dll" "LUA_T=lua.exe" \
"AR=gcc -std=gnu99 -shared -o" "RANLIB=strip --strip-unneeded" \
"SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
E:\Programming\mingw64\mingw64\bin\mingw32-make: invalid option -- =
E:\Programming\mingw64\mingw64\bin\mingw32-make: invalid option -- g
E:\Programming\mingw64\mingw64\bin\mingw32-make: invalid option -- u
E:\Programming\mingw64\mingw64\bin\mingw32-make: invalid option -- 9
E:\Programming\mingw64\mingw64\bin\mingw32-make: invalid option -- 9
E:\Programming\mingw64\mingw64\bin\mingw32-make: invalid option -- a
E:\Programming\mingw64\mingw64\bin\mingw32-make: unrecognized option '--strip-unneeded SYSCFLAGS=-DLUA_BUILD_AS_DLL SYSLIBS= SYSLDFLAGS=-s lua.exe'
Usage: mingw32-make [options] [target] ...
This program built for x86_64-w64-mingw32
Report bugs to <bug-make#gnu.org>
makefile:116: recipe for target 'mingw' failed
mingw32-make[1]: *** [mingw] Error 2
mingw32-make[1]: Leaving directory 'E:/Programming/Libs/lua-5.3.1/src'
makefile:55: recipe for target 'mingw' failed
mingw32-make: *** [mingw] Error 2
I dont want to download Lua binaries, I want to compile it myself
How can I fix this?
I was having the same issue. I looked at this page:
http://www.thijsschreijer.nl/blog/?p=863
What I saw was that I did not have c:\mingw\msys\1.0\bin in my path variable. I added it just after the MinGW\bin path and it worked fine then.