Problem building STLport NDK r5/ Android - android

I'm trying to build STLport for Android. I got the following steps, but they are not working:
1 - Clone STLport repository using:
git clone git://stlport.git.sourceforge.net/gitroot/stlport/stlport
2 - Configure environment using :
./configure --target=arm-eabi --with-extra-cxxflags="-fshort-enums"
--with-extra-cflags="-fshort-enums"
3 - From src directory build it using
make SYSROOT"{MY NDK path}/platforms/android-5/arch-arm/" release-static
But I got the following errors:
In file included from ../stlport/stl/_alloc.h:45,
from ../stlport/memory:29,
from dll_main.cpp:41:
../stlport/stl/_new.h:45:24: error: new: No such file or directory
In file included from ../stlport/stl/_limits.h:36,
from ../stlport/limits:29,
from dll_main.cpp:48:
../stlport/stl/_cwchar.h:26:30: error: cstddef: No such file or directory
In file included from ../stlport/stl/_utility.h:35,
from ../stlport/utility:35,
from dll_main.cpp:40:
../stlport/type_traits:889: error: 'declval' was not declared in this scope
../stlport/type_traits:889: error: expected primary-expression before '>' token
../stlport/type_traits:889: error: expected primary-expression before ')' token
../stlport/type_traits:889: error: 'declval' was not declared in this scope
../stlport/type_traits:889: error: expected primary-expression before '>' token
../stlport/type_traits:889: error: expected primary-expression before ')' token
../stlport/type_traits:889: error: ISO C++ forbids declaration of 'decltype' with no type
../stlport/type_traits:889: error: ISO C++ forbids in-class initialization of non-const static member 'decltype'
../stlport/type_traits:889: error: template declaration of 'int std::tr1::detail::decltype'
../stlport/type_traits:942: error: ISO C++ forbids declaration of 'decltype' with no type
../stlport/type_traits:942: error: ISO C++ forbids in-class initialization of non-const static member 'decltype'
../stlport/type_traits:942: error: template declaration of 'int std::tr1::detail::decltype'
make: *** [obj/arm-eabi-gcc/so/dll_main.o] Error 1
Is there any include dir or configuration I´m missing?
Thanks,
Sergio

Android NDK r5 now has STL support, just add APP_STL := stlport_staticto your Android.mk file, valid options for APP_STL variable are;
stlport_static
stlport_shared
gnustl_static
Note that only gnustl_static variant supports exceptions.

I've manage to compile STL-Port on Android NDK R3 using STLPort GIT repository. A few "adaptations" are necessary however. You can find a description on the procedure here. It should work for NDK R5 too.
Hope that helps.

The last version on git seems to be broken. Try use a previous version (I've used the one from Wed, Dec 1st 2010 and it worked fine).

Related

Undefined Reference to android::LPAPlayer::*

I am having great difficulty with a step in compiling CyanogenMod 11(Android 4.4) for an unsupported device based on an MSM7x27A/Snapdragon S1 platform. When I attempt to build libstagefright, I come up with an undefined reference error to functions in android::LPAPlayer::*, including the constructor. The error I get is:
Copying: /home/dyngar-f/android/android/out/target/common/obj/JAVA_LIBRARIES/mms-common_intermediates/noproguard.classes.jar
frameworks/av/media/libstagefright/AwesomePlayer.cpp:1282: error: undefined reference to 'android::LPAPlayer::LPAPlayer(android::sp<android::MediaPlayerBase::AudioSink> const&, bool&, android::AwesomePlayer*)'
frameworks/av/media/libstagefright/AwesomePlayer.cpp:1306: error: undefined reference to 'android::LPAPlayer::mObjectsAlive'
frameworks/av/media/libstagefright/AwesomePlayer.cpp:1882: error: undefined reference to 'android::LPAPlayer::mObjectsAlive'
collect2: error: ld returned 1 exit statusbuild/core/shared_library.mk:81: recipe for target '/home/dyngar-f/android/android/out/target/product/schS738c/obj/SHARED_LIBRARIES/libstagefright_intermediates/LINKED/libstagefright.so' failed
make: *** [/home/dyngar-f/android/android/out/target/product/schS738c/obj/SHARED_LIBRARIES/libstagefright_intermediates/LINKED/libstagefright.so] Error 1make: *** Waiting for unfinished jobs....
I have searched high and low and I found no mention of this error that leads me to a solution to this problem, and I haven't arrived at a solution myself. Here are the references to this issue I have found from others:
Gist from CMartinBaughman
Mentioned in XDA Thread on this page there is also an answer that doesn't seem to work.
Can anyone guide me to a solution for this issue?
The error is coming from the linker which is unable to find the reference to LPAPlayer which is actually a customization in CyanogenMod sources. From the latest tree, Android.mk for libstagefright is not including LPAPlayer.cpp for all platforms.
To resolve your issue, please try by adding the following files in Android.mk between lines 114-117
#New lines included
ifeq ($(call is-chipset-in-board-platform,msm7x27),true)
LOCAL_SRC_FILES += LPAPlayer.cpp
LOCAL_CFLAGS += -DLEGACY_LPA -DUSE_LPA_MODE
endif
ifeq ($(call is-chipset-in-board-platform,msm7x30),true)
LOCAL_SRC_FILES += LPAPlayer.cpp
LOCAL_CFLAGS += -DLEGACY_LPA -DUSE_LPA_MODE
endif
The platform name may need to be modified to suit the actual name (Please refer to BoardConfig.mk).

C++ on Android missing std::map:at

I am trying to compile my cocos2d-x project for android, but it I get the error:
jni/../../Classes/Utility.cpp:359:47: error: 'class
std::map,
std::allocator >, std::basic_string, std::allocator > >' has no member named
'at' make: *
[obj/local/armeabi/objs-debug/game_shared///Classes/Utility.o]
Error 1
I have set APP_STL := stlport_static in Application.mk (not Android.mk), I even have set the eclipse include path {android-ndk-r9}/sources/cxx-stl/stlport/stlport. But still nothing, any ideas? or is that method just not included in this version of c++?
UPDATE
I am using stlport_static, which is defined as follows (as static library):
I.3. STLport runtime:
This is a port of STLport (http://www.stlport.org) that can be used on
Android. It will provide you with a complete set of C++ standard
library headers, with RTTI and exception handling support.
That's because the library embeds its own copy of GAbi++.
My cocos2d-x version is 2.1rc0-x-2.1.4

getting error in android NDK while using ndk-build

i am new in android ndk and i m making connection of java and c/c++ code and at last moment when i use ndk-build command then i got this error.
please help me to clear this problem.
I am working on ubuntu 12.04. and i got same error on both linux and windows and on windows i use using cygwin.
Error-
/home/saicomputer/android-ndk-r8e/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Compile thumb : myjni <= native.c
jni/native.c: In function 'Java_com_example_demo_MainActivity_hello':
jni/native.c:4:3: error: parameter name omitted
jni/native.c:4:3: error: parameter name omitted
jni/native.c:5:10: error: 'env' undeclared (first use in this function)
jni/native.c:5:10: note: each undeclared identifier is reported only once for each function it appears in
jni/native.c: In function 'Java_com_example_demo_MainActivity_add':
jni/native.c:9:3: error: parameter name omitted
jni/native.c:9:3: error: parameter name omitted
jni/native.c:9:3: error: parameter name omitted
jni/native.c:9:3: error: parameter name omitted
jni/native.c:10:9: error: 'value1' undeclared (first use in this function)
jni/native.c:10:18: error: 'value2' undeclared (first use in this function)
make: *** [obj/local/armeabi/objs/myjni/native.o] Error 1
please help me out to overcome this problem.
thanks.

Android NDK doesn't support header files?

This page has instuctions for compiling iwlist and other commands for Android:
https://code.google.com/p/haggle/wiki/WirelessTools
Unfortunately I'm getting the same type of error as the commenter on that page:
Android NDK: WARNING: Unsupported source file extensions in /home/simon/Android-SDK/wireless_tools.29/Android.mk for module iwlist Android NDK: iwlib.h
When I remove the iwlib.h from the LOCAL_SRC_FILES of the Android.mk, it doesn't show that warning, but it still fails with the same error:
./iwlist.c:633:7: error: 'IW_EV_LCP_PK2_LEN' undeclared (first use in this function)
This is undeclared because it is in the iwlib.h file it's warning about.
So why does the Android NDK not recognize header .h files?
To build the libraries, you unpacked the gz file, and ran make, didn't you? Or you simply renamed wireless.22.h? Anyways, before you runndk-build, you have a wireless.h file in the package directory. Add the following two lines to the end of this file:
#undef IW_EV_LCP_PK_LEN
#undef IW_EV_POINT_PK_LEN
And remove the iwlib.h from the LOCAL_SRC_FILES of the Android.mk. #Gabe is right, header files should not be compiled separately. In iwlist.c you will find line 14:
#include "iwlib.h"
You normally don't compile header files. You include them in a .c or .cpp file that you do compile. But you wouldn't pass them into the compiler as a source file.

compile and build “iw” for android 4.1 device?

i need to install iw wireless packages on android 4.1 device. but i don't know how and what is the require version of the packages to install !!
also is it need linux platform to do this or it is enough to build and install on adb shell for android rooting device.
i see this link but when i do it from adb terminal i see that git and some shells not found ??? how to do it ?
it seems no one has any idea ??
While building iw version 3.11 (which has an Android.mk file already), I encountered some issues due to missing/ wrong headers and libraries. Since it has an Android.mk file, the NDK can be used.
In the following I will assume the following:
A device image has been built before (the kernel headers and libnl-2 static library should at least be available). I have built CyanogenMod 10 (with kernel 3.0.something) for the i9300, update the paths below to reflect that.
The NDK is installed to ~/android/system/ndk.
The NDK has appropriate platforms and toolchains installed.
Preparation after extracting iw-3.11.tar.xz and changing my directory in it:
ln -s . jni
ln -nsv ~/android/system/external ./
The next issue is the netlink library:
In file included from external/libnl-headers/netlink/genl/genl.h:15:0,
from /tmp/and/iw/jni/iw.c:17:
external/libnl-headers/netlink/netlink.h:27:29: fatal error: linux/genetlink.h: No such file or directory.
Simply creating a link to the android/system/out/target/product/i9300/obj/KERNEL_OBJ/usr/include/linux breaks other headers badly which will give errors such as:
Compile thumb : iw <= iw.c
In file included from /home/user/android/system/ndk/platforms/android-14/arch-arm/usr/include/net/if.h:28:0,
from /tmp/and/iw/jni/iw.c:10:
/tmp/and/iw/jni/linux/if.h:178:19: error: field 'ifru_addr' has incomplete type
/tmp/and/iw/jni/linux/if.h:179:19: error: field 'ifru_dstaddr' has incomplete type
/tmp/and/iw/jni/linux/if.h:180:19: error: field 'ifru_broadaddr' has incomplete type
/tmp/and/iw/jni/linux/if.h:181:19: error: field 'ifru_netmask' has incomplete type
/tmp/and/iw/jni/linux/if.h:182:20: error: field 'ifru_hwaddr' has incomplete type
In file included from external/libnl-headers/netlink/netlink.h:20:0,
from external/libnl-headers/netlink/genl/genl.h:15,
from /tmp/and/iw/jni/iw.c:17:
/home/user/android/system/ndk/platforms/android-14/arch-arm/usr/include/sys/socket.h:74:44: warning: 'struct msghdr' declared inside parameter list [enabled by default]
/home/user/android/system/ndk/platforms/android-14/arch-arm/usr/include/sys/socket.h:74:44: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
/home/user/android/system/ndk/platforms/android-14/arch-arm/usr/include/sys/socket.h:75:38: warning: 'struct msghdr' declared inside parameter list [enabled by default]
In file included from external/libnl-headers/netlink/netlink.h:25:0,
from external/libnl-headers/netlink/genl/genl.h:15,
from /tmp/and/iw/jni/iw.c:17:
/tmp/and/iw/jni/linux/netlink.h:33:2: error: unknown type name 'sa_family_t'
In file included from external/libnl-headers/netlink/genl/genl.h:15:0,
from /tmp/and/iw/jni/iw.c:17:
external/libnl-headers/netlink/netlink.h:51:16: warning: 'struct msghdr' declared inside parameter list [enabled by default]
external/libnl-headers/netlink/netlink.h:54:19: warning: 'struct iovec' declared inside parameter list [enabled by default]
make: *** [/tmp/and/iw/obj/local/armeabi/objs/iw/iw.o] Error 1
A workaround is to create the linux directory and put a symlink to ~/android/system/out/target/product/i9300/obj/KERNEL_OBJ/usr/include/linux/genetlink.h in it:
mkdir -p linux
ln -svn ~/android/system/out/target/product/i9300/obj/KERNEL_OBJ/usr/include/linux/genetlink.h linux/
Finally patch Android.mk to finish linking to the netlink library:
sed "/LOCAL_LDFLAGS/s#\$# -L$HOME/android/system/out/target/product/i9300/obj/STATIC_LIBRARIES/libnl_2_intermediates -lnl_2#" -i Android.mk
Now the build can be started:
NDK_PROJECT_PATH=$PWD ~/android/system/ndk/ndk-build TARGET_PLATFORM=android-14
It will not complete because netlink/genl/genl.h cannot be found, but the iw
binary is available in libs/armeabi!

Categories

Resources