Trouble Building on Windows for Android

Problems building or running the engine, queries about how to use features etc.
Post Reply
uniquejokes
Gnoblar
Posts: 3
Joined: Wed Aug 04, 2021 4:13 am

Trouble Building on Windows for Android

Post by uniquejokes »

Ogre Version: :?:
Operating System: :?: Windows 10 20H1
Render System: :?: Android

Hello I'm having some trouble building on Windows for Android using the NDK.

Everything seems to work fine but after I attempt to start compilation with make, it goes through 1-2 percent and then errors out with

"Unable to find build program".

The cmake generator im using is "Unix Makefiles". I thought is the most appropriate one since the NDK should be used to build.

I followed the instructions from here step by step (but for windows)
https://ogrecave.github.io/ogre-next/ap ... droid.html

Can anyone provide a brief summary of how to get OGRE built on windows using the NDK?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Trouble Building on Windows for Android

Post by dark_sylinc »

Hi!

Can you provide more detail on the error you're getting? A screenshot capture maybe?

Cheers
uniquejokes
Gnoblar
Posts: 3
Joined: Wed Aug 04, 2021 4:13 am

Re: Trouble Building on Windows for Android

Post by uniquejokes »

My commands for configuring and building are as follows:

Code: Select all

PS C:\Users\user1\Downloads\ogre-next-deps\build\Android\Release> pwd

Path
----
C:\Users\user1\Downloads\ogre-next-deps\build\Android\Release

cmake -DCMAKE_TOOLCHAIN_FILE="C:/Users/user1/AppData/Local/Android/Sdk/ndk/22.1.7171670/build/cmake/android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=27 -DCMAKE_MAKE_PROGRAM="C:/Users/user1/AppData/Local/Android/Sdk/ndk/22.1.7171670/prebuilt/windows-x86_64/bin/make.exe" -DCMAKE_C_COMPILER="C:/Users/user1/AppData/Local/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android27-clang.cmd" -G "Unix Makefiles"../../../


C:\Users\user1\AppData\Local\Android\Sdk\ndk\22.1.7171670\prebuilt\windows-x86_64\bin\make.exe


 CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.



[  0%] Creating directories for 'shaderc'
[  0%] No download step for 'shaderc'
[  0%] No update step for 'shaderc'
[  1%] No patch step for 'shaderc'
[  2%] Performing configure step for 'shaderc'
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
make[2]: *** [src\CMakeFiles\shaderc.dir\build.make:90: src/shaderc-prefix/src/shaderc-stamp/shaderc-configure] Error 1
make[1]: *** [CMakeFiles\Makefile2:204: src/CMakeFiles/shaderc.dir/all] Error 2
make: *** [Makefile:135: all] Error 2
Last edited by uniquejokes on Thu Aug 05, 2021 1:24 pm, edited 2 times in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Trouble Building on Windows for Android

Post by dark_sylinc »

Mmm, I have little experience trying to compile Android from Windows.

It's looking for mingw even though you're specifying it in the cmd line.

Looking at this answer from stackoverflow you may need to specify perhaps CMAKE_TOOLCHAIN_DIRECTORY?

Or maybe you're missing CMAKE_CXX_COMPILER as well?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Trouble Building on Windows for Android

Post by dark_sylinc »

Looking at the toolchain file you can specify your own path ANDROID_NDK

Try the following:

Code: Select all

cmake -DCMAKE_TOOLCHAIN_FILE="C:/Users/user1/AppData/Local/Android/Sdk/ndk/22.1.7171670/build/cmake/android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=27 -DANDROID_NDK="C:/Users/user1/AppData/Local/Android/Sdk/ndk/22.1.7171670"  -G "Unix Makefiles"../../../
Btw what's your CMake version?
uniquejokes
Gnoblar
Posts: 3
Joined: Wed Aug 04, 2021 4:13 am

Re: Trouble Building on Windows for Android

Post by uniquejokes »

Thanks for the reply!

I'm using cmake version 3.21.1

It seems to give me another error this time:


Code: Select all

PS C:\Users\user1\Downloads\ogre-next-deps\build\Android\Release> C:\Users\user1\AppData\Local\Android\Sdk\ndk\22.1.7171670\prebuilt\windows-x86_64\bin\make.exe
[  0%] Creating directories for 'shaderc'
[  0%] No download step for 'shaderc'
[  0%] No update step for 'shaderc'
[  1%] No patch step for 'shaderc'
[  2%] Performing configure step for 'shaderc'
-- The C compiler identification is Clang 11.0.5
-- The CXX compiler identification is Clang 11.0.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/user1/AppData/Local/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Users/user1/AppData/Local/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Shaderc: build type is "Release".
-- Configuring Shaderc to avoid building tests.
-- asciidoctor was not found - no documentation will be generated
-- Found PythonInterp: C:/msys64/usr/bin/python3.exe (found suitable version "3.9.6", minimum required is "3")
-- Found BISON: C:/msys64/usr/bin/bison.exe (found version "3.7.6")
-- Performing Test COMPILER_SUPPORTS_FALLTHROUGH_WARNING
-- Performing Test COMPILER_SUPPORTS_FALLTHROUGH_WARNING - Success
-- Performing Test COMPILER_SUPPORTS_EXTRA_SEMI_WARNING
-- Performing Test COMPILER_SUPPORTS_EXTRA_SEMI_WARNING - Success
-- Performing Test COMPILER_SUPPORTS_PIC
-- Performing Test COMPILER_SUPPORTS_PIC - Success
CMake Warning (dev) at third_party/spirv-tools/CMakeLists.txt:71 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'SKIP_SPIRV_TOOLS_INSTALL'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at third_party/spirv-tools/external/CMakeLists.txt:37 (add_subdirectory):
  The source directory

    C:/Users/user1/Downloads/ogre-next-deps/src/vulkan/shaderc/src/third_party/spirv-tools/external/spirv-headers

  does not contain a CMakeLists.txt file.


CMake Error at third_party/CMakeLists.txt:70 (add_subdirectory):
  The source directory

    C:/Users/user1/Downloads/ogre-next-deps/src/vulkan/shaderc/src/third_party/glslang

  does not contain a CMakeLists.txt file.


CMake Error at third_party/CMakeLists.txt:73 (message):
  glslang was not found - required for compilation


-- Configuring incomplete, errors occurred!
See also "C:/Users/user1/Downloads/ogre-next-deps/build/Android/Release/src/shaderc-prefix/src/shaderc-build/CMakeFiles/CMakeOutput.log".
make[2]: *** [src/CMakeFiles/shaderc.dir/build.make:91: src/shaderc-prefix/src/shaderc-stamp/shaderc-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:205: src/CMakeFiles/shaderc.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Trouble Building on Windows for Android

Post by dark_sylinc »

Ah! At last an error I recognize! :D

Git submodules were not downloaded.

The repo should've been cloned with:

Code: Select all

git clone --recurse-submodules --shallow-submodules https://github.com/OGRECave/ogre-next-deps
I think

Code: Select all

git submodule init
git submodule update
Will correct the situation (it should start downloading a few more subrepos)
uniquejokes
Gnoblar
Posts: 3
Joined: Wed Aug 04, 2021 4:13 am

Re: Trouble Building on Windows for Android

Post by uniquejokes »

Hello,

So I had a chance to work on this and Im still getting a similar error. I even removed the entire repo and recloned with your proposed command line just to make sure. When running make again I got this error:

Code: Select all

 C:\Users\user1\AppData\Local\Android\Sdk\ndk\22.1.7171670\prebuilt\windows-x86_64\bin\make.exe
[  1%] Performing configure step for 'shaderc'
CMake Warning (dev) at CMakeLists.txt:16 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    CMAKE_PROJECT_VERSION
    CMAKE_PROJECT_VERSION_MAJOR
    CMAKE_PROJECT_VERSION_MINOR
    CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Shaderc: build type is "Release".
-- Configuring Shaderc to avoid building tests.
-- asciidoctor was not found - no documentation will be generated
CMake Warning (dev) at third_party/spirv-tools/CMakeLists.txt:71 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'SKIP_SPIRV_TOOLS_INSTALL'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at third_party/glslang/CMakeLists.txt:71 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'SKIP_GLSLANG_INSTALL'.
This warning is for project developers.  Use -Wno-dev to suppress it.

/usr/bin/python3: can't open file '/c/Users/user1/Downloads/ogre-next-deps/build/Android/Release/src/shaderc-prefix/src/shaderc-build/C:/Users/user1/Downloads/ogre-next-deps/src/vulkan/shaderc/src/third_party/glslang/build_info.py': [Errno 2] No such file or directory
CMake Error at third_party/glslang/CMakeLists.txt:268 (list):


CMake Error at third_party/glslang/CMakeLists.txt:269 (list):
  list GET given empty list


CMake Error at third_party/glslang/CMakeLists.txt:270 (list):
  list GET given empty list


CMake Error at third_party/glslang/CMakeLists.txt:271 (list):
  list GET given empty list


CMake Error at third_party/glslang/CMakeLists.txt:272 (list):
  list GET given empty list


-- optimizer enabled
-- Configuring incomplete, errors occurred!
See also "C:/Users/user1/Downloads/ogre-next-deps/build/Android/Release/src/shaderc-prefix/src/shaderc-build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/user1/Downloads/ogre-next-deps/build/Android/Release/src/shaderc-prefix/src/shaderc-build/CMakeFiles/CMakeError.log".
make[2]: *** [src/CMakeFiles/shaderc.dir/build.make:91: src/shaderc-prefix/src/shaderc-stamp/shaderc-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:205: src/CMakeFiles/shaderc.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Post Reply