4

I am trying to install openCV contrib modules as stated in a website as follows:

cd opencv\platfroms\
mkdir build_android_arm
cd build_android_arm
cmake -G "Unix Makefiles" -  
DCMAKE_TOOLCHAIN_FILE=..\android\android.toolchain.cmake ..\..
make

the problem i am facing is, when i try to run the commands mentioned above i got a message in the cmd as shown in the figure below

I have MinGW, CMake and GnuWin installed but i do NOT have visual Studio and i am working on a Windows operating system, but i do not know why the error message in the cmd mentions Unix Makefiles

please i need your help to solve my problem

error message

enter image description here

update:

enter image description here

update2-: i delted the contents inside "android_arm" and i ran the command, and i got the message in the belwo picture

enter image description here

**update3*: I also added the ANDROID_NDK to the system variables as shown in the image

enter image description here

but i still get the errors shown below

enter image description here

Amrmsmb
  • 1
  • 27
  • 104
  • 226

1 Answers1

1

It doesn't work because on Windows (if not running the new Ubuntu bash) you can't give CMake "Unix Makefiles" as a generator.

Use -G "MinGW Makefiles" instead.

See the android.toolchain.cmake file itself for more details:

#  Usage Linux:
#   $ export ANDROID_NDK=/absolute/path/to/the/android-ndk
#   $ mkdir build && cd build
#   $ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake ..
#   $ make -j8
#
#  Usage Windows:
#     You need native port of make to build your project.
#     Android NDK r7 (and newer) already has make.exe on board.
#     For older NDK you have to install it separately.
#     For example, this one: http://gnuwin32.sourceforge.net/packages/make.htm
#
#   $ SET ANDROID_NDK=C:\absolute\path\to\the\android-ndk
#   $ mkdir build && cd build
#   $ cmake.exe -G"MinGW Makefiles"
#       -DCMAKE_TOOLCHAIN_FILE=path\to\the\android.toolchain.cmake
#       -DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%\prebuilt\windows\bin\make.exe" ..
#   $ cmake.exe --build .
IInspectable
  • 46,945
  • 8
  • 85
  • 181
Florian
  • 39,996
  • 9
  • 133
  • 149
  • please see the update section above..after i used the answer you provided i got an error message in the cmd as shown in the update section – Amrmsmb Oct 15 '16 at 19:57
  • @user2121 You have to delete the `build_android_arm` directory before trying again. CMake does not allow to switch generators after it has once started to generate an build environment. – Florian Oct 15 '16 at 20:05
  • @user2121 MinGW GCC package doesn't include make. The Readme as quoted in my answer suggests to use the make program shipped with Android NDK. – Florian Oct 15 '16 at 20:26
  • i ran the comands that are stated in your answer but i am still getting an error and i do not know how to solve it..please have a look at update3 section above – Amrmsmb Oct 16 '16 at 09:25
  • @user2121 Check your installations (CMake, MinGW, NDK, etc.) with small hello world examples (see also e.g. [here](http://stackoverflow.com/questions/32801638/cmake-error-at-cmakelists-txt30-project-no-cmake-c-compiler-could-be-found)). The problem for me is, that the possible causes for your new problems could be numerous (and I think have - like NDK/MinGW - already be discussed here on SO elsewhere). And please see e.g. [here](http://meta.stackoverflow.com/questions/253762) why I'm a little reluctant to continue answering an ever changing question. – Florian Oct 17 '16 at 08:32