[1.12] Error building Ogre for Android

Problems building or running the engine, queries about how to use features etc.
Post Reply
Fergus86
Gnoblar
Posts: 2
Joined: Mon Sep 04, 2017 10:38 am

[1.12] Error building Ogre for Android

Post by Fergus86 »

Ogre Version: 1.12
Operating System: Kubuntu 18.10
Render System: GLES2

I'm trying to port an Ogre project to Android. I have the Android SDK installed and configurated correctly.
I can build the SDK and run the SampleBrowser for the Linux_x86_64 target, but when I tried to build the SDK for Android (on Kubuntu 18.10) following https://ogrecave.github.io/ogre/api/lat ... -ogre.html I get the next error:

Code: Select all

[  2%] Built target cpufeatures
[  2%] Built target OgreJNI_swig_compilation
[ 49%] Built target OgreMain
[ 49%] Built target Codec_STBI
[ 51%] Built target Plugin_OctreeSceneManager
[ 61%] Built target Plugin_ParticleFX
[ 61%] Built target OgreGLSupport
[ 64%] Built target OgrePaging
[ 64%] Built target OgreProperty
[ 68%] Built target OgreVolume
[ 74%] Built target OgreMeshLodGenerator
[ 77%] Built target OgreHLMS
[ 80%] Built target OgreTerrain
[ 88%] Built target RenderSystem_GLES2
[ 99%] Built target OgreRTShaderSystem
[100%] Linking CXX shared module ../../java/libs/armeabi-v7a/libOgreJNI.so
/home/fergus/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lOgreBites
/home/fergus/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lOgreOverlay
/home/fergus/Downloads/ogre_build_android/java/src/org/ogre/OgreJAVA_wrap.cxx:34432: error: undefined reference to 'Ogre::EmbeddedZipArchiveFactory::addEmbbeddedFile(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, unsigned char const*, unsigned int, bool (*)(unsigned int, void*, unsigned int))'
/home/fergus/Downloads/ogre_build_android/java/src/org/ogre/OgreJAVA_wrap.cxx:34464: error: undefined reference to 'Ogre::EmbeddedZipArchiveFactory::removeEmbbeddedFile(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
/home/fergus/Downloads/ogre-master/OgreMain/include/OgreZip.h:105: error: undefined reference to 'Ogre::EmbeddedZipArchiveFactory::EmbeddedZipArchiveFactory()'
/home/fergus/Downloads/ogre_build_android/java/src/org/ogre/OgreJAVA_wrap.cxx:0: error: undefined reference to 'vtable for Ogre::APKZipArchiveFactory'
/home/fergus/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Components/Java/CMakeFiles/OgreJNI.dir/build.make:101: recipe for target 'java/libs/armeabi-v7a/libOgreJNI.so' failed
make[2]: *** [java/libs/armeabi-v7a/libOgreJNI.so] Error 1
CMakeFiles/Makefile2:929: recipe for target 'Components/Java/CMakeFiles/OgreJNI.dir/all' failed
make[1]: *** [Components/Java/CMakeFiles/OgreJNI.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
It seems OgreBites and OgreOverlay are not built, and an error of Ogre::EmbeddedZipArchiveFactory (I don't know if it's related). I tried adding the options:

Code: Select all

-DOGRE_BUILD_COMPONENT_BITES=TRUE -DOGRE_BUILD_COMPONENT_OVERLAY=TRUE
but they don't do anything, with these options added the summary of the building of cmake is:

Code: Select all

-- 
----------------------------------------------------------------------------
  FEATURE SUMMARY
----------------------------------------------------------------------------

Building components:
  + HLMS [BETA]
  + MeshLodGenerator
  + Paging
  + Property
  + Java/ JNI [BETA]
  + RTShader System
  + RTShader System Core Shaders
  + RTShader System Extensions Shaders
  + Terrain
  + Volume
Building plugins:
  + Octree scene manager
  + STBI codec (generic)
  + Particle FX
Building rendersystems:
  + OpenGL ES2/ ES3
Building core features:
  + Mesh Lod
  + DDS image codec (.dds)
  + PVRTC image codec (.pvr)
  + ETC image codec (.pkm, .ktx) 

Build type:                      static
Thread safety:                   none
ResourceManager behaviour:       strict
Use double precision:            disabled
Nodes inherit transform:         disabled
Assert mode:                     release exceptions

----------------------------------------------------------------------------

-- Configuring done
-- Generating done
Thanks

PS: Links of Pre-built SDK for Android of version 1.11 and 1.12 in https://www.ogre3d.org/download/sdk point to the same dead link
paroj
OGRE Team Member
OGRE Team Member
Posts: 1995
Joined: Sun Mar 30, 2014 2:51 pm
x 1075
Contact:

Re: [1.12] Error building Ogre for Android

Post by paroj »

these errors are caused by the libzzip and libfreetype dependencies not being available. Verify that OGRE_BUILD_DEPENDENCIES=TRUE.

Also I fixed the links to the prebuilt SDK. It still at 1.11.4 though.
Fergus86
Gnoblar
Posts: 2
Joined: Mon Sep 04, 2017 10:38 am

Re: [1.12] Error building Ogre for Android

Post by Fergus86 »

I run this command to build the SDK:

Code: Select all

cmake ../ogre-master -DCMAKE_TOOLCHAIN_FILE=/home/fergus/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_NDK=/home/fergus/Android/Sdk/ndk-bundle -DOGRE_BUILD_DEPENDENCIES=TRUE
but according to the cmake configuration they are not avaible

Code: Select all

-----------------------------------------------------------------------------
-- The following OPTIONAL packages could NOT be located on your system.
-- Consider installing them to enable more features from this software.
+ zziplib: Extract data from zip archives <http://zziplib.sourceforge.net>
+ freeimage: Support for commonly used graphics image formats <http://freeimage.sourceforge.net>
+ freetype: Portable font engine <http://www.freetype.org>
+ OpenEXR: Load High dynamic range images <http://www.openexr.com/>
+ Python: Language bindings to use OGRE from Python <http://www.python.org/>
+ Softimage: Softimage SDK needed for building XSIExporter <FALSE>
+ GLSL Optimizer: GLSL Optimizer <http://github.com/aras-p/glsl-optimizer/>
+ HLSL2GLSL: HLSL2GLSL <http://hlsl2glslfork.googlecode.com/>
-----------------------------------------------------------------------------
and of course I get the same error as before. Maybe I have to add addicional options (a path for libzzip and freetype) to cmake?

For the Linux_x86_64 target the dependencies are met:

Code: Select all

-----------------------------------------------------------------------------
-- The following external packages were located on your system.
-- This installation will have the extra features provided by these packages.
+ zlib
+ zziplib
+ freeimage
+ freetype
+ X11
+ Xaw
+ OpenGL
+ OpenGL ES 2.x
+ cg
+ Python
+ SDL2
+ Doxygen
-----------------------------------------------------------------------------
Post Reply