Page 1 of 1

Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 3:05 pm
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

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:08 pm
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?

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:14 pm
by Wolfmanfx
Compiling it right now

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:19 pm
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.

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:22 pm
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)

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:22 pm
by ibrown
I see the same on Windows 8Pro, so I don't think it is anything to do with macosx as the host...

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:23 pm
by Wolfmanfx
Yep same happen on windows too "C:\Development\OGRE\AndroidBuild\lib\$(PLATFORM_NAME)"

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:25 pm
by masterfalcon
Ok, try that patch on windows too. it should work

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:28 pm
by Wolfmanfx
The patch will work inneed :) (you guys posted during i wrote my post)

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:30 pm
by masterfalcon
If you guys give it a thumbs up I'll commit it ASAP.

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:35 pm
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 :-)

Re: Android: odd entry in lib dir

Posted: Fri Jan 11, 2013 11:35 pm
by Wolfmanfx
So i rerun the build with the patch included and the linking works again - thumbs up!

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 3:32 pm
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$ 

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 4:57 pm
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.

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 5:06 pm
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

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 5:12 pm
by masterfalcon
Ok, I see what I missed. I just pushed a change that should fix it for you.

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 5:31 pm
by ibrown
It doesn't seem to have made any difference I'm afraid. Exact same error message.

Ian

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 5:56 pm
by masterfalcon
Could you check that OGRE_NO_GLES3_SUPPORT is defined to 1 in OgreBuildSettings.h?

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 6:06 pm
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$ 

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 6:37 pm
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.

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 6:55 pm
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

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 6:58 pm
by masterfalcon
Oh jeez. Thanks for catching that. I'm getting sloppy.

Re: Android: odd entry in lib dir

Posted: Mon Jan 14, 2013 8:29 pm
by ibrown
build works now, thanks!

Ian

Re: Android: odd entry in lib dir

Posted: Fri May 05, 2017 12:20 am
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?