Android: odd entry in lib dir

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Android: odd entry in lib dir

Post by ibrown »

Hi, I'm trying to compile ogre latest 1.9 for android using a macosx Lion host.
The compile goes ok, but the sample fails to link because it cannot find the libraries:

Code: Select all

Linking CXX shared module ../../lib/libSampleBrowserDummy.so
Updated project.properties
Updated local.properties
Updated file /Users/ian/Android/Ogre/build/SampleBrowserNDK/proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
SharedLibrary  : libOgreSampleBrowser.so
/Users/ian/Android/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lSample_CameraTrack
I looked in build/lib and saw there was a directory called $(PLATFORM_NAME) which seems wrong. In that directory are all the libs. Is anyone else seeing this? Where would I look for clues as to the issue?
A shell log showing what I mean is below:

Code: Select all

Ians-Mac:lib ian$ pwd
/Users/ian/Android/Ogre/build/lib
Ians-Mac:lib ian$ ls -l
total 16
drwxr-xr-x  46 ian  staff  1564 11 Jan 13:26 $(PLATFORM_NAME)
-rwxr-xr-x   1 ian  staff  6216 11 Jan 13:26 libSampleBrowserDummy.so
Ians-Mac:lib ian$ ls -l \$\(PLATFORM_NAME\)/
total 1081464
-rw-r--r--  1 ian  staff  240393194 11 Jan 13:13 libOgreMainStatic.a
-rw-r--r--  1 ian  staff   19419948 11 Jan 13:20 libOgreOverlayStatic.a
-rw-r--r--  1 ian  staff   65947460 11 Jan 13:19 libOgreRTShaderSystemStatic.a
-rw-r--r--  1 ian  staff   10511342 11 Jan 13:16 libPlugin_OctreeSceneManagerStatic.a
-rw-r--r--  1 ian  staff   14021452 11 Jan 13:16 libPlugin_ParticleFXStatic.a
-rw-r--r--  1 ian  staff   54828674 11 Jan 13:15 libRenderSystem_GLES2Static.a
-rw-r--r--  1 ian  staff    2678312 11 Jan 13:24 libSample_BSP.a
-rw-r--r--  1 ian  staff    2680408 11 Jan 13:20 libSample_BezierPatch.a
-rw-r--r--  1 ian  staff    2678388 11 Jan 13:20 libSample_CameraTrack.a
-rw-r--r--  1 ian  staff    2679966 11 Jan 13:24 libSample_CelShading.a
-rw-r--r--  1 ian  staff    2683412 11 Jan 13:20 libSample_Character.a
-rw-r--r--  1 ian  staff    6023242 11 Jan 13:20 libSample_Compositor.a
-rw-r--r--  1 ian  staff    2681060 11 Jan 13:25 libSample_CubeMapping.a
...etc
Can anyone help?

Thanks,

Ian

ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Android: odd entry in lib dir

Post by ibrown »

I wonder whether this commit broke android?

https://bitbucket.org/sinbad/ogre/commi ... d6d6ecb35c

is anyone else seeing this issue with the latest 1.9?

User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Android: odd entry in lib dir

Post by Wolfmanfx »

Compiling it right now

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Android: odd entry in lib dir

Post by masterfalcon »

It's entirely possible. I didn't think about the case where you'd be cross compiling for android on os x. i'll check on it too.

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Android: odd entry in lib dir

Post by masterfalcon »

Try applying this then reconfiguring with CMake.

Code: Select all

diff --git a/CMake/Utils/OgreConfigTargets.cmake b/CMake/Utils/OgreConfigTargets.cmake
--- a/CMake/Utils/OgreConfigTargets.cmake
+++ b/CMake/Utils/OgreConfigTargets.cmake
@@ -11,10 +11,18 @@
 
 # Default build output paths
 if (NOT OGRE_ARCHIVE_OUTPUT)
-  set(OGRE_ARCHIVE_OUTPUT ${OGRE_BINARY_DIR}/lib/$(PLATFORM_NAME))
+  if(APPLE AND NOT OGRE_BUILD_PLATFORM_ANDROID)
+    set(OGRE_ARCHIVE_OUTPUT ${OGRE_BINARY_DIR}/lib/$(PLATFORM_NAME))
+  else()
+    set(OGRE_ARCHIVE_OUTPUT ${OGRE_BINARY_DIR}/lib)
+  endif()
 endif ()
 if (NOT OGRE_LIBRARY_OUTPUT)
-  set(OGRE_LIBRARY_OUTPUT ${OGRE_BINARY_DIR}/lib/$(PLATFORM_NAME))
+  if(APPLE AND NOT OGRE_BUILD_PLATFORM_ANDROID)
+    set(OGRE_LIBRARY_OUTPUT ${OGRE_BINARY_DIR}/lib/$(PLATFORM_NAME))
+  else()
+    set(OGRE_LIBRARY_OUTPUT ${OGRE_BINARY_DIR}/lib)
+  endif()
 endif ()
 if (NOT OGRE_RUNTIME_OUTPUT)
   set(OGRE_RUNTIME_OUTPUT ${OGRE_BINARY_DIR}/bin)

ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Android: odd entry in lib dir

Post by ibrown »

I see the same on Windows 8Pro, so I don't think it is anything to do with macosx as the host...

User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Android: odd entry in lib dir

Post by Wolfmanfx »

Yep same happen on windows too "C:\Development\OGRE\AndroidBuild\lib\$(PLATFORM_NAME)"

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Android: odd entry in lib dir

Post by masterfalcon »

Ok, try that patch on windows too. it should work

User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Android: odd entry in lib dir

Post by Wolfmanfx »

The patch will work inneed :) (you guys posted during i wrote my post)

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Android: odd entry in lib dir

Post by masterfalcon »

If you guys give it a thumbs up I'll commit it ASAP.

ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Android: odd entry in lib dir

Post by ibrown »

I won't have time to test it tonight, but it looks good from a code reading point of view. Of course whether it sill works with iOS is another question :-)

User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Android: odd entry in lib dir

Post by Wolfmanfx »

So i rerun the build with the patch included and the linking works again - thumbs up!

ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Android: odd entry in lib dir

Post by ibrown »

Hi Guys, thanks for the quick response on this issue. I just tried it again on the Mac and it fails in a different way ... I think it is due to the recent GL3 changes though and not the issue above:

Code: Select all

Linking CXX static library ../lib/libOgreMainStatic.a
[ 51%] Built target OgreMain
Scanning dependencies of target RenderSystem_GLES2
[ 51%] Building CXX object RenderSystems/GLES2/CMakeFiles/RenderSystem_GLES2.dir/src/OgreGLES2Context.cpp.o
In file included from /Users/ian/Android/Ogre/RenderSystems/GLES2/include/OgreGLES2Context.h:32:0,
                 from /Users/ian/Android/Ogre/RenderSystems/GLES2/src/OgreGLES2Context.cpp:29:
/Users/ian/Android/Ogre/RenderSystems/GLES2/include/OgreGLES2Prerequisites.h:63:38: fatal error: GLES3/gl3platform.h: No such file or directory
compilation terminated.
make[2]: *** [RenderSystems/GLES2/CMakeFiles/RenderSystem_GLES2.dir/src/OgreGLES2Context.cpp.o] Error 1
make[1]: *** [RenderSystems/GLES2/CMakeFiles/RenderSystem_GLES2.dir/all] Error 2
make: *** [all] Error 2
Ians-Mac:ogreAndroidBuild ian$ 

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Android: odd entry in lib dir

Post by masterfalcon »

Ah, I'm on it. Did you enable the GLES3 support in CMake? If not, reconfigure. Since there is a new option some stuff may need to get filled in for the defines to be set up correctly.

ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Android: odd entry in lib dir

Post by ibrown »

nope, nothing special in the cake, all defaults. feature summary is like this:

Code: Select all

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

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

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

----------------------------------------------------------------------------
I configure with this little script:

Code: Select all

#!/bin/bash
rm -rf ogreAndroidBuild
mkdir ogreAndroidBuild
cd ogreAndroidBuild
export ANDROID_SDK=/Users/ian/Android/adt-bundle-mac-x86_64/sdk
export ANDROID_NDK=/Users/ian/Android/android-ndk-r8d
export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK
cmake -DCMAKE_TOOLCHAIN_FILE=/Users/ian/Android/Ogre/CMake/toolchain/android.toolchain.cmake -DOGRE_DEPENDENCIES_DIR=/Users/ian/Android/Ogre/AndroidDependencies -DANDROID_NATIVE_API_LEVEL=14 ../Ogre

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Android: odd entry in lib dir

Post by masterfalcon »

Ok, I see what I missed. I just pushed a change that should fix it for you.

ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Android: odd entry in lib dir

Post by ibrown »

It doesn't seem to have made any difference I'm afraid. Exact same error message.

Ian

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Android: odd entry in lib dir

Post by masterfalcon »

Could you check that OGRE_NO_GLES3_SUPPORT is defined to 1 in OgreBuildSettings.h?

ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Android: odd entry in lib dir

Post by ibrown »

yes, it is.

Code: Select all

Ians-Mac:include ian$ more OgreBuildSettings.h 
#ifndef __Custom_Config_H_
#define __Custom_Config_H_

// CMake auto-generated configuration options

#define OGRE_STATIC_LIB

/* #undef OGRE_BUILD_RENDERSYSTEM_D3D9 */
/* #undef OGRE_BUILD_RENDERSYSTEM_D3D11 */
/* #undef OGRE_BUILD_RENDERSYSTEM_GL */
/* #undef OGRE_BUILD_RENDERSYSTEM_GL3PLUS */
/* #undef OGRE_BUILD_RENDERSYSTEM_GLES */
#define OGRE_BUILD_RENDERSYSTEM_GLES2
/* #undef OGRE_BUILD_PLUGIN_BSP */
#define OGRE_BUILD_PLUGIN_OCTREE
/* #undef OGRE_BUILD_PLUGIN_PCZ */
#define OGRE_BUILD_PLUGIN_PFX
/* #undef OGRE_BUILD_PLUGIN_CG */

#define OGRE_CONFIG_LITTLE_ENDIAN
/* #undef OGRE_CONFIG_BIG_ENDIAN */

#define OGRE_DOUBLE_PRECISION 0

#define OGRE_MEMORY_ALLOCATOR 4

#define OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR 1

#define OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR 0

#define OGRE_MEMORY_TRACKER_DEBUG_MODE 0

#define OGRE_MEMORY_TRACKER_RELEASE_MODE 0

#define OGRE_THREAD_SUPPORT 0

#define OGRE_THREAD_PROVIDER 0

#define OGRE_NO_FREEIMAGE 0

#define OGRE_NO_DDS_CODEC 0

#define OGRE_NO_PVRTC_CODEC 0

#define OGRE_NO_ETC1_CODEC 0

#define OGRE_NO_ZIP_ARCHIVE 0

#define OGRE_NO_VIEWPORT_ORIENTATIONMODE 1

#define OGRE_NO_GLES2_CG_SUPPORT 1

#define OGRE_NO_GLES2_GLSL_OPTIMISER 1

#define OGRE_NO_GLES2_VAO_SUPPORT 1

#define OGRE_NO_GLES_STATE_CACHE_SUPPORT 1

#define OGRE_NO_GLES2_STATE_CACHE_SUPPORT 1

#define OGRE_NO_GLES3_SUPPPORT 1

#define OGRE_USE_BOOST 0

#define OGRE_PROFILING 0

#define RTSHADER_SYSTEM_BUILD_CORE_SHADERS

#define RTSHADER_SYSTEM_BUILD_EXT_SHADERS

/* #undef __FLASHCC__ */

#endif
Ians-Mac:include ian$ 

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Android: odd entry in lib dir

Post by masterfalcon »

Hmm, I'm not sure why it's trying to include those headers. Just for fun try including OgreBuildSettings.h at the top of OgreGLES2Prerequisites.h to see if that fixes it for now.

ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Android: odd entry in lib dir

Post by ibrown »

you've got a typo, there are 3 Ps in SUPPORT in the configured header :roll:

Code: Select all

#define OGRE_NO_GLES3_SUPPPORT 1

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Android: odd entry in lib dir

Post by masterfalcon »

Oh jeez. Thanks for catching that. I'm getting sloppy.

ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Android: odd entry in lib dir

Post by ibrown »

build works now, thanks!

Ian

niparx
Gnoblar
Posts: 7
Joined: Thu Apr 27, 2017 3:41 pm
Location: Russia/Lithuania
x 1

Re: Android: odd entry in lib dir

Post by niparx »

ibrown wrote:I won't have time to test it tonight, but it looks good from a code reading point of view. Of course whether it sill works with iOS is another question :-)
Looks like it does not work for iOS.
Building on osx for iOS simulator.
Source 1.10.4
Generate project with such CMake call:

Code: Select all

cmake \
    ../../../ogre \
    -GXcode \
    -DAPPLE_IOS:BOOL=TRUE \
    -DIOS_PLATFORM=SIMULATOR \
    -DOGRE_BUILD_PLATFORM_APPLE_IOS:BOOL=TRUE \
    -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain/ios.toolchain.xcode.cmake \
    -DCMAKE_INSTALL_PREFIX=../lib_install \
    -DOGRE_BUILD_COMPONENT_PAGING=FALSE \
    -DOGRE_BUILD_COMPONENT_PROPERTY=FALSE \
    -DOGRE_BUILD_COMPONENT_TERRAIN=FALSE \
    -DOGRE_BUILD_COMPONENT_OVERLAY=TRUE \
    -DOGRE_BUILD_COMPONENT_VOLUME=FALSE \
    -DOGRE_BUILD_COMPONENT_RTSHADERSYSTEM=TRUE \
    -DOGRE_BUILD_PLUGIN_BSP=FALSE \
    -DOGRE_BUILD_PLUGIN_CG=FALSE \
    -DOGRE_BUILD_PLUGIN_OCTREE=FALSE \
    -DOGRE_BUILD_PLUGIN_PCZ=FALSE \
    -DOGRE_BUILD_PLUGIN_PFX=FALSE \
    -DOGRE_BUILD_RENDERSYSTEM_GL=TRUE \
    -DOGRE_BUILD_RENDERSYSTEM_GL3Plus=FALSE \
    -DOGRE_BUILD_RENDERSYSTEM_GLES=FALSE \
    -DOGRE_BUILD_RENDERSYSTEM_GLES2=FALSE \
    -DOGRE_BUILD_RENDERSYSTEM_D3D9=FALSE \
    -DOGRE_BUILD_RENDERSYSTEM_D3D11=FALSE \
    -DOGRE_BUILD_SAMPLES=FALSE \
    -DOGRE_BUILD_TESTS=FALSE \
    -DOGRE_BUILD_TOOLS=FALSE \
    -DOGRE_CONFIG_ALLOCATOR=1 \
    -DOGRE_CONFIG_CONTAINERS_USE_CUSTOM_ALLOCATOR=FALSE \
    -DOGRE_CONFIG_DISABLE_DDS=TRUE \
    -DOGRE_CONFIG_DISABLE_FREEIMAGE=TRUE \
    -DOGRE_CONFIG_DOUBLE=TRUE \
    -DOGRE_CONFIG_MEMTRACK_DEBUG=TRUE \
    -DOGRE_CONFIG_MEMTRACK_RELEASE=FALSE \
    -DOGRE_CONFIG_NEW_COMPILERS=TRUE \
    -DOGRE_CONFIG_STRING_USE_CUSTOM_ALLOCATOR=FALSE \
    -DOGRE_CONFIG_THREADS=FALSE \
    -DOGRE_DEPENDENCIES_DIR=../my_deps \
    -DOGRE_FULL_RPATH=FALSE \
    -DOGRE_INSTALL_DOCS=FALSE \
    -DOGRE_INSTALL_MEDIA=FALSE \
    -DOGRE_INSTALL_PLUGIN_HEADERS=FALSE \
    -DOGRE_INSTALL_SAMPLES=FALSE \
    -DOGRE_INSTALL_SAMPLES_SOURCE=FALSE \
    -DOGRE_INSTALL_TOOLS=FALSE \
    -DOGRE_STANDALONE_BUILD=FALSE \
    -DOGRE_STATIC=TRUE \
    -DOGRE_CONFIG_STATIC_LINK_CRT=FALSE \
    -DBOOST_ROOT=/usr/local/include/boost \
    -DBOOST_INCLUDEDIR=/usr/local/include/boost \
    -DBOOST_LIBRARYDIR=/usr/local/lib
and then build with such command

Code: Select all

xcodebuild \
    -project OGRE.xcodeproj \
    -target install \
    -parallelizeTargets \
    -configuration Release \
    -sdk iphonesimulator \
    ARCHS="i386 x86_64" \
    ONLY_ACTIVE_ARCH=NO
As a result, such error:

Code: Select all

CMake Error at OgreMain/cmake_install.cmake:32 (file):
  file INSTALL cannot find
  "....../project_dir/lib/$(PLATFORM_NAME)/Release/libOgreMainStatic.a".
Call Stack (most recent call first):
  cmake_install.cmake:75 (include)


make: *** [install_buildpart_0] Error 1
Command /bin/sh failed with exit code 2
I looked there. Path with file exists: "....../project_dir/lib/iphonesimulator/Release/libOgreMainStatic.a".
So, I think, problem is in cmake_install.cmake. It can not handle $(PLATFORM_NAME) variable.

Any suggestions?

Post Reply