0

Can't build Sink for Android

asked 2014-06-02 02:44:43 -0700

oloan.sembiring gravatar image

Any one here who completely build Sink for Android using Android_NDK?

I always get these errors:

Oloansembiring@ubuntu:~/android/android-ndk-r9d$ make APP=AllJoynAudioSink
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 14 in apps/AllJoynAudioSink/project/AndroidManifest.xml    
Android NDK: Building for application 'AllJoynAudioSink'    
[armeabi] Compile++ arm  : AllJoynAudioSink <= AndroidJNIBridge.cc
[armeabi] Compile++ arm  : AllJoynAudioSink <= MyAllJoynListeners.cc
[armeabi] Compile++ arm  : AllJoynAudioSink <= MyAllJoynCode.cc
[armeabi] SharedLibrary  : libAllJoynAudioSink.so
./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./out/apps/AllJoynAudioSink/armeabi/objs/AllJoynAudioSink/AndroidJNIBridge.o: in function Java_org_alljoyn_services_audio_sink_BusHandler_initialize:apps/AllJoynAudioSink/project/jni/MyAllJoynCode.h:35: error: undefined reference to 'qcc::String::String()'
./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./out/apps/AllJoynAudioSink/armeabi/objs/AllJoynAudioSink/AndroidJNIBridge.o: in function Java_org_alljoyn_services_audio_sink_BusHandler_shutdown:apps/AllJoynAudioSink/project/jni/MyAllJoynCode.h:43: error: undefined reference to 'qcc::String::~String()'
./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./out/apps/AllJoynAudioSink/armeabi/objs/AllJoynAudioSink/MyAllJoynListeners.o: in function MyAllJoynListeners::AcceptSessionJoiner(unsigned short, char const*, ajn::SessionOpts const&):apps/AllJoynAudioSink/project/jni/MyAllJoynListeners.cc:23: error: undefined reference to '__android_log_print'
./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./out/apps/AllJoynAudioSink/armeabi/objs/AllJoynAudioSink/MyAllJoynListeners.o: in function MyAllJoynListeners::SessionJoined(unsigned short, unsigned int, char const*):apps/AllJoynAudioSink/project/jni/MyAllJoynListeners.cc:29: error: undefined reference to '__android_log_print'
./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./out/apps/AllJoynAudioSink/armeabi/objs/AllJoynAudioSink/MyAllJoynListeners.o: in function MyAllJoynListeners::SessionJoined(unsigned short, unsigned int, char const*):apps/AllJoynAudioSink/project/jni/MyAllJoynListeners.cc:31: error: undefined reference to 'ajn::BusAttachment::EnableConcurrentCallbacks()'
./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./out/apps/AllJoynAudioSink/armeabi/objs/AllJoynAudioSink/MyAllJoynListeners.o: in function MyAllJoynListeners::SessionJoined(unsigned short, unsigned int, char const*):apps/AllJoynAudioSink/project/jni/MyAllJoynListeners.cc:33: error: undefined reference to 'ajn::BusAttachment::SetLinkTimeout(unsigned int, unsigned int&)'
./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./out/apps/AllJoynAudioSink/armeabi/objs/AllJoynAudioSink/MyAllJoynCode.o: in function ajn::MsgArg::~MsgArg():./alljoyn//cpp/inc/alljoyn/MsgArg.h:354: error: undefined reference to 'ajn::MsgArg::Clear()'
./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./out/apps/AllJoynAudioSink/armeabi/objs/AllJoynAudioSink/MyAllJoynCode.o: in function ajn::MsgArg::~MsgArg():./alljoyn//cpp/inc/alljoyn/MsgArg.h:354: error: undefined reference to 'ajn::MsgArg::Clear()'
./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./out/apps/AllJoynAudioSink/armeabi/objs/AllJoynAudioSink/MyAllJoynCode.o: in function AboutStore::ReadAll(char const*, ajn::services::PropertyStore::Filter, ajn::MsgArg&):apps/AllJoynAudioSink/project/jni/MyAllJoynCode.cc:53: error: undefined reference to 'ajn::MsgArg::MsgArg(char const*, ...)'
./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./out/apps/AllJoynAudioSink/armeabi/objs/AllJoynAudioSink/MyAllJoynCode.o: in function AboutStore::ReadAll(char const*, ajn::services::PropertyStore::Filter, ajn::MsgArg&):apps/AllJoynAudioSink/project ...
(more)
edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2014-06-02 13:00:44 -0700

bspencer gravatar image

The path for the AllJoyn dist folder appears to be incorrect as the libraries cannot be found. Traditionally this is placed somewhere else on your machine and then you set the path at the top of the Android.mk file. You have currently set the path to be "./alljoyn/" so the build script is looking for alljoyn inside the jni folder, not the NDK_ROOT folder. If you want keep the AllJoyn SDK where you have it you will need to make the following change:

ALLJOYN_DIST := $(NDK_ROOT)/alljoyn/
AUDIO_DIST := $(NDK_ROOT)/alljoyn/audio

Further, I see you changed the BundledDaemon.o to BundledRouter.o, but have missed the -lajdaemon. Please change this as follows:

-landroid -lajrouter -lalljoyn -llog -lz -ldl -lssl -lcrypto -lm -lc -lstdc++  -lgcc -lgnustl_static -OpenSLES
edit flag offensive delete publish link more
0

answered 2014-06-02 20:33:03 -0700

oloan.sembiring gravatar image

Hello, now it worked as a charm with my mofified Android.mk Sir. I added lib directory inside /alljoyn/about.

LOCAL_PATH := $(call my-dir)

# AllJoyn specifics
ALLJOYN_DIST := $(NDK_ROOT)/alljoyn
AUDIO_DIST := $(NDK_ROOT)/alljoyn/audio
ABOUT_DIST := $(NDK_ROOT)/alljoyn/about

include $(CLEAR_VARS)

LOCAL_MODULE := AllJoynAudioSink

TARGET_PLATFORM := android-19

LOCAL_C_INCLUDES := \
    $(ALLJOYN_DIST)/cpp/inc \
    $(ABOUT_DIST)/inc \
    $(AUDIO_DIST)/cpp/inc \
    $(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/include \
    $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/include \
    $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include \
    $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/include \
    $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include

LOCAL_CFLAGS := -Wno-psabi -Wno-write-strings -DANDROID_NDK -DTARGET_ANDROID -DLINUX -DQCC_OS_GROUP_POSIX -DQCC_OS_ANDROID -DQCC_CPU_ARM -DANDROID

LOCAL_CPP_EXTENSION := .cc 


LOCAL_SRC_FILES := \
    AndroidJNIBridge.cc \
    MyAllJoynListeners.cc \
    MyAllJoynCode.cc

LOCAL_LDLIBS := \
    -L$(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/lib \
    -L$(ALLJOYN_DIST)/cpp/lib \
    -L$(ALLJOYN_DIST)/java/lib \
    -L$(ABOUT_DIST)/lib \
    -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi \
    -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi \
      $(ALLJOYN_DIST)/cpp/lib/BundledRouter.o \
      $(AUDIO_DIST)/cpp/lib/liballjoyn_audio.a \
      $(ABOUT_DIST)/lib/liballjoyn_about.a \
    -landroid -lajrouter -lalljoyn -llog -lz -ldl -lssl -lcrypto -lm -lc -lstdc++  -lgcc -lgnustl_static -lOpenSLES

LOCAL_ARM_MODE := arm

include $(BUILD_SHARED_LIBRARY)

Thank you very much for your help and warm regards.

edit flag offensive delete publish link more
0

answered 2014-06-26 09:34:39 -0700

MikeX gravatar image

Hi everyone ! I have looked at the above code in details and I think I have a similar problem: I am trying to build a audio sink for Android, but my AllJoynAudioSink shared library doesn't build (I have tried of course to use the fixes you tell about above, but without any luck so far).

Here are the exact steps I have done:

1) I downloaded the AllJoyn SDK 14.02.00 - Android (release) at this page

2) I downloaded the multimedia/audio at the git here

3) As Oloan, I downloaded the Android NDK folder and At the root the Android NDK folder, I created a 'alljoyn' folder containing three folders:

a) 'alljoyn-android' (=the folder downloaded in step 1)

b) 'audio' (=the folder downloaded at step 2)

c) 'about' (=copy of the about folder at the root of the folder downloaded at step 1)

3,5) I followed these general steps about setting up your environnement:

4) In Eclipse, this is my Android.mk file of my android application project:

LOCAL_PATH := $(call my-dir)
# AllJoyn specifics

ALLJOYN_DIST := $(NDK_ROOT)/alljoyn/alljoyn-android/core/alljoyn-14.02.00-rel
AUDIO_DIST := $(NDK_ROOT)/alljoyn/audio
ABOUT_DIST := $(NDK_ROOT)/alljoyn/about


include $(CLEAR_VARS)

LOCAL_MODULE := AllJoynAudioSink

TARGET_PLATFORM := android-19

LOCAL_C_INCLUDES := \
    $(ALLJOYN_DIST)/cpp/inc \
    $(ABOUT_DIST)/inc \
    $(AUDIO_DIST)/inc \
    $(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/include \
    $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/include \
    $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include \
    $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/include \
    $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include

LOCAL_CFLAGS := -Wno-psabi -Wno-write-strings -DANDROID_NDK -DTARGET_ANDROID -DLINUX -DQCC_OS_GROUP_POSIX -DQCC_OS_ANDROID -DQCC_CPU_ARM -DANDROID

LOCAL_CPP_EXTENSION := .cc 


LOCAL_SRC_FILES := \
    AndroidJNIBridge.cc \
    MyAllJoynListeners.cc \
    MyAllJoynCode.cc

LOCAL_LDLIBS := \
    -L$(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/lib \
    -L$(ALLJOYN_DIST)/cpp/lib \
    -L$(ALLJOYN_DIST)/java/lib \
    -L$(ABOUT_DIST)/lib \
    -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi \
    -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi \
     $(ALLJOYN_DIST)/cpp/lib/BundledRouter.o \
     $(ABOUT_DIST)/lib/liballjoyn_about.a \
     $(AUDIO_DIST)/lib/liballjoyn_audio.a \
    -landroid -lajrouter -lalljoyn -llog -lz -ldl -lssl -lcrypto -lm -lc -lstdc++  -lgcc -lgnustl_static -lOpenSLES

LOCAL_ARM_MODE := arm


include $(BUILD_SHARED_LIBRARY)

5)Then, I open a terminal window (I run on Mac), and I use the 'cd' command up to the root of my Android project in the Eclipse workspace folder, and then use NDK_ROOT/ndk-build command to build my library. I get the following error:

  Michels-MacBook-Air:ServerV4 Michel$ /Users/Michel/Desktop/android-ndk/ndk-build
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml    
Android NDK: WARNING:jni/Android.mk:AllJoynAudioSink: non-system libraries in linker flags: /Users/Michel/Desktop/android-ndk/alljoyn/about/lib/liballjoyn_about.a /Users/Michel/Desktop/android-ndk/alljoyn/audio/lib/liballjoyn_audio.a -lajrouter -lalljoyn -lssl -lcrypto -lgcc -lgnustl_static    
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] Compile++ arm  : AllJoynAudioSink <= AndroidJNIBridge.cc
[armeabi] Compile++ arm  : AllJoynAudioSink <= MyAllJoynListeners.cc
[armeabi] Compile++ arm  : AllJoynAudioSink <= MyAllJoynCode.cc
[armeabi] SharedLibrary  : libAllJoynAudioSink.so
arm-linux-androideabi-g++: error: /Users/Michel/Desktop/android-ndk/alljoyn/audio/lib/liballjoyn_audio.a: No such file or directory
make: *** [obj/local/armeabi/libAllJoynAudioSink.so ...
(more)
edit flag offensive delete publish link more

Comments

Mike, did you build the audio framework? This would be your issue as you do not have the liballjoyn_audio.so file. You will need to compile the audio service from source as there is no official support by the AllSeen Alliance for this service framework.

bspencer ( 2014-07-10 10:15:54 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
2 followers

Stats

Asked: 2014-06-02 02:44:43 -0700

Seen: 607 times

Last updated: Jun 26 '14