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
Related
In my Android.mk and Application.mk , I am using a static library which is build using stlpot_static, but I want to use gnustl instead of stlport to build my project because I need support of c++11 in my project.
Earlier I was using APP_STL := stlport_shared Application.mk in my and my project was running successfully.
But now I want to make it APP_STL := gnustl_shared, the project compiles successfully but it crashes during run time giving me a error java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSt13_Filebuf_base12_M_page_sizeE", when I checked for this error,I found this dependency in my static library which was build using stlport_static.
How can I use gnustl with my project without disturbing my static library which has its dependency on stlport_static.
You can't mix and match STLs in a single binary: https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md#Using-Mismatched-Prebuilt-Libraries
Iam New to Android OpenCV+NDK devlopment. I want to find out the largest contour in the image in Android for that I am trying to build the JNI Integrated OpenCV Android project in eclipse. I've included
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include
${ProjDirPath}/../../sdk/native/jni/include
${NDKROOT}/platforms/android-9/arch-arm/usr/include
/usr/include/c++/4.6
/usr/include
${NDKROOT}/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.8/include
to the project -> Properties -> C/C++ General -> Paths and Symbols -> Includes under GNU C++
If I tried to build the project I am still getting the build error.
showing error as 'class std::vector > >' has no member named 'toArray' at the line Point points = contours.toArray();
What is this error. How can I resolve this.
and my Console Output is:
* Incremental Build of configuration Default for project OpenCV-Square-Tracking-Android-JNI-master ****
/home/dharaniinfotech/Downloads/android-ndk-r10d/ndk-build all
Android NDK: WARNING:jni/Android.mk:native_sample: non-system libraries in linker flags: -lboost_system-gcc-mt-1_53 -lboost_regex-gcc-mt-1_53 -lboost_filesystem-gcc-mt-1_53 -lboost_date_time-gcc-mt-1_53
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
[armeabi-v7a] Compile++ thumb: native_sample <= jni_part.cpp
jni/jni_part.cpp: In function 'jint Java_org_opencv_samples_tutorial3_Sample3Native_FindSquares(JNIEnv*, jobject, jlong, jint)':
jni/jni_part.cpp:77:30: error: 'class std::vector > >' has no member named 'toArray'
jni/jni_part.cpp:82:25: error: no match for 'operator[]' in 'points[i]'
make: * [obj/local/armeabi-v7a/objs-debug/native_sample/jni_part.o] Error 1
Please Help me to know what I am missing.
First thing I've wrongly included
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include
They should be like
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.8/include
And go to Code Analysis(right click the project-> C/C++ General) and select use project settings and uncheck all the check boxes.
I am trying to build my code for h.264 video decoding using hardware decoder(OMX codec) in native code of android 4.0.4 by keeping it in the android source tree. The android source is already built. I am using mm command to build my decoder module.
But when I try to build it I am getting the following error
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld:
out/target/product/generic/obj/SHARED_LIBRARIES/custom_decoder_intermediates/custom_decoder.o:
in function custom_decoder::decode_video():frameworks/base/include/utils/RefBase.h:171:
error: undefined reference to 'android_atomic_dec'
when I explored about it, came to know that android_atomic_dec is defined in cutils/atomic.h
which is in system/core/libcutils and the header at system/core/include/cutils of AOSP 4.0.4.
So I have added this also in my android.mk via LOCAL_C_INCLUDES but still to get the same error.
Can someone help me to solve this ??....
You must add cutils to the linkage stage:
LOCAL_LDLIBS += -L $(path-to-system-libs) -lcutils
If you are building AOSP tree, use instead the following:
LOCAL_SHARED_LIBRARIES += libcutils
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.
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).