I tried to solve this problem by own but i don't have more ideas;(
I created with the cocos2d-x console an new project.
Now i want to compile this but alway i get this error(s).
I use actually the newest at bundle for mac, apache-ant-1.9.4 & android NDK-r9d
MacBook-Air:3sCube to-dev$ cocos run -p android -v
Running command: compile
Building mode: debug
building native
NDK build mode: debug
The Selected NDK toolchain version was 4.8 !
running: '/Users/to-dev/Desktop/android-ndk-r9d/ndk-build -C /Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android -j1 NDK_MODULE_PATH=/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d:/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos:/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/external NDK_DEBUG=1'
Android NDK: WARNING:/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
Android NDK: WARNING:/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/platform/android/Android.mk:cocos2dxandroid_static: LOCAL_LDLIBS is always ignored for static libraries
make: Entering directory `/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android'
[armeabi] StaticLibrary : libcocos2d.a
[armeabi] StaticLibrary : libcocosdenshion.a
[armeabi] StaticLibrary : libchipmunk.a
[armeabi] StaticLibrary : libcocos2dandroid.a
[armeabi] StaticLibrary : libcpufeatures.a
[armeabi] SharedLibrary : libcocos2dcpp.so
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCActionManager.cpp:81: error: undefined reference to 'cocos2d::ccArrayNew(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCActionManager.cpp:100: error: undefined reference to 'cocos2d::ccArrayRemoveObjectAtIndex(cocos2d::_ccArray*, int, bool)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCAtlasNode.cpp:93: error: undefined reference to 'cocos2d::TextureAtlas::initWithTexture(cocos2d::Texture2D*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCAtlasNode.cpp:138: error: undefined reference to 'cocos2d::QuadCommand::init(float, unsigned int, cocos2d::GLProgramState*, cocos2d::BlendFunc, cocos2d::V3F_C4B_T2F_Quad*, int, cocos2d::Mat4 const&)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCFontAtlas.cpp:76: error: undefined reference to 'cocos2d::Texture2D::initWithData(void const*, int, cocos2d::Texture2D::PixelFormat, int, int, cocos2d::Size const&)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCFontAtlas.cpp:268: error: undefined reference to 'cocos2d::Texture2D::initWithData(void const*, int, cocos2d::Texture2D::PixelFormat, int, int, cocos2d::Size const&)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCFontAtlas.cpp:312: error: undefined reference to 'cocos2d::Texture2D::initWithData(void const*, int, cocos2d::Texture2D::PixelFormat, int, int, cocos2d::Size const&)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCGrid.cpp:133: error: undefined reference to 'cocos2d::Texture2D::initWithData(void const*, int, cocos2d::Texture2D::PixelFormat, int, int, cocos2d::Size const&)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCLabel.cpp:1326: error: undefined reference to 'cocos2d::TextureAtlas::updateQuad(cocos2d::V3F_C4B_T2F_Quad*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCLabelAtlas.cpp:208: error: undefined reference to 'cocos2d::TextureAtlas::increaseTotalQuadsWith(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCLabelAtlas.cpp:219: error: undefined reference to 'cocos2d::TextureAtlas::resizeCapacity(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCLabelAtlas.cpp:250: error: undefined reference to 'cocos2d::TextureAtlas::updateQuad(cocos2d::V3F_C4B_T2F_Quad*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParallaxNode.cpp:68: error: undefined reference to 'cocos2d::ccArrayNew(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParallaxNode.cpp:126: error: undefined reference to 'cocos2d::ccArrayRemoveObjectAtIndex(cocos2d::_ccArray*, int, bool)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleBatchNode.cpp:100: error: undefined reference to 'cocos2d::TextureAtlas::initWithTexture(cocos2d::Texture2D*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleBatchNode.cpp:459: error: undefined reference to 'cocos2d::TextureAtlas::fillWithEmptyQuadsFromIndex(int, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleBatchNode.cpp:465: error: undefined reference to 'cocos2d::TextureAtlas::moveQuadsFromIndex(int, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleBatchNode.cpp:469: error: undefined reference to 'cocos2d::TextureAtlas::increaseTotalQuadsWith(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleBatchNode.cpp:291: error: undefined reference to 'cocos2d::TextureAtlas::moveQuadsFromIndex(int, int, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleBatchNode.cpp:379: error: undefined reference to 'cocos2d::TextureAtlas::removeQuadsAtIndex(int, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleBatchNode.cpp:382: error: undefined reference to 'cocos2d::TextureAtlas::fillWithEmptyQuadsFromIndex(int, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleBatchNode.cpp:433: error: undefined reference to 'cocos2d::TextureAtlas::resizeCapacity(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleExamples.cpp:52: error: undefined reference to 'cocos2d::Image::initWithImageData(unsigned char const*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleSystem.cpp:403: error: undefined reference to 'cocos2d::ZipUtils::inflateMemory(unsigned char*, int, unsigned char**)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleSystem.cpp:409: error: undefined reference to 'cocos2d::Image::initWithImageData(unsigned char const*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCParticleSystemQuad.cpp:377: error: undefined reference to 'cocos2d::QuadCommand::init(float, unsigned int, cocos2d::GLProgramState*, cocos2d::BlendFunc, cocos2d::V3F_C4B_T2F_Quad*, int, cocos2d::Mat4 const&)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCRenderTexture.cpp:526: error: undefined reference to 'cocos2d::Image::initWithRawData(unsigned char const*, int, int, int, int, bool)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCRenderTexture.cpp:530: error: undefined reference to 'cocos2d::Image::initWithRawData(unsigned char const*, int, int, int, int, bool)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCSprite.cpp:336: error: undefined reference to 'cocos2d::Image::initWithRawData(unsigned char const*, int, int, int, int, bool)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCSprite.cpp:568: error: undefined reference to 'cocos2d::TextureAtlas::updateQuad(cocos2d::V3F_C4B_T2F_Quad*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCSprite.cpp:595: error: undefined reference to 'cocos2d::QuadCommand::init(float, unsigned int, cocos2d::GLProgramState*, cocos2d::BlendFunc, cocos2d::V3F_C4B_T2F_Quad*, int, cocos2d::Mat4 const&)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCSprite.cpp:913: error: undefined reference to 'cocos2d::TextureAtlas::updateQuad(cocos2d::V3F_C4B_T2F_Quad*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCSpriteBatchNode.cpp:99: error: undefined reference to 'cocos2d::TextureAtlas::initWithTexture(cocos2d::Texture2D*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCSpriteBatchNode.cpp:548: error: undefined reference to 'cocos2d::TextureAtlas::insertQuad(cocos2d::V3F_C4B_T2F_Quad*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCSpriteBatchNode.cpp:560: error: undefined reference to 'cocos2d::TextureAtlas::removeQuadAtIndex(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCSpriteBatchNode.cpp:405: error: undefined reference to 'cocos2d::TextureAtlas::resizeCapacity(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCSpriteBatchNode.cpp:639: error: undefined reference to 'cocos2d::TextureAtlas::insertQuad(cocos2d::V3F_C4B_T2F_Quad*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCTMXLayer.cpp:91: error: undefined reference to 'cocos2d::ccCArrayNew(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCTMXLayer.cpp:448: error: undefined reference to 'cocos2d::ccCArrayInsertValueAtIndex(cocos2d::_ccCArray*, void*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCTMXLayer.cpp:384: error: undefined reference to 'cocos2d::ccCArrayInsertValueAtIndex(cocos2d::_ccCArray*, void*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCTMXLayer.cpp:585: error: undefined reference to 'cocos2d::ccCArrayRemoveValueAtIndex(cocos2d::_ccCArray*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCTMXLayer.cpp:595: error: undefined reference to 'cocos2d::TextureAtlas::removeQuadAtIndex(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCTMXLayer.cpp:565: error: undefined reference to 'cocos2d::ccCArrayRemoveValueAtIndex(cocos2d::_ccCArray*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCTMXXMLParser.cpp:646: error: undefined reference to 'cocos2d::ZipUtils::inflateMemoryWithHint(unsigned char*, int, unsigned char**, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./2d/CCTileMapAtlas.cpp:226: error: undefined reference to 'cocos2d::TextureAtlas::increaseTotalQuadsWith(int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./3d/CCBundle3D.cpp:451: error: undefined reference to 'cocos2d::BundleReader::init(char*, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./3d/CCBundle3D.cpp:456: error: undefined reference to 'cocos2d::BundleReader::read(void*, int, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./3d/CCBundle3D.cpp:465: error: undefined reference to 'cocos2d::BundleReader::read(void*, int, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./3d/CCBundle3D.cpp:484: error: undefined reference to 'cocos2d::BundleReader::read(void*, int, int)'
/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android/../cocos2d/cocos/./3d/CCBundle3D.cpp:497: error: undefined reference to 'cocos2d::BundleReader::read(void*, int, int)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/armeabi/libcocos2dcpp.so] Error 1
make: Leaving directory `/Users/to-dev/Desktop/cocos2d-x-3.2/3sCube/proj.android'
Error running command, return code: 2
What do i wrong? Thanks for your help!
t333o
Thanks for all answers and comments!
My Solution was that i reinstall cocos2d-x 3.2 and all the environmental variables.
Thanks!
1) Have you tried to run : cocos run -p android ?
2) Did you check cocos2d lib added to the Android.mk ?
3) You can try to use to the following Makefiles:
Application.mk
APP_STL := c++_static
NDK_TOOLCHAIN_VERSION=clang
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic
APP_DEBUG := $(strip $(NDK_DEBUG))
ifeq ($(APP_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_OPTIM := release
endif
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos)
LOCAL_MODULE := cocos2dcpp_shared
LOCAL_MODULE_FILENAME := libcocos2dcpp
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp \
../../Classes/MenuScene.cpp
LOCAL_CFLAGS := -std=c++11
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
# LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_static
# LOCAL_WHOLE_STATIC_LIBRARIES += spine_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,.)
$(call import-module,audio/android)
# $(call import-module,Box2D)
# $(call import-module,editor-support/cocosbuilder)
# $(call import-module,editor-support/spine)
# $(call import-module,editor-support/cocostudio)
# $(call import-module,network)
# $(call import-module,extensions)
Related
So I'm trying to build tesseract (using tess-two) and opencv for android. I'm able to build opencv and tess-two separately, but I want to be able to build them alongside.
For that I'm using the same build file as given in tess-two. Here all sub directory Android.mk files are called which works without a problem. As soon as I want to include the opencv library as well, and I want to compile files which are dependent on tesseract and opencv I get following errors.
Build command failed.
Error while executing process /home/alexander/Android/Sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/pathtoapp/app/src/main/cpp/Android.mk NDK_APPLICATION_MK=/pathtoapp/app/src/main/cpp/Application.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-24 NDK_OUT=/pathtoapp/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/pathtoapp/app/build/intermediates/ndkBuild/debug/lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
Android NDK: WARNING:/pathtoapp/app/src/main/cpp/com_googlecode_tesseract_android/Android.mk:tess: non-system libraries in linker flags: -latomic
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
I'm not really sure, why this error happens. As mentioned I'm able to build the libraries separately. So the problem must be bringing them together.
Here is my makefile:
Android.mk:
LOCAL_PATH := $(call my-dir)
TESSERACT_PATH := $(LOCAL_PATH)/com_googlecode_tesseract_android/src
LEPTONICA_PATH := $(LOCAL_PATH)/com_googlecode_leptonica_android/src
LIBJPEG_PATH := $(LOCAL_PATH)/libjpeg
LIBPNG_PATH := $(LOCAL_PATH)/libpng
# Just build the Android.mk files in the subdirs
include $(call all-subdir-makefiles)
####################################################################################
LOCAL_PATH := $(call my-dir)
PROJECT_ROOT:= $(call my-dir)/../../../../..
include $(CLEAR_VARS)
OPENCV_INSTALL_MODULES:=on
LIBOPENCV_PATH := /pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/OpenCV.mk
include $(LIBOPENCV_PATH)
LOCAL_MODULE := libopencv_ndk
LOCAL_CFLAGS := -Werror -Wno-write-strings -std=c++11
LOCAL_SRC_FILES := native-lib.cpp \
CV_Main.cpp \
Native_Camera.cpp \
Image_Reader.cpp
LOCAL_LDLIBS := -llog -landroid -lcamera2ndk -lmediandk
LOCAL_SHARED_LIBRARIES := libtess liblept
include $(BUILD_SHARED_LIBRARY)
My current build directory looks as following:
- com_googlecode_leptonica_android
- com_googlecode_tesseract_android
- libjpeg
- libpng
- opencv
Is there something that I'm doing wrong? The error message is saying, that I'm using a non-system libraries in linker flags: -latomic , but this seems to be not the true error.
Can anyone help me?
Edit:
I found out, what the eror was. It was no rule to make target native_lib.cpp. So I wasn't able to build the following cpp file. I fixed it by creating a temporary variable of my $(LOCAL_PATH).
LOCAL_PATH := $(call my-dir)
MY_PATH := $(LOCAL_PATH)
TESSERACT_PATH := $(LOCAL_PATH)/com_googlecode_tesseract_android/src
LEPTONICA_PATH := $(LOCAL_PATH)/com_googlecode_leptonica_android/src
LIBJPEG_PATH := $(LOCAL_PATH)/libjpeg
LIBPNG_PATH := $(LOCAL_PATH)/libpng
include $(call all-subdir-makefiles)
####################################################################################
include $(CLEAR_VARS)
LOCAL_PATH = $(MY_PATH)
OPENCV_INSTALL_MODULES := on
include /home/alexander/ownCloud/master/fuckarmy/MaritLage/app/src/main/cpp/opencv/sdk/native/jni/OpenCV.mk
LOCAL_MODULE := libopencv_ndk
LOCAL_CFLAGS := -Werror -Wno-write-strings -std=c++11
LOCAL_SRC_FILES := native-lib.cpp \
CV_Main.cpp \
Native_Camera.cpp \
Image_Reader.cpp
LOCAL_LDLIBS := -llog -landroid -lcamera2ndk -lmediandk
LOCAL_SHARED_LIBRARIES := libtess liblept
include $(BUILD_SHARED_LIBRARY)
Now, I'm running into a new problem.
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `~Mat':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:739: undefined reference to `cv::fastFree(void*)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `Mat':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:548: undefined reference to `cv::error(int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, char const*, char const*, int)'
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:561: undefined reference to `cv::error(int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, char const*, char const*, int)'
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:568: undefined reference to `cv::Mat::updateContinuityFlag()'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat::operator=(cv::Mat&&)':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:1416: undefined reference to `cv::fastFree(void*)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `CV_Main::detectCard(cv::Mat&)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:287: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:289: undefined reference to `cv::GaussianBlur(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:291: undefined reference to `cv::adaptiveThreshold(cv::_InputArray const&, cv::_OutputArray const&, double, int, int, int, double)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:296: undefined reference to `cv::findContours(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, int, cv::Point_<int>)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:299: undefined reference to `cv::Mat::zeros(cv::Size_<int>, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:305: undefined reference to `cv::arcLength(cv::_InputArray const&, bool)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:305: undefined reference to `cv::approxPolyDP(cv::_InputArray const&, cv::_OutputArray const&, double, bool)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:307: undefined reference to `cv::isContourConvex(cv::_InputArray const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:316: undefined reference to `cv::minAreaRect(cv::_InputArray const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:316: undefined reference to `cv::RotatedRect::boundingRect() const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:357: undefined reference to `cv::fitLine(cv::_InputArray const&, cv::_OutputArray const&, int, double, double, double)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:360: undefined reference to `cv::fitLine(cv::_InputArray const&, cv::_OutputArray const&, int, double, double, double)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:363: undefined reference to `cv::fitLine(cv::_InputArray const&, cv::_OutputArray const&, int, double, double, double)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:366: undefined reference to `cv::fitLine(cv::_InputArray const&, cv::_OutputArray const&, int, double, double, double)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:380: undefined reference to `cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:381: undefined reference to `cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:382: undefined reference to `cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:383: undefined reference to `cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:408: undefined reference to `cv::putText(cv::_InputOutputArray const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `CV_Main::drawActiveTrader(cv::Mat&)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:472: undefined reference to `cv::rectangle(cv::_InputOutputArray const&, cv::Rect_<int>, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `compareContour(std::__ndk1::vector<cv::Point_<int>, std::__ndk1::allocator<cv::Point_<int> > >, std::__ndk1::vector<cv::Point_<int>, std::__ndk1::allocator<cv::Point_<int> > >)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:142: undefined reference to `cv::minAreaRect(cv::_InputArray const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:143: undefined reference to `cv::minAreaRect(cv::_InputArray const&)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `Mat<cv::Point_<int> >':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:615: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `project_image(cv::Mat, std::__ndk1::vector<cv::Point_<int>, std::__ndk1::allocator<cv::Point_<int> > >)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:217: undefined reference to `cv::Mat::cross(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:218: undefined reference to `cv::Mat::cross(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:220: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:220: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:221: undefined reference to `cv::Mat::cross(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:222: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:222: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:224: undefined reference to `cv::operator*(double, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:224: undefined reference to `cv::operator-(cv::MatExpr const&, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:225: undefined reference to `cv::operator*(double, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:225: undefined reference to `cv::operator-(cv::MatExpr const&, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:243: undefined reference to `cv::getPerspectiveTransform(cv::Point_<float> const*, cv::Point_<float> const*, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:245: undefined reference to `cv::warpPerspective(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:252: undefined reference to `cv::Mat::t() const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:253: undefined reference to `cv::Mat::inv(int) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:254: undefined reference to `cv::Mat::inv(int) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:255: undefined reference to `cv::operator*(cv::Mat const&, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:255: undefined reference to `cv::operator*(cv::Mat const&, cv::MatExpr const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:255: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:256: undefined reference to `cv::operator*(cv::Mat const&, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:256: undefined reference to `cv::operator*(cv::Mat const&, cv::MatExpr const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:256: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:272: undefined reference to `cv::getPerspectiveTransform(cv::Point_<float> const*, cv::Point_<float> const*, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:274: undefined reference to `cv::warpPerspective(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `drawLine(cv::Mat*, cv::Vec<double, 4>, int, cv::Scalar_<double>)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:282: undefined reference to `cv::line(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `Mat':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:538: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `CV_Main::detectCardTitleImage(cv::Mat&)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:454: undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat::release()':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:851: undefined reference to `cv::Mat::deallocate()'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat::create(int, int, int)':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:831: undefined reference to `cv::Mat::create(int, int const*, int)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `MatConstIterator':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:2621: undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::MatConstIterator::operator++()':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:2716: undefined reference to `cv::MatConstIterator::seek(long, bool)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat_<double>::operator=(cv::Mat const&)':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:1709: undefined reference to `cv::Mat::reshape(int, int, int const*) const'
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:1711: undefined reference to `cv::error(int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, char const*, char const*, int)'
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:1712: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat::operator=(cv::Mat const&)':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:760: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat_<double>::operator=(cv::Mat&&)':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:2086: undefined reference to `cv::Mat::reshape(int, int, int const*) const'
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:2090: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/libopencv_ndk.so] Error 1
Now while it seems to not be able to find the compiled opencv library. What is the problem? Thanks for the help!
Why can I not find libmediandk.so with the following command in the Android.mk file:
LOCAL_LDLIBS += -lmediandk
Application.mk
NDK_TOOLCHAIN_VERSION := 4.9
APP_ABI := x86
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS += -std=c++11
LOCAL_CFLAGS += -UNDEBUG
LOCAL_LDLIBS += -lmediandk
LOCAL_LDLIBS += -OpenMAXAL
LOCAL_LDLIBS += -landroid
LOCAL_SHARED_LIBRARIES += libmediandk
LOCAL_LDLIBS += -llog
CC=/home/c/Downloads/Openglxmlfour/i686-linux-android/bin/i686-linux-android-gcc
CXX=CC=/home/c/Downloads/Openglxmlfour/i686-linux-android/bin/i686-linux-android-g++
LOCAL_MODULE := native-codec-jni # name your module here.
LOCAL_SRC_FILES := native-codec-jni.cpp looper.cpp
LOCAL_C_INCLUDES=/home/c/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86/usr/include
include $(BUILD_SHARED_LIBRARY)
Command Line
ndk-build clean && ndk-build
[x86] Clean : native-codec-jni [x86]
[x86] Clean : stdc++ [x86]
[x86] Compile++ : native-codec-jni <= native-codec-jni.cpp
[x86] Compile++ : native-codec-jni <= looper.cpp
[x86] StaticLibrary : libstdc++.a
[x86] SharedLibrary : libnative-codec-jni.so
/home/c/Android/Sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -lmediandk
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:94: error: undefined reference to 'AMediaCodec_dequeueInputBuffer'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:98: error: undefined reference to 'AMediaCodec_getInputBuffer'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:99: error: undefined reference to 'AMediaExtractor_readSampleData'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:105: error: undefined reference to 'AMediaExtractor_getSampleTime'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:108: error: undefined reference to 'AMediaCodec_queueInputBuffer'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:109: error: undefined reference to 'AMediaExtractor_advance'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:115: error: undefined reference to 'AMediaCodec_dequeueOutputBuffer'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:129: error: undefined reference to 'AMediaCodec_releaseOutputBuffer'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:137: error: undefined reference to 'AMediaCodec_getOutputFormat'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:138: error: undefined reference to 'AMediaFormat_toString'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:139: error: undefined reference to 'AMediaFormat_delete'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:172: error: undefined reference to 'AMediaExtractor_seekTo'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:173: error: undefined reference to 'AMediaCodec_flush'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:161: error: undefined reference to 'AMediaCodec_stop'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:162: error: undefined reference to 'AMediaCodec_delete'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:163: error: undefined reference to 'AMediaExtractor_delete'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:237: error: undefined reference to 'AMediaExtractor_new'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:240: error: undefined reference to 'AMediaExtractor_setDataSourceFd'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:247: error: undefined reference to 'AMediaExtractor_getTrackCount'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:275: error: undefined reference to 'AMediaFormat_delete'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:253: error: undefined reference to 'AMediaExtractor_getTrackFormat'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:254: error: undefined reference to 'AMediaFormat_toString'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:257: error: undefined reference to 'AMEDIAFORMAT_KEY_MIME'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:257: error: undefined reference to 'AMediaFormat_getString'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:263: error: undefined reference to 'AMediaExtractor_selectTrack'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:264: error: undefined reference to 'AMediaCodec_createDecoderByType'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:265: error: undefined reference to 'AMediaCodec_configure'
/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/jni/native-codec-jni.cpp:273: error: undefined reference to 'AMediaCodec_start'
collect2: error: ld returned 1 exit status
make: *** [/home/c/Downloads/android-ndk-master2/MyApplication/app/src/main/obj/local/x86/libnative-codec-jni.so] Error 1
libmediandk was first added to android-21 (https://android-review.googlesource.com/#/c/278674/1/media/ndk/Android.bp). You haven't stated an APP_PLATFORM in your Application.mk, so you're defaulting to android-9.
To get access to libmediandk, set APP_PLATFORM := android-21 in your Application.mk. Note that this will make Lollipop the minimum supported platform for your application.
I'm building an integration with the V8 library. This builds works fine for ARM (armeabi, armeabi-v7a) targets.
I want to add x86 support. Today is the first time I've tried this.
I built V8 for x86 via make ia32.release.
My Application.mk is as follows:
APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-14
APP_STL := stlport_static
and Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := v8_libbase
LOCAL_SRC_FILES := ./libs/$(TARGET_ARCH_ABI)/libv8_libbase.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := v8_base
LOCAL_SRC_FILES := ./libs/$(TARGET_ARCH_ABI)/libv8_base.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := v8_nosnapshot
LOCAL_SRC_FILES := ./libs/$(TARGET_ARCH_ABI)/libv8_nosnapshot.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := v8_platform
LOCAL_SRC_FILES := ./libs/$(TARGET_ARCH_ABI)/libv8_libplatform.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := v8jsevaluator
LOCAL_SRC_FILES := v8jsevaluator.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/
LOCAL_LDLIBS := -llog -landroid
LOCAL_STATIC_LIBRARIES := v8_base v8_nosnapshot v8_libbase v8_platform
LOCAL_CPP_FEATURES += exceptions
LOCAL_CFLAGS += -std=c++11
include $(BUILD_SHARED_LIBRARY)
The build fails in the x86 component with a lot of errors relating to STL.
12:13:39 **** Incremental Build of configuration Default for project v8jsevaluator ****
"C:\\Development\\android-ndk-r10d\\ndk-build.cmd" all
Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
[armeabi] Install : libv8jsevaluator.so => libs/armeabi/libv8jsevaluator.so
[armeabi-v7a] Install : libv8jsevaluator.so => libs/armeabi-v7a/libv8jsevaluator.so
[x86] SharedLibrary : libv8jsevaluator.so
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) [clone .part.30]: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::ostream& std::ostream::_M_insert<void const*>(void const*)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(bootstrapper.o):bootstrapper.cc:function std::vector<unsigned char, std::allocator<unsigned char> >::resize(unsigned int): error: undefined reference to 'std::__throw_length_error(char const*)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) [clone .part.32]: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::CallFunctionStub::PrintName(std::ostream&) const: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::CallFunctionStub::PrintName(std::ostream&) const: error: undefined reference to 'std::ostream::operator<<(int)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::CodeStub::PrintBaseName(std::ostream&) const: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/Development/android-ndk-r10d/toolchains/x86-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.8/../../../../i686-linux-android/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/Development/android-ndk-r10d/toolchains/x86-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.8/../../../../i686-linux-android/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage'
<snipped for brevity>
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::FPrint(_IO_FILE*, char const*, ...): error: undefined reference to '__vfprintf_chk'
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::VFPrint(_IO_FILE*, char const*, char*): error: undefined reference to '__vfprintf_chk'
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::SNPrintF(char*, int, char const*, ...): error: undefined reference to '__vsnprintf_chk'
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::VSNPrintF(char*, int, char const*, char*): error: undefined reference to '__vsnprintf_chk'
jni/./libs/x86/libv8_libplatform.a(default-platform.o):default-platform.cc:function void std::deque<v8::Task*, std::allocator<v8::Task*> >::_M_push_back_aux<v8::Task* const&>(v8::Task* const&): error: undefined reference to 'std::__throw_bad_alloc()'
collect2.exe: error: ld returned 1 exit status
make.exe: *** [obj/local/x86/libv8jsevaluator.so] Error 1
12:13:41 Build Finished (took 1s.821ms)
As I said, without the attempt to build x86, this is all OK.
Please can anyone point me at where I'm going wrong? Thanks!
I upgraded my source of V8 from 4.1.0.22 to 4.9.385.30 and - after solving a lot of other issues - this problem went away.
Can you help me, please?
I am doing the next changes to support c++11 with opencv 3 in android NDK:
I change from APP_STL := gnustl_static to APP_STL := c++_static
Application.mk
APP_STL := c++_static
APP_CPPFLAGS := -std=c++11 -frtti -fexceptions
APP_ABI := armeabi armeabi-v7a mips x86 arm64-v8a x86_64 mips64
APP_PLATFORM := android-14
# use this to select gcc instead of clang
NDK_TOOLCHAIN_VERSION := 4.9
Android.mk
LOCAL_PATH := $(call my-dir)
LOCAL_PATH_LIB_DIR:=library/lib/classifier
include $(CLEAR_VARS)
OPENCV_CAMERA_MODULES:=off
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=SHARED
include ../../../OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
LOCAL_MODULE:= detection_based_tracker
LOCAL_SRC_FILES := DetectionBasedTracker_jni.cpp \
library/jniUtils.cpp \
${ LOCAL_PATH_LIB_DIR}/logic.cpp \
${ LOCAL_PATH_LIB_DIR}/logic2.cpp \
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS += -llog -ldl -lm -latomic -L$(LOCAL_PATH)/libs/armeabi
- L$(LOCAL_PATH)/libs/armeabi-v7a -L$(LOCAL_PATH)/libs/mips
-L$(LOCAL_PATH)/libs/x86 -L$(LOCAL_PATH)/libs/arm64-v8a
-L$(LOCAL_PATH)/libs/mips64
-L$(LOCAL_PATH)/libs/x86_64
LOCAL_CPPFLAGS += -ljnigraphics -D_LINUX -DBOOST_HAS_PTHREADS -fexceptions -std=c++11
-I$(LOCAL_PATH)/ -I$(LOCAL_PATH)/library/lib/pico/ I
LOCAL_CPP_FEATURES := exceptions rtti
APP_OPTIM := debug
include $(BUILD_SHARED_LIBRARY)
When I compile the Android app with Android NDK r10e. I have the next errores in the Log:
' [armeabi-v7a] SharedLibrary : libdetection_based_tracker.so
/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++
-Wl,-soname,libdetection_based_tracker.so -shared --sysroot=/android/sdk/ndk-bundle/platforms/android-8/arch-arm ./obj/local/armeabi-v7a/objs/detection_based_tracker/DetectionBasedTracker_jni.o
./obj/local/armeabi-v7a/objs/detection_based_tracker/detection-manager/jniUtils.o
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/liblibpng.a
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/liblibtiff.a
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/liblibjasper.a
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libIlmImf.a
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a
/android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/thumb/libc++_static.a
-lgcc -no-canonical-prefixes -march=armv7-a -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -L/android/sdk/ndk-bundle/platforms/android-8/arch-arm/usr/lib -lz -ldl -lm -llog -llog -ldl -lm -latomic -Ljni/libs/armeabi -Ljni/libs/armeabi-v7a -Ljni/libs/mips -Ljni/libs/x86 -Ljni/libs/arm64-v8a -Ljni/libs/mips64 -Ljni/libs/x86_64 -lc -lm -o ./obj/local/armeabi-v7a/libdetection_based_tracker.so
jni/detection-manager/lib/pico/uniqueness2.cpp:240: error: undefined
reference to 'cv::DescriptorMatcher::match(cv::_InputArray const&,
cv::_InputArray const&, std::__1::vector >&, cv::_InputArray const&) const'
jni/detection-manager/lib/pico/motiondetector.cpp:77: error: undefined
reference to 'cv::Subdiv2D::insert(std::__1::vector,
std::__1::allocator > > const&)'
jni/detection-manager/lib/counting-blobs/jniUtils.cpp:995: error:
undefined reference to 'cv::imwrite(cv::String const&, cv::_InputArray
const&, std::__1::vector > const&)'
jni/detection-manager/lib/counting-blobs/jniUtils.cpp:996: error:
undefined reference to 'cv::imwrite(cv::String const&, cv::_InputArray
const&, std::__1::vector > const&)'
jni/detection-manager/lib/counting-blobs/jniUtils.cpp:1004: error:
undefined reference to 'cv::imwrite(cv::String const&, cv::_InputArray
const&, std::__1::vector > const&)'
jni/detection-manager/lib/counting-blobs/jniUtils.cpp:1005: error:
undefined reference to 'cv::imwrite(cv::String const&, cv::_InputArray
const&, std::__1::vector > const&)'
jni/detection-manager/lib/counting-blobs/jniUtils.cpp:1153: error:
undefined reference to
'cv::DescriptorMatcher::knnMatch(cv::_InputArray const&,
cv::_InputArray const&, std::__1::vector >,
std::__1::allocator > > >&, int, cv::_InputArray const&,
bool) const'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_objdetect.a(cascadedetect.cpp.o):cascadedetect.cpp:function
cv::LBPEvaluator::setWindow(cv::Point_, int): error: undefined
reference to 'std::__throw_out_of_range(char const*)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_objdetect.a(cascadedetect.cpp.o):cascadedetect.cpp:function
cv::HaarEvaluator::setWindow(cv::Point_, int): error: undefined
reference to 'std::__throw_out_of_range(char const*)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_objdetect.a(cascadedetect.cpp.o):cascadedetect.cpp:function
cv::HaarEvaluator::computeChannels(int, cv::_InputArray const&):
error: undefined reference to 'std::__throw_out_of_range(char const*)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_objdetect.a(cascadedetect.cpp.o):cascadedetect.cpp:function
cv::LBPEvaluator::computeChannels(int, cv::_InputArray const&): error:
undefined reference to 'std::__throw_out_of_range(char const*)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_objdetect.a(cascadedetect.cpp.o):cascadedetect.cpp:function
std::vector >::resize(unsigned int, int):
error: undefined reference to 'std::__throw_length_error(char const*)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_objdetect.a(cascadedetect.cpp.o):cascadedetect.cpp:function
std::vector >::resize(unsigned int,
double): error: undefined reference to 'std::__throw_length_error(char
const*)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_objdetect.a(cascadedetect.cpp.o):cascadedetect.cpp:function
std::vector >::reserve(unsigned int):
error: undefined reference to 'std::__throw_length_error(char const*)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_objdetect.a(cascadedetect.cpp.o):cascadedetect.cpp:function
std::vector
::reserve(unsigned int): error: undefined reference to 'std::__throw_length_error(char const*)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_flann.a(miniflann.cpp.o):miniflann.cpp:function
cvflann::LshIndex >::getNeighbors(float const*,
cvflann::ResultSet&): error: undefined reference to
'std::__throw_bad_cast()'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_flann.a(miniflann.cpp.o):miniflann.cpp:function
cvflann::LshIndex >::getNeighbors(float const*,
cvflann::ResultSet&): error: undefined reference to 'std::cerr'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_flann.a(miniflann.cpp.o):miniflann.cpp:function
std::_Rb_tree > >,
std::_Select1st > > >, std::less,
std::allocator > > >
::_M_insert_unique_(std::_Rb_tree_const_iterator > >
, std::pair > > const&): error: undefined reference
to 'std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_flann.a(miniflann.cpp.o):miniflann.cpp:function
cvflann::AutotunedIndex >::buildIndex(): error:
undefined reference to 'std::basic_ostringstream, std::allocator
::basic_ostringstream(std::_Ios_Openmode)' ../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_flann.a(miniflann.cpp.o):miniflann.cpp:function
cvflann::AutotunedIndex >::buildIndex(): error:
undefined reference to 'std::basic_stringbuf, std::allocator >::str() const' .
/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld:
the vtable symbol may be undefined because the class is missing its
key function
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_flann.a(miniflann.cpp.o):miniflann.cpp:function
cvflann::AutotunedIndex >::buildIndex(): error:
undefined reference to 'vtable for std::basic_stringbuf, std::allocator >'
/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld:
the vtable symbol may be undefined because the class is missing its
key function
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
std::basic_stringbuf,
std::allocator >::~basic_stringbuf(): error: undefined reference
to 'vtable for std::basic_streambuf >'
/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld:
the vtable symbol may be undefined because the class is missing its
key function
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
std::basic_stringbuf,
std::allocator >::~basic_stringbuf(): error: undefined reference
to 'std::locale::~locale()'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
std::basic_stringbuf,
std::allocator >::~basic_stringbuf(): error: undefined reference
to 'std::string::_Rep::_S_empty_rep_storage'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
std::basic_stringbuf,
std::allocator >::~basic_stringbuf(): error: undefined reference
to 'vtable for std::basic_stringbuf,
std::allocator >'
/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld:
the vtable symbol may be undefined because the class is missing its
key function
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
std::basic_stringbuf,
std::allocator >::~basic_stringbuf(): error: undefined reference
to 'vtable for std::basic_streambuf >'
/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld:
the vtable symbol may be undefined because the class is missing its
key function
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
std::string cv::ocl::kerToStr(cv::Mat const&): error: undefined
reference to 'std::basic_ostringstream,
std::allocator >::basic_ostringstream(std::_Ios_Openmode)' .
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::find(char const*, unsigned int, unsigned int) const'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::_M_leak_hard()'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::basic_string, std::allocator
::basic_string(char const*, std::allocator const&)' ../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::basic_string, std::allocator
::basic_string(char const*, std::allocator const&)' ../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::basic_string, std::allocator
::basic_string(char const*, std::allocator const&)' ../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::_M_leak_hard()'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::_M_leak_hard()'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::_M_leak_hard()'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::compare(char const*) const'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::compare(char const*) const'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::compare(char const*) const'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::find(char const*, unsigned int, unsigned int) const'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::compare(char const*) const'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::basic_ostream >& std::endl >(std::basic_ostream >&)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::basic_ostream >& std::endl >(std::basic_ostream >&)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::basic_ostream >& std::endl >(std::basic_ostream >&)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::basic_ostream >& std::endl >(std::basic_ostream >&)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::assign(std::string const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::Context::Impl::setDefault(): error: undefined reference to
'std::string::assign(std::string const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function
cv::ocl::OpenCLBufferPoolImpl::_allocateBufferEntry(cv::ocl::CLBufferEntry&,
unsigned int): error: undefined reference to
'std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libIlmImf.a(half.cpp.o):half.cpp:function
operator>>(std::istream&, half&): error: undefined reference to
'std::istream& std::istream::_M_extract(float&)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libIlmImf.a(ImfChannelList.cpp.o):ImfChannelList.cpp:function
Imf::ChannelList::operator[](char const*): error: undefined reference
to 'std::basic_stringstream,
std::allocator >::basic_stringstream(std::_Ios_Openmode)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libIlmImf.a(ImfChannelList.cpp.o):ImfChannelList.cpp:function
Imf::ChannelList::operator[](char const*): error: undefined reference
to 'std::basic_stringstream,
std::allocator >::~basic_stringstream()' .
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function
tbb::internal::throw_exception_v4(tbb::internal::exception_id): error:
undefined reference to 'std::out_of_range::out_of_range(std::string
const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function
tbb::internal::throw_exception_v4(tbb::internal::exception_id): error:
undefined reference to 'std::range_error::range_error(std::string
const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function
tbb::internal::throw_exception_v4(tbb::internal::exception_id): error:
undefined reference to 'std::range_error::range_error(std::string
const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function
tbb::internal::throw_exception_v4(tbb::internal::exception_id): error:
undefined reference to 'std::runtime_error::runtime_error(std::string
const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function
tbb::internal::throw_exception_v4(tbb::internal::exception_id): error:
undefined reference to 'std::runtime_error::runtime_error(std::string
const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function
tbb::internal::throw_exception_v4(tbb::internal::exception_id): error:
undefined reference to 'std::out_of_range::out_of_range(std::string
const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function
tbb::internal::throw_exception_v4(tbb::internal::exception_id): error:
undefined reference to 'std::out_of_range::out_of_range(std::string
const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function
tbb::internal::throw_exception_v4(tbb::internal::exception_id): error:
undefined reference to
'std::invalid_argument::invalid_argument(std::string const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function
tbb::internal::throw_exception_v4(tbb::internal::exception_id): error:
undefined reference to 'std::length_error::length_error(std::string
const&)'
../../../OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function
tbb::internal::throw_exception_v4(tbb::internal::exception_id): error:
undefined reference to 'std::out_of_range::out_of_range(std::string
const&)' collect2: error: ld returned 1 exit status make: ***
[obj/local/armeabi-v7a/libdetection_based_tracker.so] Error 1
I have a game that I want to deploy on both android and ios. The ios version works fine, its compiled without errors. But when I run the build_native.py I got undefined error. I'll include my codes and the error message below. Thank in advance.
CODE
#ifndef __SETTING_SCENE_H__
#define __SETTING_SCENE_H__
#include "cocos2d.h"
#include "ui/CocosGUI.h"
USING_NS_CC;
using namespace ui;
class SettingScreen : public cocos2d::Layer {
public:
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* createScene();
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// implement the "static create()" method manually
CREATE_FUNC(SettingScreen);
int fontSize = 18;
int bgmVolume = 100;
int sfxVolume = 100;
void Back(Ref *pSender);
void BgmSliderEvent(Ref *pSender, Slider::EventType type);
void SfxSliderEvent(Ref *pSender, Slider::EventType type);
};
#endif // __SETTING_SCENE_H__
ERROR
The Selected NDK toolchain version was 4.8 !
Android NDK: WARNING:jni/../../cocos2d/cocos/./Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
Android NDK: WARNING:jni/../../cocos2d/cocos/platform/android/Android.mk:cocos2dxandroid_static: LOCAL_LDLIBS is always ignored for static libraries
make: Entering directory `/cocos2dx/TestGame/proj.android'
[armeabi] SharedLibrary : libcocos2dcpp.so
jni/../../Classes/Scenes/SettingScene.cpp:72: error: undefined reference to 'cocos2d::ui::Slider::create()'
jni/../../Classes/Scenes/SettingScene.cpp:73: error: undefined reference to 'cocos2d::ui::Slider::loadBarTexture(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cocos2d::ui::Widget::TextureResType)'
jni/../../Classes/Scenes/SettingScene.cpp:74: error: undefined reference to 'cocos2d::ui::Slider::loadSlidBallTextures(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cocos2d::ui::Widget::TextureResType)'
jni/../../Classes/Scenes/SettingScene.cpp:80: error: undefined reference to 'cocos2d::ui::Slider::setPercent(int)'
jni/../../Classes/Scenes/SettingScene.cpp:81: error: undefined reference to 'cocos2d::ui::Slider::addEventListener(std::__1::function<void (cocos2d::Ref*, cocos2d::ui::Slider::EventType)> const&)'
jni/../../Classes/Scenes/SettingScene.cpp:91: error: undefined reference to 'cocos2d::ui::Slider::create()'
jni/../../Classes/Scenes/SettingScene.cpp:92: error: undefined reference to 'cocos2d::ui::Slider::loadBarTexture(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cocos2d::ui::Widget::TextureResType)'
jni/../../Classes/Scenes/SettingScene.cpp:93: error: undefined reference to 'cocos2d::ui::Slider::loadSlidBallTextures(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cocos2d::ui::Widget::TextureResType)'
jni/../../Classes/Scenes/SettingScene.cpp:99: error: undefined reference to 'cocos2d::ui::Slider::setPercent(int)'
jni/../../Classes/Scenes/SettingScene.cpp:100: error: undefined reference to 'cocos2d::ui::Slider::addEventListener(std::__1::function<void (cocos2d::Ref*, cocos2d::ui::Slider::EventType)> const&)'
jni/../../Classes/Scenes/SettingScene.cpp:113: error: undefined reference to 'cocos2d::ui::Slider::getPercent() const'
jni/../../Classes/Scenes/SettingScene.cpp:116: error: undefined reference to 'typeinfo for cocos2d::ui::Slider'
jni/../../Classes/Scenes/SettingScene.cpp:121: error: undefined reference to 'cocos2d::ui::Slider::getPercent() const'
jni/../../Classes/Scenes/SettingScene.cpp:124: error: undefined reference to 'typeinfo for cocos2d::ui::Slider'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/armeabi/libcocos2dcpp.so] Error 1
make: Leaving directory `/cocos2dx/TestGame/proj.android'
Traceback (most recent call last):
File "TestGame/proj.android/build_native.py", line 159, in <module>
build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
File "TestGame/proj.android/build_native.py", line 146, in build
do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
File "TestGame/proj.android/build_native.py", line 82, in do_build
raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
Exception: Build dynamic library for project [ /cocos2dx/TestGame/proj.android ] fails!
You should replace your Android.mk file under proj.android directory with the following code:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos)
LOCAL_MODULE := cocos2dcpp_shared
LOCAL_MODULE_FILENAME := libcocos2dcpp
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_ui_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,.)
$(call import-module,audio/android)
$(call import-module,ui)
Pay attention to the LOCAL_WHOLE_STATIC_LIBRARIES += cocos_ui_static and $(call import-module,ui). These two lines add the ui dependency to your project.