I'm tryng to port an iOS game to Android platform with cocos2dx 2.0.4.
The core of the game is written in c++ and we managed to run it on iOS, in fact the game is avaivable on the Apple Store.
I'm using NDK r8d and lastest SDK, but I'm encountering a lot of issues when trying to build.
My application.mk is like this:
APP_STL := stlport_shared
APP_CPPFLAGS := -frtti
NDK_TOOLCHAIN_VERSION=4.7
Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
ifdef STLG
LOCAL_MODULE := stlport_stlg
else
LOCAL_MODULE := stlport
endif
LOCAL_CFLAGS += -D__ANDROID__ \
-isystem $(SYSROOT)/usr/include \
LOCAL_MODULE := game_shared
LOCAL_MODULE_FILENAME := libgame
LOCAL_CPPFLAGS += -fexceptions
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes $(LOCAL_PATH)/../../../../Box2D $(LOCAL_PATH)/../../../../cocos2dx $(LOCAL_PATH)/../../../../
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,CocosDenshion/android) \
$(call import-module,cocos2dx) \
$(call import-module,extensions)
Here's the console log (only errors displayed):
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_alloc.h:158: error: undefined reference to 'std::__node_alloc::_M_allocate(unsigned int&)'
make: Leaving directory `/Users/arianna/android/cocos2d-2.0-x-2.0.4/grannnnnnny/proj.android'
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_alloc.h:161: error: undefined reference to 'std::__node_alloc::_M_deallocate(void*, unsigned int)'
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_string.c:600: error: undefined reference to 'std::__stl_throw_length_error(char const*)'
/Users/arianna/android/cocos2d-2.0-x-2.0.4/grannnnnnny/proj.android/../../cocos2dx/actions/CCActionInterval.cpp:386: error: undefined reference to '__dynamic_cast'
/Users/arianna/android/cocos2d-2.0-x-2.0.4/grannnnnnny/proj.android/../../cocos2dx/actions/CCActionInterval.cpp:1783: error: undefined reference to '__dynamic_cast'
/Users/arianna/android/cocos2d-2.0-x-2.0.4/grannnnnnny/proj.android/../../cocos2dx/actions/CCActionInterval.cpp:1838: error: undefined reference to '__dynamic_cast'
/Users/arianna/android/cocos2d-2.0-x-2.0.4/grannnnnnny/proj.android/../../cocos2dx/actions/CCActionInterval.cpp:1906: error: undefined reference to '__dynamic_cast'
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_vector.c:41: error: undefined reference to 'std::__stl_throw_length_error(char const*)'
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_vector.c:45: error: undefined reference to 'std::__stl_throw_out_of_range(char const*)'
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_string.c:604: error: undefined reference to 'std::__stl_throw_out_of_range(char const*)'
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_vector.c:41: error: undefined reference to 'std::__stl_throw_length_error(char const*)'
./obj/local/armeabi/libcocos2d.a(CCDirector.o):CCDirector.cpp:function typeinfo for cocos2d::CCDirector: error: undefined reference to 'vtable for __cxxabiv1::__vmi_class_type_info'
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_vector.c:41: error: undefined reference to 'std::__stl_throw_length_error(char const*)'
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi/libgame.so] Error 1
Any help much appreciated, thanks...
Try this in application.mk APP_STL := gnustl_static?
You get the above undefined reference error because you have not added the necessary libraries in Android.mk files. It looks something like this
LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/$(TARGET_ARCH_ABI)) \
-lcocos2d -lGLESv1_CM -llog -lgame_logic
I am stuck with this issue even after adding the libraries. Its got something to do with setting path but I dont know how to..
If you solve this let me know
Related
I'm writing an executable for android, and in it I use std::stringstream.
Therefore, I include the library <sstream>, and when I compile my code, I get the following linker errors:
external/libcxx/include/streambuf:220: error: undefined reference to 'std::__1::locale::~locale()'
external/libcxx/include/ios:661: error: undefined reference to 'std::__1::ios_base::~ios_base()'
external/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
external/libcxx/include/ostream:260: error: undefined reference to 'std::uncaught_exception()'
external/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
external/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
external/libcxx/include/istream:291: error: undefined reference to 'std::__1::ios_base::getloc() const'
external/libcxx/include/__locale:186: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
external/libcxx/include/istream:291: error: undefined reference to 'std::__1::locale::~locale()'
external/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
external/libcxx/include/istream:304: error: undefined reference to 'std::__1::ctype<char>::id'
external/libcxx/include/ios:668: error: undefined reference to 'std::__1::ios_base::init(void*)'
external/libcxx/include/streambuf:370: error: undefined reference to 'std::__1::locale::locale()'
collect2: error: ld returned 1 exit status
I don't know what I did wrong.. all the other STL classes worked fine until now.
Here is the project's Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS += -std=c++11 -w
LOCAL_MODULE := my_module
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/includes
LOCAL_MODULE_TAGS := eng debug optional
LOCAL_LDFLAGS := -static
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_SRC_FILES += \
file_a.c \
file_b.c \
file_c.c
LOCAL_SRC_FILES += \
file_1.cpp \
file_2.cpp \
file_3.cpp
LOCAL_STATIC_LIBRARIES := \
liblog \
libc
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
include $(BUILD_EXECUTABLE)
Am I missing something?
I have a problem when creating an executable with ndk using the BOOST libraries in c ++ using already mentioned ndk, this is the problem
C:\Users\GENERAL\Downloads\Compressed\tcpproxy\proxy\jni>ndk-build
[armeabi] Compile++ thumb: proxy <= tcpproxy_server.cpp
[armeabi] Executable : proxy
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/sys
tem/error_code.hpp:322: error: undefined reference to 'boost::system::system_cat
egory()'
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/thr
ead/exceptions.hpp:51: error: undefined reference to 'boost::system::system_cate
gory()'
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/asi
o/error.hpp:225: error: undefined reference to 'boost::system::system_category()
'
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/asi
o/error.hpp:225: error: undefined reference to 'boost::system::system_category()
'
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/sys
tem/error_code.hpp:221: error: undefined reference to 'boost::system::generic_ca
tegory()'
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/sys
tem/error_code.hpp:222: error: undefined reference to 'boost::system::generic_ca
tegory()'
collect2.exe: error: ld returned 1 exit status
make.exe: *** [C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//obj/local/a
rmeabi/proxy] Error 1
Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/boost_1_56_0 #patch of include BOOST
LOCAL_MODULE := proxy
LOCAL_SRC_FILES := tcpproxy_server.cpp
include $(BUILD_EXECUTABLE)
Application.mk
APP_CFLAGS += -fexceptions
APP_STL := gnustl_static
NDK_TOOLCHAIN_VERSION := 4.8
APP_CPPFLAGS := -std=c++11
that is the error that I get when compiling. already investigate but can not find the solution so please thank your answer to be able to repair it and because generating that error thanks
You may need to add the boost_system library. You can add -lboost_system to your linker flags to find related library symbols in Android.mk (Assuming that boost is built as static):
LOCAL_STATIC_LIBRARIES = -lboost_system ...
include $(BUILD_STATIC_LIBRARY)
I am new in NDK and i want to use a c library in my application. I try with a simple c file and it work. I succeded to send and receive data between the two api. But when i want to introduce an existing c library i have this kind of error when i run ndk-build.
root#xxx:~/workspace/Myproject# ndk-build
Android NDK: WARNING: APP_PLATFORM android-16 is larger than android:minSdkVersion 8 in /root/workspace/MyOpus/AndroidManifest.xml
[armeabi-v7a] Compile thumb : my_manager <= myencoder.c
[armeabi-v7a] SharedLibrary : libmy_manager.so
/usr/local/mes_installations/android_tool/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi-v7a/libopus.so: incompatible target
/usr/local/mes_installations/android_tool/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/objs/my_manager/src/myencoder.o: in function myEncodeOpus:/root/workspace/MyOpus/jni/src/myencoder.c:81: error: undefined reference to 'opus_encoder_create'
/usr/local/mes_installations/android_tool/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/objs/my_manager/src/myencoder.o: in function myEncodeOpus:/root/workspace/MyOpus/jni/src/myencoder.c:84: error: undefined reference to 'opus_strerror'
/usr/local/mes_installations/android_tool/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/objs/my_manager/src/myencoder.o: in function myEncodeOpus:/root/workspace/MyOpus/jni/src/myencoder.c:93: error: undefined reference to 'opus_encoder_ctl'
/usr/local/mes_installations/android_tool/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/objs/my_manager/src/myencoder.o: in function myEncodeOpus:/root/workspace/MyOpus/jni/src/myencoder.c:96: error: undefined reference to 'opus_strerror'
/usr/local/mes_installations/android_tool/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/objs/my_manager/src/myencoder.o: in function myEncodeOpus:/root/workspace/MyOpus/jni/src/myencoder.c:120: error: undefined reference to 'opus_encode'
/usr/local/mes_installations/android_tool/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/objs/my_manager/src/myencoder.o: in function myEncodeOpus:/root/workspace/MyOpus/jni/src/myencoder.c:123: error: undefined reference to 'opus_strerror'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi-v7a/libmy_manager.so] Error 1
How can i solve this problem? I read all the Android.mk documentation but i did not see any thing to solve it. Regards
you said you succeed to create shared library libmy_manager . in Android.mk specify the path of libmy_manager.so and the path of header files
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libmy_manager
LOCAL_SRC_FILES := libmy_manager.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include #path of header file with define
# function in libmy_manager
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := my_manager
LOCAL_SRC_FILES := my_manager.c
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_SHARED_LIBRARIES := libmy_manager
include $(BUILD_SHARED_LIBRARY)
I had been trying to solve this issue for quiet a long time,I am using a library called FreeImage and when tries to do the NDK build the code results in following error
My source can be downloaded from
copy.html">http://www.4shared.com/zip/1C3vpLI7/android-imagefilter-ndk_copy.html
Thanking you in advance for your valuable efforts-
tribute.cpp+0x8): undefined reference to `std::ios_base::Init::Init()'
ImfChromaticitiesAttribute.cpp:(.text.startup._GLOBAL__sub_I_ImfChromaticitiesAttribute.cpp+0x24): undefined reference to `std::ios_base::Init::~Init()'
/home/flock/ANDROID/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: Dwarf Error: mangled line number section.
./obj/local/armeabi/libfreeimage.a(ImfCompressionAttribute.o): In function `_GLOBAL__sub_I_ImfCompressionAttribute.cpp':
ImfCompressionAttribute.cpp:(.text.startup._GLOBAL__sub_I_ImfCompressionAttribute.cpp+0x8): undefined reference to `std::ios_base::Init::Init()'
ImfCompressionAttribute.cpp:(.text.startup._GLOBAL__sub_I_ImfCompressionAttribute.cpp+0x24): undefined reference to `std::ios_base::Init::~Init()'
./obj/local/armeabi/libfreeimage.a(ImfCompressor.o): In function `Imf::newCompressor(Imf::Compression, unsigned int, Imf::Header const&)':
ImfCompressor.cpp:(.text._ZN3Imf13newCompressorENS_11CompressionEjRKNS_6HeaderE+0x10): undefined reference to `__gnu_thumb1_case_uqi'
ImfCompressor.cpp:(.text._ZN3Imf13newCompressorENS_11CompressionEjRKNS_6HeaderE+0xb8): undefined reference to `__cxa_end_cleanup'
./obj/local/armeabi/libfreeimage.a(ImfCompressor.o):(.ARM.extab.text._ZN3Imf13newCompressorENS_11CompressionEjRKNS_6HeaderE+0x0): undefined reference to `__gxx_personality_v0'
./obj/local/armeabi/libfreeimage.a(ImfCompressor.o): In function `Imf::newTileCompressor(Imf::Compression, unsigned int, unsigned int, Imf::Header const&)':
ImfCompressor.cpp:(.text._ZN3Imf17newTileCompressorENS_11CompressionEjjRKNS_6HeaderE+0x12): undefined reference to `__gnu_thumb1_case_uqi'
ImfCompressor.cpp:(.text._ZN3Imf17newTileCompressorENS_11CompressionEjjRKNS_6HeaderE+0x64): undefined reference to `__cxa_allocate_exception'
ImfCompressor.cpp:(.text._ZN3Imf17newTileCompressorENS_11CompressionEjjRKNS_6HeaderE+0x8a): undefined reference to `__cxa_throw'
ImfCompressor.cpp:(.text._ZN3Imf17newTileCompressorENS_11CompressionEjjRKNS_6HeaderE+0xe4): undefined reference to `__cxa_end_cleanup'
./obj/local/armeabi/libfreeimage.a(ImfCompressor.o):(.ARM.extab.text._ZN3Imf17newTileCompressorENS_11CompressionEjjRKNS_6HeaderE+0x0): undefined reference to `__gxx_personality_v0'
./obj/local/armeabi/libfreeimage.a(ImfCompressor.o): In function `_GLOBAL__sub_I_ImfCompressor.cpp':
ImfCompressor.cpp:(.text.startup._GLOBAL__sub_I_ImfCompressor.cpp+0x8): undefined reference to `std::ios_base::Init::Init()'
ImfCompressor.cpp:(.text.startup._GLOBAL__sub_I_ImfCompressor.cpp+0x24): undefined reference to `std::ios_base::Init::~Init()'
./obj/local/armeabi/libfreeimage.a(ImfCompressor.o):(.data.rel.ro+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/home/flock/ANDROID/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: Dwarf Error: mangled line number section.
./obj/local/armeabi/libfreeimage.a(ImfConvert.o): In function `_GLOBAL__sub_I_ImfConvert.cpp':
ImfConvert.cpp:(.text.startup._GLOBAL__sub_I_ImfConvert.cpp+0x8): undefined reference to `std::ios_base::Init::Init()'
ImfConvert.cpp:(.text.startup._GLOBAL__sub_I_ImfConvert.cpp+0x24): undefined reference to `std::ios_base::Init::~Init()'
/home/flock/ANDROID/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: Dwarf Error: mangled line number section.
./obj/local/armeabi/libfreeimage.a(ImfDoubleAttribute.o): In function `_GLOBAL__sub_I_ImfDoubleAttribute.cpp':
ImfDoubleAttribute.cpp:(.text.startup._GLOBAL__sub_I_ImfDoubleAttribute.cpp+0x8): undefined reference to `std::ios_base::Init::Init()'
ImfDoubleAttribute.cpp:(.text.startup._GLOBAL__sub_I_ImfDoubleAttribute.cpp+0x24): undefined reference to `std::ios_base::Init::~Init()'
/home/flock/ANDROID/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: Dwarf Error: mangled line number section.
./obj/local/armeabi/libfreeimage.a(ImfEnvmapAttribute.o): In function `_GLOBAL__sub_I_ImfEnvmapAttribute.cpp':
ImfEnvmapAttribute.cpp:(.text.startup._GLOBAL__sub_I_ImfEnvmapAttribute.cpp+0x8): undefined reference to `std::ios_base::Init::Init()'
ImfEnvmapAttribute.cpp:(.text.startup._GLOBAL__sub_I_ImfEnvmapAttribute.cpp+0x24): undefined reference to `std::ios_base::Init::~Init()'
My Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= freeimage
LOCAL_SRC_FILES :=libfreeimage.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE:= imageprocessing
LOCAL_SRC_FILES:= imageprocessing.c
LOCAL_STATIC_LIBRARIES = freeimage
LOCAL_EXPORT_C_INCLUDES := freeimage.h
LOCAL_LDLIBS:= -lm -llog -ljnigraphics
include $(BUILD_SHARED_LIBRARY)
My application.mk
APP_OPTIM := release
APP_PLATFORM := android-8
APP_STL := gnustl_static
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DANDROID
APP_ABI:= armeabi
I think you are seeing a bug in gcc/NDK that manifests itself slightly differently on Linux, Cygwin, and Windows (non Cygwin).
Here's what I did to fix it (works for Linux and for one of my developers who is blind and has to use Cygwin)...
- Remove the line that says, APP_STL := gnustl_static from your Application.mk (it's broken in the NDK; moreover, it's broken slightly differently on Linux Cygwin, Windows)
- add three lines to Andriod.mk that say,
LOCAL_C_INCLUDES := $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/include
LOCAL_C_INCLUDES += $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include
$(LOCAL_LDLIBS) += $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a
^^^This line must be near the end of your $(LOCAL_LDLIBS)
The forgoing will accomplish what having, "APP_STL := gnustl_static" in your Application.mk was supposed to.
Heya,
I'm having trouble building an ndk/jni shared library which I have developed. I am hoping to reuse the libjpeg which ships with the platform (/system/lib/libjpeg.so) however I cannot get it to link. When I build my shared library I get...
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:94: undefined reference to `jpeg_std_error(jpeg_error_mgr*)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:96: undefined reference to `jpeg_CreateDecompress(jpeg_decompress_struct*, int, unsigned int)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:98: undefined reference to `jpeg_stdio_src(jpeg_decompress_struct*, __sFILE*)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:100: undefined reference to `jpeg_read_header(jpeg_decompress_struct*, int)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:102: undefined reference to `jpeg_start_decompress(jpeg_decompress_struct*)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:124: undefined reference to `jpeg_read_scanlines(jpeg_decompress_struct*, unsigned char**, unsigned int)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:130: undefined reference to `jpeg_destroy_decompress(jpeg_decompress_struct*)'
collect2: ld returned 1 exit status
make: *** [/home/blink/workspace_android2/HackBitmapJNI/obj/local/armeabi/libjnijpeg.so] Error 1*
Which is essentially every symbol I would need to resolve out of libjpeg.so at runtime...
I have copied libjpeg.so off of my emulator and into my project directory under 'lib'. When I run 'arm-eabi-readelf -s' on that copy of libjpeg.so I can see all of the above symbols defined (I can't see method signatures.. just names.. is there a way to dump signatures/namespaces??)
My Android.mk is as follows...
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := /opt/android_src/dalvik/libnativehelper/include/nativehelper \
/opt/android_src/frameworks/base/include \
/opt/android_src/system/core/include \
/opt/android_src/dalvik/libnativehelper/include \
/opt/android_src/external/stlport/stlport \
/opt/android_src/external/jpeg \
/opt/android_src/bionic
LOCAL_LDFLAGS += -Llib
LOCAL_MODULE := jnijpeg
LOCAL_SRC_FILES := JNIBmp.cpp
LOCAL_LDLIBS := -lm -llog -ljpeg -landroid_runtime
include $(BUILD_SHARED_LIBRARY)
Thank you much for any help!
Try to use #include in this form:
extern "C" {
#include "jpeglib.h"
}
It worked for me.
Good luck!
I was able to link against -ljpeg using the following:
LOCAL_LDLIBS := -L$(MYDROID)/out/target/product/generic/system/lib/ -ljpeg