Android build quick start guide

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Clonkex
Gnoblar
Posts: 24
Joined: Fri Jul 13, 2012 3:21 am
Location: Northern Tablelands, NSW, Australia

Re: Android build quick start guide

Post by Clonkex » Wed Jun 25, 2014 2:55 am

c6burns wrote:No problem, I can't explain why the GUI doesn't work the same, but it doesn't :D
Indeed, I have found this also. Whenever a guide doesn't work, always go back and try it again, following every single instruction to the letter :)
0 x

User avatar
tzbrozek
Gnoblar
Posts: 6
Joined: Tue Jun 17, 2014 9:22 am

Re: Android build quick start guide

Post by tzbrozek » Sat Jul 05, 2014 5:11 pm

Hi,

I try to build Ogre 1.9 for Android under Linux, I follow the instructions in this topic and also in tutorials but I get following error:

Code: Select all

CMake Warning at CMake/toolchain/android.toolchain.cmake:315 (message):
  Could not uniquely determine machine name for compiler from
  /mnt/bonobo/android/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86.
Call Stack (most recent call first):
  CMake/toolchain/android.toolchain.cmake:480 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:90 (include)
  CMakeLists.txt:46 (project)

etc.
I build with
cmake -DCMAKE_TOOLCHAIN_FILE=../CMake/toolchain/android.toolchain.cmake -DANDROID_GLES_ONLY=TRUE -DOGRE_DEPENDENCIES_DIR="/mnt/bonobo/android/AndroidDependencies" -DANDROID_ABI=armeabi -DANDROID_NATIVE_API_LEVEL=9 ..

and when I do the same on 1.10 version it configures ok but then on 70% of compilation progress I get an error:

Code: Select all

In file included from /home/tomek/ogre-current/RenderSystems/GLES/include/OgreGLESRenderSystem.h:33:0,
                 from /home/tomek/ogre-current/RenderSystems/GLES/src/EGL/OgreEGLContext.cpp:29:
/home/tomek/ogre-current/RenderSystems/GLES/src/EGL/OgreEGLContext.cpp: In member function 'virtual void Ogre::EGLContext::_destroyInternalResources()':
/home/tomek/ogre-current/RenderSystems/GLES/include/OgreGLESPrerequisites.h:194:13: error: incomplete type 'Ogre::LogManager' used in nested name specifier
             LogManager::getSingleton().logMessage(msgBuf);\
             ^
/home/tomek/ogre-current/RenderSystems/GLES/src/EGL/OgreEGLContext.cpp:90:9: note: in expansion of macro 'EGL_CHECK_ERROR'
         EGL_CHECK_ERROR
         ^
So what should I do? :) What is the problem with 1.9 version? Or how to fix 1.10 version?
0 x

Clonkex
Gnoblar
Posts: 24
Joined: Fri Jul 13, 2012 3:21 am
Location: Northern Tablelands, NSW, Australia

Re: Android build quick start guide

Post by Clonkex » Sun Jul 06, 2014 1:25 am

I have virtually no experience with Linux, but I'll suggest some things that come to mind and hope at least one of them is even vaguely relevant.

What build of Linux are you using? It almost sounds like CMake is failing to work out your computer's name.

Does CMake have a GUI for Linux? On Windows, there's actually a strong difference between things built with the cmd-line tool and things built with the GUI - not sure why this is.

Are you trying to build an Android APK? If so, are you following the correct procedure? Because it looks to me (again, no experience with Linux) like you're building a Linux binary with Android CMake parameters.

I may be completely wrong on all of that, though.
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Android build quick start guide

Post by c6burns » Sun Jul 06, 2014 1:48 am

Go with 1.10 because you are using NDK r9d which AFAIK is only supported in 1.10s build system. You are building GLES 1.x only and it's possible no one has tried this in a while (I sure haven't). Add this to <src dir>/RenderSystems/GLES/include/OgreGLESPrerequisites.h:

Code: Select all

#include "OgrePrerequisites.h" // this line will already exist
#include "OgreLogManager.h" // add this line
0 x

User avatar
tzbrozek
Gnoblar
Posts: 6
Joined: Tue Jun 17, 2014 9:22 am

Re: Android build quick start guide

Post by tzbrozek » Sun Jul 06, 2014 10:03 am

Clonkex - I use Mint Linux 17 (so it's Ubuntu 14.04 LTS)

c6burns - I did what you suggested and 1.10 almost compiled but I got:

Code: Select all

Scanning dependencies of target SampleBrowserDummy
[100%] Building CXX object Samples/Browser/CMakeFiles/SampleBrowserDummy.dir/dummy.cpp.o
Linking CXX shared module ../../lib/libSampleBrowserDummy.so
Error: Target id 'android-10' is not valid. Use 'android list targets' to get the target ids.
make[2]: *** [lib/libSampleBrowserDummy.so] Błąd 1
make[1]: *** [Samples/Browser/CMakeFiles/SampleBrowserDummy.dir/all] Błąd 2
make: *** [all] Błąd 2
I tried also with NDK r8e but I have the same error as above. What NDK version do you use?
(BTW: On Ogre 1.9 but with NDK r8e still the same error as before: "Could not uniquely determine machine name")

I run "android list targets" (in SDK) command and it appears I have:

Code: Select all

Available Android targets:
----------
id: 1 or "android-19"
     Name: Android 4.4.2
     Type: Platform
     API level: 19
     Revision: 3
     Skins: WXGA800, WVGA854, WXGA720, WXGA800-7in, WSVGA, HVGA, QVGA, WQVGA400, WVGA800 (default), WQVGA432
 Tag/ABIs : default/armeabi-v7a
So I configured Makefile for armeabi-v7a (-DANDROID_ABI="armeabi-v7a") destination but again I have the same compilation error: "Target id 'android-10' is not valid"
Where the change should be done?
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Android build quick start guide

Post by c6burns » Sun Jul 06, 2014 12:54 pm

You have Ogre fully built, you just are failing on building the samplebrowser because you didn't install android-10. At this point CMake is building the SampleBrowserSDK project for you, which you can do yourself by running ndk-build and then ant debug in the project directory. Either use the SDK manager to install android-10 (2.3.3) or switch the target to one you have (by modifying project.properties or using the android tools to update the project with the new target).

If you want to build 1.9 then use r8c. It says so right in the quickstart. 1.10 is fine though.
0 x

User avatar
tzbrozek
Gnoblar
Posts: 6
Joined: Tue Jun 17, 2014 9:22 am

Re: Android build quick start guide

Post by tzbrozek » Sun Jul 06, 2014 7:29 pm

c6burns - Thanx a lot for help! :) Finally I did it!!! I run SampleBrowser on the Android Tablet!:)
I had to upgrade Android SDK because Ogre 1.10 didn't want to build APK with my version of SDK (from March ;). And also I had to install java jdk...
I also downloaded android-10 platform.

BTW: I can't download NDK r8c: https://dl.google.com/android/ndk/andro ... 64.tar.bz2, it looks this file doesn't exist anymore.

Now I have to learn how to use Ogre ;))
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Android build quick start guide

Post by c6burns » Sun Jul 06, 2014 8:44 pm

I would say stick with the latest NDK and v1-10 branch if you are just starting development. I have an existing project using r8d and v1-9, but my test environment for new stuff is r9d and v1-10. Glad you got it working, have fun!

EDIT: oh i forgot, there is no v1-10 ... its default branch (at least for now)
Last edited by c6burns on Mon Jul 07, 2014 5:46 am, edited 1 time in total.
0 x

Clonkex
Gnoblar
Posts: 24
Joined: Fri Jul 13, 2012 3:21 am
Location: Northern Tablelands, NSW, Australia

Re: Android build quick start guide

Post by Clonkex » Mon Jul 07, 2014 12:56 am

Great, glad you got it working and that I was no help whatsoever :P
0 x

planrich
Gnoblar
Posts: 2
Joined: Tue Sep 09, 2014 8:21 am

Re: Android build quick start guide

Post by planrich » Tue Sep 09, 2014 9:03 pm

Hi,

I can't get the app running using only the GLES (not version 2). Thus I tried without -DANDROID_GLES_ONLY=TRUE. It compiled and I was able to successfully install
the apk both onto my tablet & phone. Problem is that only red background is rendered... In the whole build there was no obvious error. I'm using arch linux, and android ndk r10 and the 1.10 ogre source (hg default branch, changeset 6573:808a332b5725)

Code: Select all

$ cmake -DCMAKE_TOOLCHAIN_FILE=/home/rich/proj/android-cmake/android.toolchain.cmake -DOGRE_DEPENDENCIES_DIR="/home/rich/proj/ogre-2/AndroidDependencies" -DANDROID_ABI=armeabi-v7a-DANDROID_NATIVE_API_LEVEL=9   .. 
sysroot is now: /opt/android-ndk-r10/platforms/android-9/arch-arm
-- Configuring OGRE 1.10.0unstable
-- Detected g++ 4.8

-- Enabling GCC visibility flags
-- Search path: /home/rich/proj/ogre-3/AndroidDependencies;/home/rich/proj/ogre-2/build/Dependencies;/home/rich/proj/ogre-2/Dependencies;/home/rich/proj/ogre-2/build/../Dependencies;/home/rich/proj/ogre-2/../Dependencies
-- Looking for ZLIB...
-- Found ZLIB: optimized;/opt/android-ndk-r10/platforms/android-9/arch-arm/usr/lib/libz.so;debug;/opt/android-ndk-r10/platforms/android-9/arch-arm/usr/lib/libz.so
-- Looking for ZZip...
-- Found ZZip: optimized;/home/rich/proj/ogre-android/Dependencies/lib/armeabi-v7a/libzzip.a;debug;/home/rich/proj/ogre-android/Dependencies/lib/armeabi-v7a/libzzip.a
-- Looking for FreeImage...
-- Found FreeImage: optimized;/home/rich/proj/ogre-android/Dependencies/lib/armeabi-v7a/libFreeImage.a;debug;/home/rich/proj/ogre-android/Dependencies/lib/armeabi-v7a/libFreeImage.a
-- Looking for FREETYPE...
-- CMAKE_PREFIX_PATH: /home/rich/proj/ogre-3/AndroidDependencies;/home/rich/proj/ogre-2/build/Dependencies;/home/rich/proj/ogre-2/Dependencies;/home/rich/proj/ogre-2/build/../Dependencies;/home/rich/proj/ogre-2/../Dependencies;/usr/local;/usr/lib/armv7-a-linux-gnu
-- CMAKE_PREFIX_PATH: /home/rich/proj/ogre-3/AndroidDependencies;/home/rich/proj/ogre-2/build/Dependencies;/home/rich/proj/ogre-2/Dependencies;/home/rich/proj/ogre-2/build/../Dependencies;/home/rich/proj/ogre-2/../Dependencies;/usr/local;/usr/lib/armv7-a-linux-gnu
-- Found FREETYPE: optimized;/home/rich/proj/ogre-android/Dependencies/lib/armeabi-v7a/libfreetype.a;debug;/home/rich/proj/ogre-android/Dependencies/lib/armeabi-v7a/libfreetype.a
-- Could NOT find OpenGL (missing:  OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR) 
-- Looking for POCO...
-- Could not locate POCO
-- Looking for TBB...
-- Could not locate TBB
-- Looking for GLSL_Optimizer...
-- GLSL_Optimizer_PREFIX_PATH changed.
-- Found GLSL_Optimizer: optimized;/home/rich/proj/ogre-3/AndroidDependencies/lib/armeabi/libglsl_optimizer.a;debug;/home/rich/proj/ogre-3/AndroidDependencies/lib/armeabi/libglsl_optimizer.a
-- Looking for HLSL2GLSL...
-- HLSL2GLSL_PREFIX_PATH changed.
-- Could not locate HLSL2GLSL
-- Looking for OIS...
-- OIS_PREFIX_PATH changed.
-- Found OIS: optimized;/home/rich/proj/ogre-3/AndroidDependencies/lib/armeabi/libOIS.a;debug;/home/rich/proj/ogre-3/AndroidDependencies/lib/armeabi/libOIS.a
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Looking for Softimage...
-- Could not locate Softimage
-- Could NOT find TinyXML (missing:  TINYXML_INCLUDE_DIR TINYXML_LIBRARIES) 
-- Looking for CppUnit...
-- Could not locate CppUnit
-- 
-----------------------------------------------------------------------------
-- The following external packages were located on your system.
-- This installation will have the extra features provided by these packages.
+ zlib
+ zziplib
+ freeimage
+ freetype
+ OpenGL ES 1.x
+ OpenGL ES 2.x
+ OpenGL ES 3.x
+ GLSL Optimizer
+ OIS
-----------------------------------------------------------------------------
-- The following OPTIONAL packages could NOT be located on your system.
-- Consider installing them to enable more features from this software.
+ OpenGL 3+: Support for the OpenGL 3+ render system <http://www.opengl.org/>
+ boost: Boost (general) <http://boost.org>
+ boost-thread: Used for threading support <http://boost.org>
+ boost-date_time: Used for threading support <http://boost.org>
+ POCO: POCO framework <http://pocoproject.org/>
+ tbb: Threading Building Blocks <http://www.threadingbuildingblocks.org/>
+ HLSL2GLSL: HLSL2GLSL <http://hlsl2glslfork.googlecode.com/>
+ Doxygen: Tool for building API documentation <http://doxygen.org>
+ Softimage: Softimage SDK needed for building XSIExporter <FALSE>
+ TinyXML: TinyXML needed for building OgreXMLConverter <FALSE>
+ CppUnit: Library for performing unit tests <http://cppunit.sourceforge.net>
-----------------------------------------------------------------------------

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

Building components:
  + Paging
  + MeshLodGenerator
  + Terrain
  + RTShader System
  + RTShader System Core Shaders
  + RTShader System Extensions Shaders
  + Volume
  + Overlay
Building plugins:
  + Octree scene manager
  + Particle FX
Building rendersystems:
  + OpenGL ES 2.x
Building executables:
  + Samples
Building core features:
  + Mesh Lod
  + DDS image codec
  + PVRTC image codec
  + ETC image codec
  + FreeImage codec
  + ZIP archives

Build type:                      static
Threading support:               none
Use double precision:            disabled
Assert mode:                     standard
Allocator type:                  nedmalloc (pooling)
STL containers use allocator:    enabled
Strings use allocator:           disabled
Memory tracker (debug):          disabled
Memory tracker (release):        disabled
Use Boost:                       disabled

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

-- Configuring done
-- Generating done
-- Build files have been written to: /home/rich/proj/ogre-2/build
Here the adb log:

Code: Select all

D/dalvikvm( 2189): Late-enabling CheckJNI
I/ActivityManager(  424): Start proc org.ogre.jni for activity org.ogre.jni/org.ogre3d.android.MainActivity: pid=2189 uid=10066 gids={50066, 1028, 1015, 3003}
I/dalvikvm( 2189): Enabling JNI app bug workarounds for target SDK version 9...
V/PhoneStatusBar(  485): setLightsOn(true)
D/dalvikvm( 2189): Trying to load lib /data/app-lib/org.ogre.jni-2/libOgreJNI.so 0x41874278
D/dalvikvm( 2189): Added shared lib /data/app-lib/org.ogre.jni-2/libOgreJNI.so 0x41874278
I/OGRE    ( 2189): Creating resource group General
I/OGRE    ( 2189): Creating resource group Internal
I/OGRE    ( 2189): Creating resource group Autodetect
I/OGRE    ( 2189): SceneManagerFactory for type 'DefaultSceneManager' registered.
I/OGRE    ( 2189): Registering ResourceManager for type Material
I/OGRE    ( 2189): Registering ResourceManager for type Mesh
I/OGRE    ( 2189): Registering ResourceManager for type Skeleton
I/OGRE    ( 2189): MovableObjectFactory for type 'ParticleSystem' registered.
I/OGRE    ( 2189): ArchiveFactory for archive type FileSystem registered.
I/OGRE    ( 2189): ArchiveFactory for archive type Zip registered.
I/OGRE    ( 2189): ArchiveFactory for archive type EmbeddedZip registered.
I/OGRE    ( 2189): DDS codec registering
I/ActivityManager(  424): Displayed org.ogre.jni/org.ogre3d.android.MainActivity: +234ms
I/OGRE    ( 2189): FreeImage version: 3.15.3
I/OGRE    ( 2189): This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
I/OGRE    ( 2189): Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,3fr,arw,bay,bmq,cap,cine,cr2,crw,cs1,dc2,dcr,drf,dsc,dng,erf,fff,ia,iiq,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,ptx,pxn,qtk,raf,raw,rdc,rw2,rwl,rwz,sr2,srf,srw,sti
I/OGRE    ( 2189): PVRTC codec registering
I/OGRE    ( 2189): ETC codec registering
I/OGRE    ( 2189): Registering ResourceManager for type HighLevelGpuProgram
I/OGRE    ( 2189): Registering ResourceManager for type Compositor
I/OGRE    ( 2189): MovableObjectFactory for type 'Entity' registered.
I/OGRE    ( 2189): MovableObjectFactory for type 'Light' registered.
I/OGRE    ( 2189): MovableObjectFactory for type 'BillboardSet' registered.
I/OGRE    ( 2189): MovableObjectFactory for type 'ManualObject' registered.
I/OGRE    ( 2189): MovableObjectFactory for type 'BillboardChain' registered.
I/OGRE    ( 2189): MovableObjectFactory for type 'RibbonTrail' registered.
E/OGRE    ( 2189): OGRE EXCEPTION(6:FileNotFoundException): 'plugins.cfg' file not found! in ConfigFile::load at /home/rich/proj/ogre-2/OgreMain/src/OgreConfigFile.cpp (line 88)
I/OGRE    ( 2189): plugins.cfg not found, automatic plugin loading disabled.
I/OGRE    ( 2189): *-*-* OGRE Initialising
I/OGRE    ( 2189): *-*-* Version 1.10.0unstable (Xalafu)
I/OGRE    ( 2189): Installing plugin: OpenGL ES 2.0 RenderSystem
I/OGRE    ( 2189): OpenGL ES 2.x Rendering Subsystem created.
I/OGRE    ( 2189): Plugin successfully installed
I/OGRE    ( 2189): Installing plugin: Octree Scene Manager
I/OGRE    ( 2189): Plugin successfully installed
I/OGRE    ( 2189): Installing plugin: ParticleFX
I/OGRE    ( 2189): Particle Emitter Type 'Point' registered
I/OGRE    ( 2189): Particle Emitter Type 'Box' registered
I/OGRE    ( 2189): Particle Emitter Type 'Ellipsoid' registered
I/OGRE    ( 2189): Particle Emitter Type 'Cylinder' registered
I/OGRE    ( 2189): Particle Emitter Type 'Ring' registered
I/OGRE    ( 2189): Particle Emitter Type 'HollowEllipsoid' registered
I/OGRE    ( 2189): Particle Affector Type 'LinearForce' registered
I/OGRE    ( 2189): Particle Affector Type 'ColourFader' registered
I/OGRE    ( 2189): Particle Affector Type 'ColourFader2' registered
I/OGRE    ( 2189): Particle Affector Type 'ColourImage' registered
I/OGRE    ( 2189): Particle Affector Type 'ColourInterpolator' registered
I/OGRE    ( 2189): Particle Affector Type 'Scaler' registered
I/OGRE    ( 2189): Particle Affector Type 'Rotator' registered
I/OGRE    ( 2189): Particle Affector Type 'DirectionRandomiser' registered
I/OGRE    ( 2189): Particle Affector Type 'DeflectorPlane' registered
I/OGRE    ( 2189): Plugin successfully installed
I/OGRE    ( 2189): OverlayElementFactory for type Panel registered.
I/OGRE    ( 2189): OverlayElementFactory for type BorderPanel registered.
I/OGRE    ( 2189): OverlayElementFactory for type TextArea registered.
I/OGRE    ( 2189): Registering ResourceManager for type Font
I/OGRE    ( 2189): CPU Identifier & Features
I/OGRE    ( 2189): -------------------------
I/OGRE    ( 2189):  *   CPU ID: ARMv7
I/OGRE    ( 2189):  *      VFP: yes
I/OGRE    ( 2189):  *     NEON: yes
I/OGRE    ( 2189): -------------------------
I/OGRE    ( 2189): Registering ResourceManager for type Texture
I/OGRE    ( 2189): ArchiveFactory for archive type APKFileSystem registered.
I/OGRE    ( 2189): ArchiveFactory for archive type APKZip registered.
I/OGRE    ( 2189): GLES2RenderSystem::_createRenderWindow "OgreWindow", 0x0 windowed  miscParams: externalWindowHandle=1976953336 
D/mali_winsys( 2189): new_window_surface returns 0x3000
I/OGRE    ( 2189): GL_VERSION = OpenGL ES 3.0
I/OGRE    ( 2189): GL_VENDOR = ARM
I/OGRE    ( 2189): GL_RENDERER = Mali-T604
I/OGRE    ( 2189): GL_EXTENSIONS = GL_EXT_debug_marker GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_EXT_read_format_bgra GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_required_internalformat GL_OES_vertex_array_object GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_type_2_10_10_10_REV GL_OES_fbo_render_mipmap GL_OES_element_index_uint GL_EXT_shadow_samplers GL_KHR_debug GL_EXT_occlusion_query_boolean GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_OES_texture_3D GL_EXT_texture_storage GL_EXT_multisampled_render_to_texture GL_OES_surfaceless_context GL_ARM_mali_program_binary 
I/OGRE    ( 2189): EXT:GL_EXT_debug_marker
I/OGRE    ( 2189): EXT:GL_ARM_rgba8
I/OGRE    ( 2189): EXT:GL_ARM_mali_shader_binary
I/OGRE    ( 2189): EXT:GL_OES_depth24
I/OGRE    ( 2189): EXT:GL_OES_depth_texture
I/OGRE    ( 2189): EXT:GL_OES_depth_texture_cube_map
I/OGRE    ( 2189): EXT:GL_OES_packed_depth_stencil
I/OGRE    ( 2189): EXT:GL_OES_rgb8_rgba8
I/OGRE    ( 2189): EXT:GL_EXT_read_format_bgra
I/OGRE    ( 2189): EXT:GL_OES_compressed_paletted_texture
I/OGRE    ( 2189): EXT:GL_OES_compressed_ETC1_RGB8_texture
I/OGRE    ( 2189): EXT:GL_OES_standard_derivatives
I/OGRE    ( 2189): EXT:GL_OES_EGL_image
I/OGRE    ( 2189): EXT:GL_OES_EGL_image_external
I/OGRE    ( 2189): EXT:GL_OES_EGL_sync
I/OGRE    ( 2189): EXT:GL_OES_texture_npot
I/OGRE    ( 2189): EXT:GL_OES_vertex_half_float
I/OGRE    ( 2189): EXT:GL_OES_required_internalformat
I/OGRE    ( 2189): EXT:GL_OES_vertex_array_object
I/OGRE    ( 2189): EXT:GL_OES_mapbuffer
I/OGRE    ( 2189): EXT:GL_EXT_texture_format_BGRA8888
I/OGRE    ( 2189): EXT:GL_EXT_texture_rg
I/OGRE    ( 2189): EXT:GL_EXT_texture_type_2_10_10_10_REV
I/OGRE    ( 2189): EXT:GL_OES_fbo_render_mipmap
I/OGRE    ( 2189): EXT:GL_OES_element_index_uint
I/OGRE    ( 2189): EXT:GL_EXT_shadow_samplers
I/OGRE    ( 2189): EXT:GL_KHR_debug
I/OGRE    ( 2189): EXT:GL_EXT_occlusion_query_boolean
I/OGRE    ( 2189): EXT:GL_EXT_blend_minmax
I/OGRE    ( 2189): EXT:GL_EXT_discard_framebuffer
I/OGRE    ( 2189): EXT:GL_OES_get_program_binary
I/OGRE    ( 2189): EXT:GL_OES_texture_3D
I/OGRE    ( 2189): EXT:GL_EXT_texture_storage
I/OGRE    ( 2189): EXT:GL_EXT_multisampled_render_to_texture
I/OGRE    ( 2189): EXT:GL_OES_surfaceless_context
I/OGRE    ( 2189): EXT:GL_ARM_mali_program_binary
I/OGRE    ( 2189): **************************************
I/OGRE    ( 2189): *** OpenGL ES 2.x Renderer Started ***
I/OGRE    ( 2189): **************************************
I/OGRE    ( 2189): GLSL ES support detected
I/OGRE    ( 2189): Registering ResourceManager for type GpuProgram
I/OGRE    ( 2189): GL ES 2: Using FBOs for rendering to textures
I/OGRE    ( 2189): FBO PF_R5G6B5 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_B5G6R5 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_A4R4G4B4 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_A1R5G5B5 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_R8G8B8 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_B8G8R8 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_A8R8G8B8 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_A8B8G8R8 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_B8G8R8A8 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_X8R8G8B8 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_SHORT_RGBA depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_R8 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): FBO PF_RG8 depth/stencil support: D0S0 D0S8 D16S0 D24S0 Packed-D24S8 
I/OGRE    ( 2189): [GLES2] : Valid FBO targets PF_R5G6B5 PF_B5G6R5 PF_A4R4G4B4 PF_A1R5G5B5 PF_R8G8B8 PF_B8G8R8 PF_A8R8G8B8 PF_A8B8G8R8 PF_B8G8R8A8 PF_X8R8G8B8 PF_SHORT_RGBA PF_R8 PF_RG8 
I/OGRE    ( 2189): RenderSystem capabilities
I/OGRE    ( 2189): -------------------------
I/OGRE    ( 2189): RenderSystem Name: OpenGL ES 2.x Rendering Subsystem
I/OGRE    ( 2189): GPU Vendor: arm
I/OGRE    ( 2189): Device Name: Mali-T604
I/OGRE    ( 2189): Driver Version: 0.0.0.0
I/OGRE    ( 2189):  * Fixed function pipeline: no
I/OGRE    ( 2189):  * Hardware generation of mipmaps: yes
I/OGRE    ( 2189):  * Texture blending: yes
I/OGRE    ( 2189):  * Anisotropic texture filtering: no
I/OGRE    ( 2189):  * Dot product texture operation: yes
I/OGRE    ( 2189):  * Cube mapping: yes
I/OGRE    ( 2189):  * Hardware stencil buffer: no
I/OGRE    ( 2189):  * Hardware vertex / index buffers: yes
I/OGRE    ( 2189):  * 32-bit index buffers: yes
I/OGRE    ( 2189):  * Vertex programs: yes
I/OGRE    ( 2189):  * Number of floating-point constants for vertex programs: 1024
I/OGRE    ( 2189):  * Number of integer constants for vertex programs: 1024
I/OGRE    ( 2189):  * Number of boolean constants for vertex programs: 1024
I/OGRE    ( 2189):  * Fragment programs: yes
I/OGRE    ( 2189):  * Number of floating-point constants for fragment programs: 1024
I/OGRE    ( 2189):  * Number of integer constants for fragment programs: 1024
I/OGRE    ( 2189):  * Number of boolean constants for fragment programs: 1024
I/OGRE    ( 2189):  * Geometry programs: no
I/OGRE    ( 2189):  * Number of floating-point constants for geometry programs: 0
I/OGRE    ( 2189):  * Number of integer constants for geometry programs: 0
I/OGRE    ( 2189):  * Number of boolean constants for geometry programs: 0
I/OGRE    ( 2189):  * Tessellation Hull programs: no
I/OGRE    ( 2189):  * Number of floating-point constants for tessellation hull programs: 0
I/OGRE    ( 2189):  * Number of integer constants for tessellation hull programs: 0
I/OGRE    ( 2189):  * Number of boolean constants for tessellation hull programs: 0
I/OGRE    ( 2189):  * Tessellation Domain programs: no
I/OGRE    ( 2189):  * Number of floating-point constants for tessellation domain programs: 0
I/OGRE    ( 2189):  * Number of integer constants for tessellation domain programs: 0
I/OGRE    ( 2189):  * Number of boolean constants for tessellation domain programs: 0
I/OGRE    ( 2189):  * Compute programs: no
I/OGRE    ( 2189):  * Number of floating-point constants for compute programs: 0
I/OGRE    ( 2189):  * Number of integer constants for compute programs: 0
I/OGRE    ( 2189):  * Number of boolean constants for compute programs: 0
I/OGRE    ( 2189):  * Supported Shader Profiles: glsles
I/OGRE    ( 2189):  * Texture Compression: yes
I/OGRE    ( 2189):    - DXT: no
I/OGRE    ( 2189):    - VTC: no
I/OGRE    ( 2189):    - PVRTC: no
I/OGRE    ( 2189):    - ATC: no
I/OGRE    ( 2189):    - ETC1: yes
I/OGRE    ( 2189):    - ETC2: no
I/OGRE    ( 2189):    - BC4/BC5: no
I/OGRE    ( 2189):    - BC6H/BC7: no
I/OGRE    ( 2189):  * Scissor Rectangle: yes
I/OGRE    ( 2189):  * Hardware Occlusion Query: yes
I/OGRE    ( 2189):  * User clip planes: no
I/OGRE    ( 2189):  * VET_UBYTE4 vertex element type: yes
I/OGRE    ( 2189):  * Infinite far plane projection: yes
I/OGRE    ( 2189):  * Hardware render-to-texture: yes
I/OGRE    ( 2189):  * Floating point textures: no
I/OGRE    ( 2189):  * Non-power-of-two textures: no (limited)
I/OGRE    ( 2189):  * 1d textures: yes
I/OGRE    ( 2189):  * Volume textures: no
I/OGRE    ( 2189):  * Multiple Render Targets: 1
I/OGRE    ( 2189):    - With different bit depths: no
I/OGRE    ( 2189):  * Point Sprites: yes
I/OGRE    ( 2189):  * Extended point parameters: yes
I/OGRE    ( 2189):  * Max Point Size: 0
I/OGRE    ( 2189):  * Vertex texture fetch: no
I/OGRE    ( 2189):  * Number of world matrices: 0
I/OGRE    ( 2189):  * Number of texture units: 16
I/OGRE    ( 2189):  * Stencil buffer depth: 0
I/OGRE    ( 2189):  * Number of vertex blend matrices: 0
I/OGRE    ( 2189):  * Render to Vertex Buffer : no
I/OGRE    ( 2189):  * Hardware Atomic Counters: no
I/OGRE    ( 2189):  * GL 1.5 without VBO workaround: no
I/OGRE    ( 2189):  * Frame Buffer objects: yes
I/OGRE    ( 2189):  * Frame Buffer objects (ARB extension): no
I/OGRE    ( 2189):  * Frame Buffer objects (ATI extension): no
I/OGRE    ( 2189):  * PBuffer support: no
I/OGRE    ( 2189):  * GL 1.5 without HW-occlusion workaround: no
I/OGRE    ( 2189):  * Vertex Array Objects: no
I/OGRE    ( 2189):  * Separate shader objects: no
I/OGRE    ( 2189): DefaultWorkQueue('Root') initialising on thread main.
I/OGRE    ( 2189): Particle Renderer Type 'billboard' registered
I/OGRE    ( 2189): SceneManagerFactory for type 'OctreeSceneManager' registered.
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Android build quick start guide

Post by c6burns » Thu Sep 11, 2014 12:49 am

All the OgreJNI app does is render a coloured viewport background. So it sounds like you have built it successfully.
0 x

planrich
Gnoblar
Posts: 2
Joined: Tue Sep 09, 2014 8:21 am

Re: Android build quick start guide

Post by planrich » Thu Sep 11, 2014 5:09 pm

Hm... this is embarrasing ^^. I finally got it up and running (both the OgreSampleNDK app and my own).
One thing really bugged me: On the desktop (e.g. linux) the default vertex shader + fragment shader are automatically
setup for you. This is not the case in Android (EGL).
I did not copy those lines from the OgreSampleNDK because I thought: "Aaaaa, I don't need them, at least the desktop does not need them..."

The bad thing is that even though the scene is setup correctly, it won't render anything. at all...

Code: Select all

#ifdef INCLUDE_RTSHADER_SYSTEM
            // Initialize shader generator.
            // Must be before resource loading in order to allow parsing extended material attributes.
            bool success = initialiseRTShaderSystem(mSceneMgr);
            if (!success)
            {
                OGRE_EXCEPT(Ogre::Exception::ERR_FILE_NOT_FOUND,
                            "Shader Generator Initialization failed - Core shader libs path not found",
                            "SampleBrowser::createDummyScene");
            }
            if(mRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_FIXED_FUNCTION) == false)
            {
                // creates shaders for base material BaseWhite using the RTSS
                Ogre::MaterialPtr baseWhite = Ogre::MaterialManager::getSingleton().getByName("BaseWhite", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
                baseWhite->setLightingEnabled(false);
                mShaderGenerator->createShaderBasedTechnique(
                    "BaseWhite",
                    Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
                    Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
                mShaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
                                                   "BaseWhite");
                if(baseWhite->getNumTechniques() > 1)
                {
                    baseWhite->getTechnique(0)->getPass(0)->setVertexProgram(
                        baseWhite->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
                    baseWhite->getTechnique(0)->getPass(0)->setFragmentProgram(
                        baseWhite->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
                }

                // creates shaders for base material BaseWhiteNoLighting using the RTSS
                mShaderGenerator->createShaderBasedTechnique("BaseWhiteNoLighting", Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
                    Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
                mShaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME, "BaseWhiteNoLighting");
                Ogre::MaterialPtr baseWhiteNoLighting = Ogre::MaterialManager::getSingleton()
                    .getByName("BaseWhiteNoLighting", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
                if(baseWhite->getNumTechniques() > 1)
                {
                    baseWhiteNoLighting->getTechnique(0)->getPass(0)->setVertexProgram(
                        baseWhiteNoLighting->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
                    baseWhiteNoLighting->getTechnique(0)->getPass(0)->setFragmentProgram(
                        baseWhiteNoLighting->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
                }
            }
#endif // INCLUDE_RTSHADER_SYSTEM
0 x

longer
Gnoblar
Posts: 18
Joined: Tue Aug 19, 2014 10:46 am

Re: Android build quick start guide

Post by longer » Tue Jan 27, 2015 6:09 pm

My demo android app,at chinese network disk,I don't know if it is can work.code for my best friend birthday.
http://yun.baidu.com/share/link?shareid ... 3124767259

So the complex way it's the easy way,I give up for the cmake actually.
I compile the Ogre like this:
Checkout the ogre 1.9 official.And Open the Notepad++ and eclipse.Write some android .mk file.
Note:Some code need some change for android.Such as the ogre dependent lib.

A example.
environment variable DISH_HOME to dish directory.
My directory
dish/src/Ogre ok the ogre source code here.
dish/build/Ogre/platform/Android different cmake or configure script generate head file.
dish/build/Ogre/platform/Windows
dish/build/Ogre/proj.android/
dish/build/Ogre/proj.android/jni/
dish/build/Ogre/proj.android/jni/OgreMain.mk ok the mk file at here.
dish/build/Ogre/proj.windows/
dish/build/Ogre/resource resource for debug.

mk like this
OgreMain.mk:

Code: Select all

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)  

LOCAL_MODULE := OgreMain_static

LOCAL_MODULE_FILENAME := libOgreMain_static

LOCAL_C_INCLUDES += $(DISH_HOME)/src/Ogre/OgreMain/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../platform/Android
LOCAL_C_INCLUDES += $(DISH_HOME)/sdk/FreeImage/include/FreeImage
LOCAL_C_INCLUDES += $(DISH_HOME)/sdk/freetype/include/freetype
LOCAL_C_INCLUDES += $(DISH_HOME)/sdk/freetype/include/freetype/platform/Android
LOCAL_C_INCLUDES += $(DISH_HOME)/sdk/zlib/include
LOCAL_C_INCLUDES += $(DISH_HOME)/sdk/zlib/include/zlib
LOCAL_C_INCLUDES += $(DISH_HOME)/sdk/zziplib/include

LOCAL_C_INCLUDES += $(ANDROID_NDK)/sources/cpufeatures

LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES=1 -D__ANDROID__ 
LOCAL_CFLAGS += -DSTDC_HEADERS -DNO_JASPER -DNO_LCMS
LOCAL_CXXFLAGS += -fexceptions -frtti -std=c++11 -x c++ -D__ANDROID__
LOCAL_CPPFLAGS += -fexceptions
LOCAL_CPPFLAGS += -Wno-error=format-security
#  
# config self source file path ,suffix.
MY_FILES_PATH := $(LOCAL_PATH)/../../../../src/Ogre/OgreMain

# config filter out file and path.
MY_FILTER_OUT += ../../../../src/Ogre/OgreMain/src/Android/JNI%
MY_FILTER_OUT += ../../../../src/Ogre/OgreMain/src/FlashCC%
MY_FILTER_OUT += ../../../../src/Ogre/OgreMain/src/GLX%
MY_FILTER_OUT += ../../../../src/Ogre/OgreMain/src/gtk%
MY_FILTER_OUT += ../../../../src/Ogre/OgreMain/src/iOS%
MY_FILTER_OUT += ../../../../src/Ogre/OgreMain/src/NaCl%
MY_FILTER_OUT += ../../../../src/Ogre/OgreMain/src/OSX%
MY_FILTER_OUT += ../../../../src/Ogre/OgreMain/src/WIN32%
MY_FILTER_OUT += ../../../../src/Ogre/OgreMain/src/Emscripten%

MY_FILTER_OUT += ../../../../src/Ogre/OgreMain/src/Threading/OgreDefaultWorkQueueTBB.cpp

MY_FILES_SUFFIX := %.cpp %.c %.cc

# traverse all file function.
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))

# get all source file.
MY_ALL_FILES := $(foreach src_path,$(MY_FILES_PATH), $(call rwildcard,$(src_path),*.*) ) 
MY_ALL_FILES := $(MY_ALL_FILES:$(MY_CPP_PATH)/./%=$(MY_CPP_PATH)%)
MY_SRC_LIST  := $(filter $(MY_FILES_SUFFIX),$(MY_ALL_FILES)) 
MY_SRC_LIST  := $(MY_SRC_LIST:$(LOCAL_PATH)/%=%)
MY_SRC_LIST  := $(filter-out $(MY_FILTER_OUT),$(MY_SRC_LIST)) 

# traverse all include path.
MY_ALL_DIRS := $(dir $(foreach src_path,$(MY_FILES_PATH), $(call rwildcard,$(src_path),*/) ) )
# remove duplicate
MY_ALL_DIRS := $(call sort,$(MY_ALL_DIRS))
 
# assign to NDK system.
LOCAL_SRC_FILES  := $(MY_SRC_LIST)
LOCAL_C_INCLUDES += $(MY_ALL_DIRS)

# $(info $(LOCAL_SRC_FILES))
# $(info $(LOCAL_C_INCLUDES))                   

include $(BUILD_STATIC_LIBRARY)

And use a script copy the lib to be a sdk.
dish/sdk/Ogre

cmake it's good to open source,but not easy to understand how to work magic about it.
I do this for all the ogre dependent lib,ogre and other lib like mygui,It's spend a lot of time but easy to understand than cmake.

You can checkout my lib cluster at here:
https://bitbucket.org/typedef-typename/dish
0 x

ZhenMan
Gnoblar
Posts: 11
Joined: Mon Jan 06, 2014 4:35 pm

Re: Android build quick start guide

Post by ZhenMan » Wed Apr 15, 2015 9:09 am

@espenator


I'm trying to get started on Android development with Ogre, and I've been working off the wiki quick start guide, as well as a couple of other writeups to get the Ogre source compiled, but I'm having problems getting the RenderSystem_GLES2 project to compile. I've tried with both the stable Ogre 1.9 and the latest unstable 1.10, but get the same result. I'm using the latest precompiled Android Deps as described in the first post of this thread, and I've tried with both Android API 10 and the latest 19, but still no dice. The only way I can get the project to compile is the set the OGRE CMake variable OGRE_CONFIG_ENABLE_GLES3_SUPPORT, but I understand this is still unsupported by most Android devices, and it only results in a black screen and hang/crash of the SampleBrowserNDK APK app when I install the debug app on my Galaxy S4. The SampleBrowser from the Android Play Store works fine, btw.

GLES2_OPTIMIZER true/false in the Cmake GUI makes no difference, the compilation of the RenderSystem_GLES2 project always throws the following error (Win7 x86):
hello, maybe I found the solution:
when I modify the file,and compile successful.

Code: Select all

H:\Ogre2.0\RenderSystems\GLES2\include\GLES2\gles2w.h

// #include <KHR/khrplatform.h>
// #include <GLES2/gl2platform.h>
// #include <GLES2/gl2ext.h>
#include "../KHR/khrplatform.h"
#include "gl2platform.h"
#include "gl2ext.h"
0 x

ogreogre
Halfling
Posts: 59
Joined: Mon Aug 13, 2007 8:30 pm

Re: Android build quick start guide

Post by ogreogre » Sat Jul 25, 2015 8:03 pm

I have just tried building the default branch on OSX Yosemite, with latest NDK (r10e)
Pasting & executing the cmake command in the wiki shows an error that says the toolchain cannot be uniquely determined for darwin-x64. I got over this by editing the android.toolchain.cmake file and changing "darwin-x86" to "darwin-x86_64".
Now the makefile is generated, but make immediately shows error:
dev/ogre/OgreMain/include/OgrePrerequisites.h:33:18: fatal error: string: No such file or directory
#include <string>

Has anybody encountered this before? Solutions? Thanks!

Harry
0 x

User avatar
diostratos
Gnoblar
Posts: 1
Joined: Thu Jun 30, 2016 9:32 pm
Location: Prague

Re: Android build quick start guide

Post by diostratos » Thu Jun 30, 2016 9:45 pm

Hi Everyone, I am new in here although I have been experimenting with Ogre for some years. It used to be dificult to build it on Windows and now it is easy. I have very little experience with linux and no time to change that. My problem is, that last three times I got sick and got some time to try to compile Ogre for Android under Windows, I run into so many problems I had no chace to solve them in antire week. I understand you guys do that on Linux systems and my suspition is, that someone tried it on Windows while ago and it worked once, but now it is lost in past and the tools and apis no longer fit together. Would you have something like Visual Studio project or zip with working toolchain and precompiled stuff and working version of STL that wouldn't give thousends of errors? It is realy frustrating to try again and again another Ogre Android guide and always run into problems so huge one does not have time to solve.
0 x

Seranth
Gnoblar
Posts: 14
Joined: Mon Jul 11, 2016 1:50 am

Re: Android build quick start guide

Post by Seranth » Mon Jul 11, 2016 1:55 am

I keep getting "cpu-features.h: No such file or directory" when building Ogre3D for Android.

I'm following the tutorial by the letter and I've tried versions 1.9, 1.10, 2.0, 2.1 of Ogre3D. I've also tried using both the packaged android.toolchain.cmake files and the Android SDK version. Also, I tried changing #include <cpu-features.h> to #include <machine/cpu-features.h> without any success.

What am I doing wrong??
0 x

bbm
Gnoblar
Posts: 2
Joined: Mon Jul 11, 2016 8:19 pm

Re: Android build quick start guide

Post by bbm » Mon Jul 11, 2016 9:10 pm

@Seranth, I had to disable all SIMD and etc..

add this to your cmake command.

Code: Select all

-DOGRE_SIMD_SSE2=OFF
-DOGRE_SIMD_NEON=OFF
and also this change was needed

Code: Select all

--- a/OgreMain/src/OgrePlatformInformation.cpp  
+++ b/OgreMain/src/OgrePlatformInformation.cpp  
@@ -37,7 +37,7 @@
 #elif (OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG) && OGRE_PLATFORM != OGRE_PLATFORM_NACL
 #include <signal.h>
 #include <setjmp.h>
-#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32
+#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32 && OGRE_PLATFORM != OGRE_PLATFORM_ANDROID
     #include <sys/sysctl.h>
 #endif
0 x

Seranth
Gnoblar
Posts: 14
Joined: Mon Jul 11, 2016 1:50 am

Re: Android build quick start guide

Post by Seranth » Wed Jul 13, 2016 12:38 am

bbm wrote:@Seranth, I had to disable all SIMD and etc..

add this to your cmake command.

Code: Select all

-DOGRE_SIMD_SSE2=OFF
-DOGRE_SIMD_NEON=OFF
and also this change was needed

Code: Select all

--- a/OgreMain/src/OgrePlatformInformation.cpp  
+++ b/OgreMain/src/OgrePlatformInformation.cpp  
@@ -37,7 +37,7 @@
 #elif (OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG) && OGRE_PLATFORM != OGRE_PLATFORM_NACL
 #include <signal.h>
 #include <setjmp.h>
-#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32
+#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32 && OGRE_PLATFORM != OGRE_PLATFORM_ANDROID
     #include <sys/sysctl.h>
 #endif
edited

@bbm

I tried your fix for 2.1 and it didn't work, wrote a long reply about almost kissing you but just almost since it didn't work completely...

Then I tried it with 2.0 after checking http://www.ogre3d.org/about/what-version-to-choose and realizing 2.1 is officially not amazing with phones yet.

IT WORKED!!! :mrgreen: :D :mrgreen: :D :mrgreen: :D

Had to comment out the following from Samples/Browser/CMakeLists.txt:

Code: Select all

    # ADD_LIBRARY(SampleBrowserDummy MODULE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
    # target_link_libraries(SampleBrowserDummy ${SAMPLE_LIBRARIES})
    # add_dependencies(SampleBrowserDummy ${OGRE_SAMPLES_LIST})
Will that bite me in the ass? Probably not, right?
0 x

Seranth
Gnoblar
Posts: 14
Joined: Mon Jul 11, 2016 1:50 am

Re: Android build quick start guide

Post by Seranth » Wed Jul 13, 2016 2:03 am

So everything went well, I built Ogre3D for android, yay!

However, I could not build the SampleBrowserNDK. Thought it might be because JNI samples are disabled, or because samples2 is disabled, so I enabled them in cmake and now I got this error.

libOgreJNIDummy.so
fatal error: -soname: must take a non-empty argument

Code: Select all

[ 80%] Linking CXX shared module lib/libOgreJNIDummy.so
/home/simon/Programs/Android-NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: fatal error: -soname: must take a non-empty argument
collect2: error: ld returned 1 exit status
CMakeFiles/OgreJNIDummy.dir/build.make:94: recipe for target 'lib/libOgreJNIDummy.so' failed
make[2]: *** [lib/libOgreJNIDummy.so] Error 1
CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/OgreJNIDummy.dir/all' failed
make[1]: *** [CMakeFiles/OgreJNIDummy.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
Thoughts?
0 x

User avatar
calmengineer
Gnoblar
Posts: 2
Joined: Mon Jul 18, 2016 8:56 am

Re: Android build quick start guide

Post by calmengineer » Mon Jul 18, 2016 9:51 am

@Seranth I also tried to compile ogre 2.0 for Android - the error with -soname can be fixed by placing:

Code: Select all

string(REPLACE "<CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME>" "" CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")
in .../Samples/Browser/CMakeLists.txt, before ADD_LIBRARY and create_android_proj(SampleBrowserDummy) (lines 220+). Found an answer here: https://stackoverflow.com/questions/268 ... pty-argume

I've had many problems with building Ogre for Android and this includes version 2.0 and 1.9 (most of them where described in this thread, but those posts are from 2014 ...). I'm using Arch Linux with android-ndk-r11c.
I finally managed to build SampleBrowser app and install it on the phone (Android 4.4.2) but all I get is a pink/magenta screen and constantly repeating message on logcat: I/Adreno-ES20(22012): <validate_vertex_attrib_state:53>: validate_vertex_attrib_state: No vertex attrib is enabled in a draw call! Here is the link for full logcat: http://pastebin.com/azT5cVBQ.

Also, when I tried to compile version 1.9 (pulled from repository, v1-9 branch) I've had error with "Could not uniquely determine machine name for compiler from" so I just copied the android toolchain from v2-0 branch and the project configured properly - however during compilation this occurs:
***/ogre3d-1.9-repo/OgreMain/src/OgrePlatformInformation.cpp:44:34: fatal error: cpu-features.h: No such file or directory
#include <cpu-features.h>

Is there is some fix for this? The include path for proper cpu-features.h is not passed during compilation. Something like this should be used in compilation: -I$ANDROID_NDK/sources/cpufeatures.
I must be doing something wrong... I mean, the branch v1-9 is stable right?
0 x

Seranth
Gnoblar
Posts: 14
Joined: Mon Jul 11, 2016 1:50 am

Re: Android build quick start guide

Post by Seranth » Tue Jul 19, 2016 9:44 pm

I'm building version 2.0 for Android and I've made some progress. Still not working but at least I've found workarounds for a bunch of problems. Now however I'm a bit stuck. I'll keep digging myself but hopefully someone here can offer some input.

I have the latest Android SDK and NDK installed. I have those symlinked to /opt/android-sdk and /opt/android-ndk respectively because for some reason the JNI samples are statically linked to that location for the SDK and NDK.

In CMake I'm turning off OGRE_SIMD_SSE2 and OGRE_SIMD_NEON, and enabling the JNI samples. I am building for Android version 14 and I have installed the Ogre dependencies to the toolchain so I don't have to specify the dependencies folder each time (if you wonder how to do it, just run "make install" after making the dependencies according to this tutorial: http://www.ogre3d.org/tikiwiki/CMake+Qu ... on=Android)

I am using the NDK version of make and have tested my Ubuntu 64bit distro version as well.

To fix the sysctl error I added the following to OgreMain/src/OgrePlatformInformation.cpp (thanks @bbm!):

Code: Select all

#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32 [color=#008000]&& OGRE_PLATFORM != OGRE_PLATFORM_ANDROID[/color]
     #include <sys/sysctl.h>
 #endif
I have modified CMake/toolchain/AndroidJNI.cmake by adding this line to fix -soname error:

Code: Select all

    set(JNI_PATH "${NDKOUT}/jni")
++  string(REPLACE "<CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME>" "" CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")
    create_android_proj(OgreJNIDummy)
This doesn't actually fix the -soname error though, all it does is replace it with a different error (since all this really does is suppress the error, it doesn't actually fix the error). The error that replaces -soname error is the following:

Code: Select all

Scanning dependencies of target OgreJNIDummy
[ 80%] Building CXX object CMakeFiles/OgreJNIDummy.dir/dummyJNI.cpp.o
[ 80%] Linking CXX shared module lib/libOgreJNIDummy.so
Updated project.properties
Updated local.properties
Updated file /home/simon/Projects/OGRE/ogre/build/OgreJNI/proguard-project.txt
Android NDK: ERROR:jni/Android.mk:Plugin_OctreeSceneManagerStatic: LOCAL_SRC_FILES points to a missing file    
Android NDK: Check that /home/simon/Projects/OGRE/ogre/build/lib/libPlugin_OctreeSceneManagerStatic.a exists  or that its path is correct   
/media/simon/739d2942-ff3d-41d8-bf0e-2de431bbd84a/home/simon/Android-SDK/ndk-bundle/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting    .  Stop.
make[2]: *** [lib/libOgreJNIDummy.so] Error 2
make[2]: *** Deleting file `lib/libOgreJNIDummy.so'
make[1]: *** [CMakeFiles/OgreJNIDummy.dir/all] Error 2
make: *** [all] Error 2
This part basically says that what it's not finding is the libPlugin_OctreeSceneManagerStatic.a file, which indeed does not exist anywhere. I tried manually altering the generated makefiles in the hopes OctreeSceneManager simply isn't needed but alas it seems to be a core part of Ogre (as far as I can tell anyway, which begs the question why it's called a plugin...).

As far as I can tell, when building for Android the OctreeSceneManager is never made. I've scoured CMake GUI and can't find any mentions of *Octree*. I can build "normal" Ogre3D without any issues. If you ask me the problem is that someone has forgotten to add Octree as a part of what's made when building for Android. Or perhaps Octree is not yet available to Android, which would explain why it can't be built for Android but begs the question why someone used it in the JNI samples.

Thoughts on how to fix this error?
0 x

User avatar
calmengineer
Gnoblar
Posts: 2
Joined: Mon Jul 18, 2016 8:56 am

Re: Android build quick start guide

Post by calmengineer » Wed Jul 20, 2016 10:59 am

Seranth wrote:This part basically says that what it's not finding is the libPlugin_OctreeSceneManagerStatic.a file, which indeed does not exist anywhere. I tried manually altering the generated makefiles in the hopes OctreeSceneManager simply isn't needed but alas it seems to be a core part of Ogre (as far as I can tell anyway, which begs the question why it's called a plugin...).

As far as I can tell, when building for Android the OctreeSceneManager is never made. I've scoured CMake GUI and can't find any mentions of *Octree*. I can build "normal" Ogre3D without any issues. If you ask me the problem is that someone has forgotten to add Octree as a part of what's made when building for Android. Or perhaps Octree is not yet available to Android, which would explain why it can't be built for Android but begs the question why someone used it in the JNI samples.
Plugins like OctreeSceneManager, OctreeZone, PCZSceneManager are not build for 2.0/2.1 version - it seems that not all cmake files and configs were updated.
I will try to show here all the steps that I took to finally build Ogre 2.0 (v2-0 branch) for Android along with SampleBrowser/JNI applications. Let me just mention that both application do not work in the end (they run on the device but show only blank screen).
Image

Steps for buildiding Ogre3D 2.0 for Android (API 10) - using Arch Linux 64bit, Android NDK R11C, cmake 3.5.2.

FIRST STEP:

Build OgreDependencies repository for Android (latest, default branch for mercurial repo).

Code: Select all

cmake -DCMAKE_INSTALL_PREFIX=/home/user/Downloads/Repositories.Develop/OgreDependencies/build-android-release -DCMAKE_BUILD_TYPE=Release -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="../cmake/android.toolchain.cmake" -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=10 -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 ..
OgreDependencies will also be installed in the same build folder, instead of default '/opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/user' folder. (There is no make uninstall option so it is easier to mantain this way)

SECOND STEP:

Install OgreDependencies into the current build folder.
make install (or sudo make install, but sudo should not be necessary)

THIRD STEP:

Configure Ogre 2.0 build for Android (using build-android-release as build directory):

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/user/Downloads/Repositories.Develop/ogre3d-2.0-repo/build-android-release -DCMAKE_TOOLCHAIN_FILE="../CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR=/home/user/Downloads/Repositories.Develop/OgreDependencies/build-android-release -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=10 -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 -DANDROID_GLES_ONLY=NO -DOGRE_BUILD_RENDERSYSTEM_GLES2=YES -DOGRE_SIMD_NEON=NO -DOGRE_SIMD_SSE2=NO -DANDROID_TOOLCHAIN_MACHINE_NAME=arm-linux-androideabi ..
This should successfully configure and find all dependencies as well:

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
+ OpenGL ES 1.x
+ OpenGL ES 2.x
+ OpenGL ES 3.x
+ OIS

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

Building components:
  + Paging
  + MeshLodGenerator
  + Terrain
  + RTShader System
  + RTShader System Core Shaders
  + RTShader System Extensions Shaders
  + Volume
  + Overlay
Building plugins:
  + Particle FX
Building rendersystems:
  + OpenGL ES 2.x
Building executables:
  + Samples
Building core features:
  + Mesh Lod
  + DDS image codec
  + PVRTC image codec
  + ETC image codec
  + FreeImage codec
  + ZIP archives

Build type:                      static
Threading support:               none
Use double precision:            disabled
Assert mode:                     standard
Allocator type:                  nedmalloc (pooling)
STL containers use allocator:    enabled
Strings use allocator:           disabled
Memory tracker (debug):          disabled
Memory tracker (release):        disabled
Use 1.x legacy animations:       enabled
Use Boost:                       disabled
Use SIMD (SSE2):                 disabled
Use SIMD (NEON):                 disabled
FOURTH STEP:
First run: make -j2 - build Ogre 2.0

FIRST ERROR:

Code: Select all

ogre3d-2.0-repo/OgreMain/src/OgrePlatformInformation.cpp:41:28: fatal error: sys/sysctl.h: No such file or directory
     #include <sys/sysctl.h>
                            ^
compilation terminated.
FIX (thanks @bbm / @Seranth):

Code: Select all

diff -r 8323e2268f11 OgreMain/src/OgrePlatformInformation.cpp
--- a/OgreMain/src/OgrePlatformInformation.cpp	Wed Jun 22 09:07:58 2016 +0200
+++ b/OgreMain/src/OgrePlatformInformation.cpp	Wed Jul 20 09:31:30 2016 +0200
@@ -37,7 +37,7 @@
 #elif (OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG) && OGRE_PLATFORM != OGRE_PLATFORM_NACL
 #include <signal.h>
 #include <setjmp.h>
-#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32
+#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32 && OGRE_PLATFORM != OGRE_PLATFORM_ANDROID
     #include <sys/sysctl.h>
 #endif
Second try:
make -j2

SECOND ERROR:

Code: Select all

[100%] Linking CXX shared module ../../lib/libSampleBrowserDummy.so
/opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: fatal error: -soname: must take a non-empty argument
collect2: error: ld returned 1 exit status
make[2]: *** [Samples/Browser/CMakeFiles/SampleBrowserDummy.dir/build.make:95: lib/libSampleBrowserDummy.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:3558: Samples/Browser/CMakeFiles/SampleBrowserDummy.dir/all] Error 2
make: *** [Makefile:150: all] Error 2
FIX:

Code: Select all

diff -r 8323e2268f11 Samples/Browser/CMakeLists.txt
--- a/Samples/Browser/CMakeLists.txt	Wed Jun 22 09:07:58 2016 +0200
+++ b/Samples/Browser/CMakeLists.txt	Wed Jul 20 09:43:53 2016 +0200
@@ -224,6 +224,9 @@
 	file(COPY "${CMAKE_SOURCE_DIR}/SDK/Android/drawable-xhdpi" DESTINATION "${NDKOUT}/res")
 
     file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "int x = 0;")
+    
+    string(REPLACE "<CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME>" "" CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")
+    
     ADD_LIBRARY(SampleBrowserDummy MODULE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
     target_link_libraries(SampleBrowserDummy ${SAMPLE_LIBRARIES})
     add_dependencies(SampleBrowserDummy ${OGRE_SAMPLES_LIST})
Third try:
make -j2

THIRD ERROR:

Code: Select all

Updated project.properties
Updated local.properties
Updated file /home/vigilant/Downloads/Repositories.Develop/ogre3d-2.0-repo/build-android-release/SampleBrowserNDK/proguard-project.txt
Android NDK: ERROR:jni/Android.mk:Sample_ShaderSystem: LOCAL_SRC_FILES points to a missing file    
Android NDK: Check that /home/vigilant/Downloads/Repositories.Develop/ogre3d-2.0-repo/build-android-release/lib/libSample_ShaderSystem.a exists  or that its path is correct   
/home/.opt/android-ndk/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting    .  Stop.
make[2]: *** [Samples/Browser/CMakeFiles/SampleBrowserDummy.dir/build.make:97: lib/libSampleBrowserDummy.so] Error 2
make[2]: *** Deleting file 'lib/libSampleBrowserDummy.so'
make[1]: *** [CMakeFiles/Makefile2:3558: Samples/Browser/CMakeFiles/SampleBrowserDummy.dir/all] Error 2
make: *** [Makefile:150: all] Error 2
FIX: (Remove Sample_Terrain and Sample_ShaderSystem - they're not being built anyway)

Code: Select all

--- a/Samples/Browser/CMakeLists.txt	Wed Jun 22 09:07:58 2016 +0200
+++ b/Samples/Browser/CMakeLists.txt	Wed Jul 20 09:57:40 2016 +0200
@@ -197,7 +197,7 @@
     SET(HEADERS "")
     SET(SAMPLE_LDLIBS "")
 
-    add_static_libs("${OGRE_BINARY_DIR}/lib" "Sample_Water" "Sample_Ocean" "Sample_NewInstancing" "Sample_ShaderSystem" "Sample_EndlessWorld" "Sample_VolumeCSG" "Sample_VolumeTerrain" "Sample_Terrain")
+    add_static_libs("${OGRE_BINARY_DIR}/lib" "Sample_Water" "Sample_Ocean" "Sample_NewInstancing" "Sample_EndlessWorld" "Sample_VolumeCSG" "Sample_VolumeTerrain")
     if(NOT ANDROID_GLES_ONLY)
 		add_static_libs("${OGRE_BINARY_DIR}/lib" "Sample_FacialAnimation" "Sample_Fresnel" "Sample_Grass" "Sample_ParticleFX" "Sample_MeshLod" "Sample_SkyBox" "Sample_SkyPlane" "Sample_SkyDome" "Sample_Smoke")
 		add_static_libs("${OGRE_BINARY_DIR}/lib" "Sample_CameraTrack" "Sample_CelShading" "Sample_Character" "Sample_Compositor" "Sample_Lighting" "Sample_BezierPatch" "Sample_CubeMapping" "Sample_DynTex")
Fourth try:
make -j2

FOURTH ERROR:
While reconfiguring CMake project (because CMakeLists.txt changed):

Code: Select all

The dependency target "Plugin_OctreeSceneManager" of target
  "SampleBrowserDummy" does not exist.
Call Stack (most recent call first):
  Samples/Browser/CMakeLists.txt:234 (create_android_proj)
This warning is for project developers.  Use -Wno-dev to suppress it.
While building SampleBrowserDummy:

Code: Select all

Android NDK: ERROR:jni/Android.mk:Plugin_OctreeSceneManagerStatic: LOCAL_SRC_FILES points to a missing file    
Android NDK: Check that /home/vigilant/Downloads/Repositories.Develop/ogre3d-2.0-repo/build-android-release/lib/libPlugin_OctreeSceneManagerStatic.a exists  or that its path is correct   
/home/.opt/android-ndk/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting    .  Stop.
make[2]: *** [Samples/Browser/CMakeFiles/SampleBrowserDummy.dir/build.make:97: lib/libSampleBrowserDummy.so] Error 2
make[2]: *** Deleting file 'lib/libSampleBrowserDummy.so'
make[1]: *** [CMakeFiles/Makefile2:3558: Samples/Browser/CMakeFiles/SampleBrowserDummy.dir/all] Error 2
make: *** [Makefile:150: all] Error 2
FIX (edit CMake/Utils/AndroidMacros.cmake):

Code: Select all

--- a/CMake/Utils/AndroidMacros.cmake	Wed Jun 22 09:07:58 2016 +0200
+++ b/CMake/Utils/AndroidMacros.cmake	Wed Jul 20 10:06:17 2016 +0200
@@ -47,7 +47,7 @@
 	    SET(DEPENDENCIES OgreMain RenderSystem_GLES)		
 	endif()
 	
-	SET(DEPENDENCIES ${DEPENDENCIES} OgreTerrain OgreRTShaderSystem OgreMeshLodGenerator OgreOverlay OgrePaging OgreVolume Plugin_ParticleFX Plugin_OctreeSceneManager)
+	SET(DEPENDENCIES ${DEPENDENCIES} OgreTerrain OgreRTShaderSystem OgreMeshLodGenerator OgreOverlay OgrePaging OgreVolume Plugin_ParticleFX)
 	add_dependencies(${ANDROID_PROJECT_TARGET} ${DEPENDENCIES})
 	set(DEPEND_STATIC_LIBS "")	
 	foreach(DEPENDENCY ${DEPENDENCIES})
Fifth try:
make -j2
SUCCESS!!!
-rw-r--r-- 1 user users 54M 07-20 10:07 SampleBrowserNDK/bin/NativeActivity-debug.apk

Successfully uploaded it to the device with adb install! But as shown before, the program (SampleBrowser) just displays magenta screen and floods logcat with I/Adreno-ES20(22012): <validate_vertex_attrib_state:53>: validate_vertex_attrib_state: No vertex attrib is enabled in a draw call!

Also forgot about -DOGRE_BUILD_ANDROID_JNI_SAMPLE=ON - @Seranth was also building it. There were many errors (all compilation errors). FIX:

Code: Select all

diff -r 8323e2268f11 OgreMain/src/Android/JNI/OgreActivityJNI.cpp
--- a/OgreMain/src/Android/JNI/OgreActivityJNI.cpp	Wed Jun 22 09:07:58 2016 +0200
+++ b/OgreMain/src/Android/JNI/OgreActivityJNI.cpp	Wed Jul 20 11:41:36 2016 +0200
@@ -197,17 +197,17 @@
 
         if(gCompositorManager == NULL)
         {
-            pSceneMgr = gRoot->createSceneManager(Ogre::ST_GENERIC);
+            pSceneMgr = gRoot->createSceneManager(Ogre::ST_GENERIC, 1, INSTANCING_CULLING_SINGLETHREAD);
             pCamera = pSceneMgr->createCamera("MyCam");
 
-            gCompositorManager = mRoot->getCompositorManager2();
+            gCompositorManager = gRoot->getCompositorManager2();
             if( !gCompositorManager->hasWorkspaceDefinition( "SampleBrowserWorkspace" ) )
             {
                 gCompositorManager->createBasicWorkspaceDef( "SampleBrowserWorkspace",
                                                               Ogre::ColourValue( 1.0f, 0.0f, 0.0f ),
                                                               Ogre::IdString() );
             }
-            compositorManager->addWorkspace( pSceneMgr, gRenderWnd, pCamera,
+            gCompositorManager->addWorkspace( pSceneMgr, gRenderWnd, pCamera,
                                             "SampleBrowserWorkspace", true );
         }
     } else {
@@ -239,3 +239,5 @@
         }catch(Ogre::RenderingAPIException& ex) {}
     }
 }
+
+} // namespace
Notice the closing bracket at the end of code. It then builds successfully. Also file CMake/toolchain/AndroidJNI.cmake needed fixing like @Seranth described. When running on device (app OgreJNI) it shows only red screen and nothing happens (no error messages flooding logcat however).

So here is the list of files that needed changing in order to build SamplesBrowser and Ogre for Android:
./CMake/Utils/AndroidMacros.cmake
./CMake/toolchain/AndroidJNI.cmake
./OgreMain/src/Android/JNI/OgreActivityJNI.cpp
./OgreMain/src/OgrePlatformInformation.cpp
./Samples/Browser/CMakeLists.txt

PS: The version 1.10 (branch default) builds for Android practically out of the box (needed small fix with -soname error in Samples/Browser/CMakeLists.txt but that's because I'm using latest version of CMake). SampleBrowser version 1.10 runs on device properly (tested many samples).
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 309
Joined: Sun Mar 30, 2014 2:51 pm
Contact:

Re: Android build quick start guide

Post by paroj » Thu Jul 21, 2016 10:49 am

you could also give my github fork a try. It includes Android in the CI which should ensure that the master branch always builds correctly:
https://travis-ci.org/OGRECave/ogre/jobs/146098249
0 x

rhnbmpl
Gnoblar
Posts: 1
Joined: Wed Aug 23, 2017 1:40 pm

Re: Android build quick start guide

Post by rhnbmpl » Wed Aug 23, 2017 1:48 pm

Hey guys, I am trying to install ogre for android development, and I have already built and installed ogredeps as per the steps mentioned on 14.04 Ubuntu. But on doing cmake on the Ogre 1.9 build directory i'm getting these errors:
Thanks.

Code: Select all

xeon65@xeon:~/ogre/build$ cmake -DCMAKE_TOOLCHAIN_FILE="../CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR="/home/xeon65/ogredeps/build" -DANDROID_ABI=armeabi-v7a  -DANDROID_NATIVE_API_LEVEL=15 -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 ..
CMake Error at CMakeLists.txt:20 (cmake_policy):
  Policy "CMP0042" is not known to this version of CMake.


-- Configuring OGRE 1.10.8
-- Check size of void*
-- Check size of void* - done
-- Performing Test OGRE_GCC_HAS_SSE
-- Performing Test OGRE_GCC_HAS_SSE - Failed
-- Search path: /home/xeon65/ogredeps/build;/home/xeon65/ogre/build/Dependencies;/home/xeon65/ogre/Dependencies;/home/xeon65/ogre/build/../Dependencies;/home/xeon65/ogre/../Dependencies
-- Found ZLIB: /home/xeon65/Android/Sdk/ndk-bundle/platforms/android-15/arch-arm/usr/lib/libz.so (found version "1.2.3") 
-- Looking for ZZip...
-- Found ZZip: /home/xeon65/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/user/lib/libzziplib.a
-- Looking for FreeImage...
-- Found FreeImage: /home/xeon65/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/user/lib/libFreeImage.a
-- Looking for FREETYPE...
-- CMAKE_PREFIX_PATH: /home/xeon65/ogredeps/build;/home/xeon65/ogre/build/Dependencies;/home/xeon65/ogre/Dependencies;/home/xeon65/ogre/build/../Dependencies;/home/xeon65/ogre/../Dependencies;/usr/local;/usr/lib/armv7-a-linux-gnu
-- CMAKE_PREFIX_PATH: /home/xeon65/ogredeps/build;/home/xeon65/ogre/build/Dependencies;/home/xeon65/ogre/Dependencies;/home/xeon65/ogre/build/../Dependencies;/home/xeon65/ogre/../Dependencies;/usr/local;/usr/lib/armv7-a-linux-gnu
-- Found FREETYPE: /home/xeon65/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/user/lib/libfreetype.a
-- Could NOT find OpenGL (missing:  OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR) 
-- Looking for POCO...
-- Could not locate POCO
-- Looking for TBB...
-- Could not locate TBB
-- Looking for GLSL_Optimizer...
-- GLSL_Optimizer_PREFIX_PATH changed.
-- Could not locate GLSL_Optimizer
-- Looking for HLSL2GLSL...
-- HLSL2GLSL_PREFIX_PATH changed.
-- Could not locate HLSL2GLSL
-- Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) 
-- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) 
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Looking for Softimage...
-- Softimage_PREFIX_PATH changed.
-- Could not locate Softimage
-- 
-----------------------------------------------------------------------------
-- The following external packages were located on your system.
-- This installation will have the extra features provided by these packages.
+ zlib
+ zziplib
+ freeimage
+ freetype
+ OpenGL ES 1.x
+ OpenGL ES 2.x
+ OpenGL ES 3.x
-----------------------------------------------------------------------------
-- The following OPTIONAL packages could NOT be located on your system.
-- Consider installing them to enable more features from this software.
+ OpenGL 3+: Support for the OpenGL 3+ render system <http://www.opengl.org/>
+ boost: Boost (general) <http://boost.org>
+ boost-thread: Used for threading support <http://boost.org>
+ POCO: POCO framework <http://pocoproject.org/>
+ tbb: Threading Building Blocks <http://www.threadingbuildingblocks.org/>
+ GLSL Optimizer: GLSL Optimizer <http://github.com/aras-p/glsl-optimizer/>
+ HLSL2GLSL: HLSL2GLSL <http://hlsl2glslfork.googlecode.com/>
+ OpenEXR: Load High dynamic range images <http://www.openexr.com/>
+ Python: Language bindings to use OGRE from Python <http://www.python.org/>
+ Doxygen: Tool for building API documentation <http://doxygen.org>
+ Softimage: Softimage SDK needed for building XSIExporter <FALSE>
-----------------------------------------------------------------------------

-- Could NOT find SWIG (missing:  SWIG_EXECUTABLE SWIG_DIR) 
-- 
----------------------------------------------------------------------------
  FEATURE SUMMARY
----------------------------------------------------------------------------

Building components:
  + Bites [BETA]
  + HLMS [BETA]
  + MeshLodGenerator
  + Overlay
  + Paging
  + Property
  + RTShader System
  + RTShader System Core Shaders
  + RTShader System Extensions Shaders
  + Terrain
  + Volume
Building plugins:
  + Octree scene manager
  + Particle FX
Building rendersystems:
  + OpenGL ES 2.x
Building executables:
  + Samples
Building core features:
  + Mesh Lod
  + DDS image codec
  + PVRTC image codec
  + ETC image codec
  + FreeImage codec
  + ZIP archives

Build type:                      static
Use C++11 std library:           OFF
Store child nodes as:            map [DEPRECATED]
Thread safety:                   none
ResourceManager behaviour:       legacy [DEPRECATED]
Use double precision:            disabled
Nodes inherit transform:         disabled
Assert mode:                     release exceptions
Allocator type:                  standard
STL containers use allocator:    disabled
Strings use allocator:           disabled
Memory tracker (debug):          disabled
Memory tracker (release):        disabled

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

-- Configuring incomplete, errors occurred!
See also "/home/xeon65/ogre/build/CMakeFiles/CMakeOutput.log".
See also "/home/xeon65/ogre/build/CMakeFiles/CMakeError.log".
0 x

Post Reply