Incompatible libOgreMainStatic.a

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
cfoch
Gnoblar
Posts: 1
Joined: Sat Jan 30, 2016 5:31 am

Incompatible libOgreMainStatic.a

Post by cfoch »

Hello,
I have installed Ogre3D for Android following this guide

Now I want to build a simple file containing only ¨int main(int argc, char **argv) { return 0;}¨, but I get errors when compiling.

Code: Select all

cfoch@cfoch-ubuntu:~/Documents/git/cfoch-ogre/hello$ /home/cfoch/opt/android-ndk-r10e/prebuilt/linux-x86_64/bin/make 
/home/cfoch/opt/android-ndk-r10e/prebuilt/linux-x86_64/bin/make  all-am
make[1]: Entering directory `/home/cfoch/Documents/git/cfoch-ogre/hello'
/bin/bash ./libtool  --tag=CXX   --mode=link g++ -I/home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/include -I/home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/include/OGRE -I/usr/include/freetype2 -I/usr/include/libdrm  -I/home/cfoch/opt/include/OIS -I/home/cfoch/opt/include  -g -O2   -o OgreApp OgreApp-hello.o -L/home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/lib -L/home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/lib/OGRE -lOgreMainStatic -lfreeimage -lfreetype -Wl,-Bsymbolic-functions -Wl,-z,relro -lzzip -lz -lXaw7 -lXt -lX11 -lGL  -L/home/cfoch/opt/lib -lOIS  
libtool: link: g++ -I/home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/include -I/home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/include/OGRE -I/usr/include/freetype2 -I/usr/include/libdrm -I/home/cfoch/opt/include/OIS -I/home/cfoch/opt/include -g -O2 -o OgreApp OgreApp-hello.o -Wl,-Bsymbolic-functions -Wl,-z -Wl,relro  -L/home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/lib -L/home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/lib/OGRE -lOgreMainStatic -lfreeimage -lfreetype /usr/lib/x86_64-linux-gnu/libzzip.so -lz -lXaw7 -lXt -lX11 -lGL -L/home/cfoch/opt/lib -lOIS
/usr/bin/ld: skipping incompatible /home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/lib/libOgreMainStatic.a when searching for -lOgreMainStatic
/usr/bin/ld: cannot find -lOgreMainStatic
/usr/bin/ld: cannot find -lfreeimage
/usr/bin/ld: skipping incompatible /home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/lib/libfreetype.a when searching for -lfreetype
/usr/bin/ld: skipping incompatible /home/cfoch/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/user/lib/libOIS.a when searching for -lOIS
collect2: error: ld returned 1 exit status
make[1]: *** [OgreApp] Error 1
make[1]: Leaving directory `/home/cfoch/Documents/git/cfoch-ogre/hello'
make: *** [all] Error 2
cfoch@cfoch-ubuntu:~/Documents/git/cfoch-ogre/hello$ 
These are my path variables:

Code: Select all

#PATH
export PATH=$PATH:/home/cfoch/opt/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/cfoch/opt/lib/
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/cfoch/opt/lib/pkgconfig/

# PATH: git-phab
export PATH=/home/cfoch/.local/bin/:$PATH

# virtualenwrapper
# VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3' # This needs to be placed before the virtualenvwrapper command
# source /usr/local/bin/virtualenvwrapper.sh

# OGRE
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/cfoch/Documents/mercurial/ogre/build/pkgconfig/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/cfoch/Documents/mercurial/ogre/build/lib/
export PATH=$PATH:/home/cfoch/Documents/mercurial/ogre/include/

# ANDROID
export PATH=$PATH:/home/cfoch/opt/android-sdk-linux/tools/
export PATH=$PATH:/home/cfoch/opt/android-sdk-linux/platform-tools/
export PATH=$PATH:/home/cfoch/opt/android-ndk-r10e/

export ANDROID_NDK=/home/cfoch/opt/android-ndk-r10e/
What can I do to compile this simple program?

bootstrap

Code: Select all

rm -rf autom4te.cache
 libtoolize --force --copy &&  aclocal &&  autoheader &&  automake --add-missing --force-missing --copy --foreign &&  autoconf
configure.ac

Code: Select all

AC_INIT(configure.ac)
 AM_INIT_AUTOMAKE(SampleApp, 0.1)
 AM_CONFIG_HEADER(config.h)
 
 AC_LANG_CPLUSPLUS
 AC_PROG_CXX
 AM_PROG_LIBTOOL
 
 PKG_CHECK_MODULES(OGRE, [OGRE >= 1.2])
 AC_SUBST(OGRE_CFLAGS)
 AC_SUBST(OGRE_LIBS)
 
 PKG_CHECK_MODULES(OIS, [OIS >= 1.0])
 AC_SUBST(OIS_CFLAGS)
 AC_SUBST(OIS_LIBS)
 
 AC_CONFIG_FILES(Makefile)
 AC_OUTPUT
Makefile.am

Code: Select all

# noinst_HEADERS= BaseApplication.h TutorialApplication.h
 
bin_PROGRAMS= OgreApp
# OgreApp_CPPFLAGS= -I$(top_srcdir)
 OgreApp_SOURCES= hello.cpp
 OgreApp_CXXFLAGS= $(OGRE_CFLAGS) $(OIS_CFLAGS)
 OgreApp_LDADD= $(OGRE_LIBS) $(OIS_LIBS)
 
 EXTRA_DIST = bootstrap
 AUTOMAKE_OPTIONS = foreign
hello.cpp

Code: Select all

int
main (int argc, char ** argv)
{
  return 0;
}

THE ERROR...
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 139

Re: Incompatible libOgreMainStatic.a

Post by c6burns »

You are probably trying to target an arch for which you haven't built those libs. For example, you are using ndk-build on an android project, and in your Application.mk you are targeting all three of armeabi, armeabi-v7a and x86 while you have only built static libs for armeabi-v7a.