[Cs-dev] android question..
Date | 2014-07-02 15:56 |
From | Rory Walsh |
Subject | [Cs-dev] android question.. |
I can build my Android project and generate the .apk file without any problem. When I run on the device however I get an error about not being able to load library: reloc_library[1306]...? I'm using the latest packaged .apk from Sourceforge. 07-02 14:53:50.885: E/Trace(1617): error opening trace file: No such file or directory (2) 07-02 14:53:50.995: D/dalvikvm(1617): Trying to load lib /data/data/com.yourcompany.cabbageandroid/lib/libcsoundandroid.so 0x41498f28 07-02 14:53:51.025: D/dalvikvm(1617): Added shared lib /data/data/com.yourcompany.cabbageandroid/lib/libcsoundandroid.so 0x41498f28 07-02 14:53:51.025: D/dalvikvm(1617): No JNI_OnLoad found in /data/data/com.yourcompany.cabbageandroid/lib/libcsoundandroid.so 0x41498f28, skipping init 07-02 14:53:51.025: D/dalvikvm(1617): Trying to load lib /data/data/com.yourcompany.cabbageandroid/lib/libsndfile.so 0x41498f28 07-02 14:53:51.025: D/dalvikvm(1617): Added shared lib /data/data/com.yourcompany.cabbageandroid/lib/libsndfile.so 0x41498f28 07-02 14:53:51.025: D/dalvikvm(1617): No JNI_OnLoad found in /data/data/com.yourcompany.cabbageandroid/lib/libsndfile.so 0x41498f28, skipping init 07-02 14:53:51.035: D/dalvikvm(1617): Trying to load lib /data/data/com.yourcompany.cabbageandroid/lib/libjuce_jni.so 0x41498f28 07-02 14:53:51.035: W/dalvikvm(1617): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/yourcompany/cabbageandroid/CabbageAndroid; 07-02 14:53:51.065: W/dalvikvm(1617): Class init failed in newInstance call (Lcom/yourcompany/cabbageandroid/CabbageAndroid;) 07-02 14:53:51.065: D/AndroidRuntime(1617): Shutting down VM 07-02 14:53:51.065: W/dalvikvm(1617): threadid=1: thread exiting with uncaught exception (group=0x40a13300) 07-02 14:53:51.075: E/AndroidRuntime(1617): FATAL EXCEPTION: main 07-02 14:53:51.075: E/AndroidRuntime(1617): java.lang.ExceptionInInitializerError 07-02 14:53:51.075: E/AndroidRuntime(1617): at java.lang.Class.newInstanceImpl(Native Method) 07-02 14:53:51.075: E/AndroidRuntime(1617): at java.lang.Class.newInstance(Class.java:1319) 07-02 14:53:51.075: E/AndroidRuntime(1617): at android.app.Instrumentation.newActivity(Instrumentation.java:1053) 07-02 14:53:51.075: E/AndroidRuntime(1617): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974) 07-02 14:53:51.075: E/AndroidRuntime(1617): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 07-02 14:53:51.075: E/AndroidRuntime(1617): at android.app.ActivityThread.access$600(ActivityThread.java:130) 07-02 14:53:51.075: E/AndroidRuntime(1617): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 07-02 14:53:51.075: E/AndroidRuntime(1617): at android.os.Handler.dispatchMessage(Handler.java:99) 07-02 14:53:51.075: E/AndroidRuntime(1617): at android.os.Looper.loop(Looper.java:137) 07-02 14:53:51.075: E/AndroidRuntime(1617): at android.app.ActivityThread.main(ActivityThread.java:4745) 07-02 14:53:51.075: E/AndroidRuntime(1617): at java.lang.reflect.Method.invokeNative(Native Method) 07-02 14:53:51.075: E/AndroidRuntime(1617): at java.lang.reflect.Method.invoke(Method.java:511) 07-02 14:53:51.075: E/AndroidRuntime(1617): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 07-02 14:53:51.075: E/AndroidRuntime(1617): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 07-02 14:53:51.075: E/AndroidRuntime(1617): at dalvik.system.NativeStart.main(Native Method) 07-02 14:53:51.075: E/AndroidRuntime(1617): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 37 cannot locate 'csoundGetScoreTime'... 07-02 14:53:51.075: E/AndroidRuntime(1617): at java.lang.Runtime.loadLibrary(Runtime.java:370) 07-02 14:53:51.075: E/AndroidRuntime(1617): at java.lang.System.loadLibrary(System.java:535) 07-02 14:53:51.075: E/AndroidRuntime(1617): at com.yourcompany.cabbageandroid.CabbageAndroid. |
Date | 2014-07-02 16:00 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
Btw, there are 3 .so files in the Android package. When I try to include the libgnustl_shared I get an error about it already being defined in android-ndk/sources/cxx-stl/gnu-libstdc++, if so, why is it included in the package? On 2 July 2014 16:56, Rory Walsh |
Date | 2014-07-02 16:05 |
From | Michael Gogins |
Subject | Re: [Cs-dev] android question.. |
Attachments | None None |
Look at the CsoundApp and CsoundAndroid projects for help with this. Basically, Android as an operating system (unlike all PC operating systems) is not capable of resolving dependencies between shared libraries that are loaded at run time. Therefore, you are responsible for loading these libraries in the correct order before you try to use them. So if you are including some new shared library in your project, and your new shared library depends on other shared libraries that are not already being loaded in the correct order, then you need to write code to load those other shared libraries in the correct order, including any additional shared libraries that THEY depend on. In the CsoundAppActivity class, the following code performs this task: static { int result = 0;
try { java.lang.System.loadLibrary("gnustl_shared"); } catch (Throwable e) {
java.lang.System.err .println("Csound6: gnustl_shared native code library failed to load.\n");
java.lang.System.err.println(e.toString()); } try {
java.lang.System.loadLibrary("sndfile"); } catch (Throwable e) { java.lang.System.err
.println("Csound6: sndfile native code library failed to load.\n"); java.lang.System.err.println(e.toString());
} try { java.lang.System.loadLibrary("csoundandroid");
} catch (Throwable e) { java.lang.System.err .println("Csound6: csoundandroid native code library failed to load.\n"
+ e); java.lang.System.err.println(e.toString()); // java.lang.System.exit(1);
} try { result = csnd6.csnd .csoundInitialize(csnd6.csnd.CSOUNDINIT_NO_ATEXIT);
} catch (Throwable e) { java.lang.System.err.println("Csound6: csoundInitialize failed.\n"
+ e); java.lang.System.err.println(e.toString()); // java.lang.System.exit(1);
} } Hope this helps, Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Jul 2, 2014 at 10:56 AM, Rory Walsh <rorywalsh@ear.ie> wrote: I can build my Android project and generate the .apk file without any |
Date | 2014-07-02 16:07 |
From | Michael Gogins |
Subject | Re: [Cs-dev] android question.. |
Attachments | None None |
In my build system I have a script to copy all the .sos to the right places and ensure there are no redundancies. It is included in the package because it is essential. It is not automatically present or loaded by Android on the device. Hope this helps, Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Jul 2, 2014 at 11:00 AM, Rory Walsh <rorywalsh@ear.ie> wrote: Btw, there are 3 .so files in the Android package. When I try to |
Date | 2014-07-02 16:14 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
Thanks Mike. I'm just trying this now.. On 2 July 2014 17:07, Michael Gogins |
Date | 2014-07-02 16:30 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
Still no improvement. I wonder what Android API the Csound package was built against? My target version is Android 4.2, which is android-16. If the latest CsoundAndroid package was built using a newer API will it lead to problems? ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2014-07-02 16:36 |
From | Michael Gogins |
Subject | Re: [Cs-dev] android question.. |
Attachments | None None |
That might cause problems, but I don't think that is your problem here. Are you trying to build a Cabbage that will run on Android, using the CsoundAndroid project as a library? If so you need to tell your project that you are using CsoundAndroid as a library, this is done for the CsoundApp project in the project-properties file like this:
# Project target. target=android-19 android.library.reference.1=../CsoundAndroid Hope this helps, Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Jul 2, 2014 at 11:30 AM, Rory Walsh <rorywalsh@ear.ie> wrote: Still no improvement. I wonder what Android API the Csound package was |
Date | 2014-07-02 16:44 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
This is indeed what I'm doing, or at least trying to! Just updating my API now. I don't have any such reference in my project properties. I'll try that too. Thanks. On 2 July 2014 17:36, Michael Gogins |
Date | 2014-07-02 16:46 |
From | Steven Yi |
Subject | Re: [Cs-dev] android question.. |
I don't think the problem is Csound. It looks like there's some things that weren't packaged with the Cabbage app: 07-02 14:53:51.035: D/dalvikvm(1617): Trying to load lib /data/data/com.yourcompany. cabbageandroid/lib/libjuce_jni.so 0x41498f28 The other library loading messages messages have things like: 07-02 14:53:51.025: D/dalvikvm(1617): Added shared lib /data/data/com.yourcompany. cabbageandroid/lib/libcsoundandroid.so 0x41498f28 but this libjuce_jni.so one doesn't. Rory: could you double check that this is in the APK? On Wed, Jul 2, 2014 at 11:36 AM, Michael Gogins |
Date | 2014-07-02 16:54 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
Attachments | Android.mk None None |
It's there alright. I can build and run Cabbage without any issue if I remove the dependency on Csound. As soon as I add the Csound stuff I start to get those issues. It could also be because of the ordering of things in my .mk file? I've attached it here in case there is some obvious problems I've made. I'll keep digging... On 2 July 2014 17:46, Steven Yi |
Date | 2014-07-02 17:05 |
From | Steven Yi |
Subject | Re: [Cs-dev] android question.. |
Ah, I see I missed your original comment about the reloc_library: 07-02 14:53:51.075: E/AndroidRuntime(1617): Caused by: java.lang. UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 37 cannot locate 'csoundGetScoreTime'... What is the code at: com.yourcompany. cabbageandroid.CabbageAndroid. |
Date | 2014-07-02 17:26 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
The .java file is pretty huge. But the offending lines are these one: System.loadLibrary ("sndfile"); System.loadLibrary ("csoundandroid"); System.loadLibrary ("juce_jni"); I just can't seem the get the right order. On top of that perhaps I need to add the library reference in my project.properties file as Mike suggested? On 2 July 2014 18:05, Steven Yi |
Date | 2014-07-02 17:30 |
From | Michael Gogins |
Subject | Re: [Cs-dev] android question.. |
Attachments | None None |
I expect juce_jni depends on something else that you are not loading first. Also you probably need to load the GNU STL support library before anything else as in the Csound app, I imagine that JUCE depends at least on that. Hope this helps, Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Jul 2, 2014 at 12:26 PM, Rory Walsh <rorywalsh@ear.ie> wrote: The .java file is pretty huge. But the offending lines are these one: |
Date | 2014-07-02 17:55 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
The odd thing is that I can run the JUCE stuff by only calling System.loadLibrary ("juce_jni"); That is to say, if I remove the Csound dependency I only need the above call in order to run a JUCE only version of Cabbage. On 2 July 2014 18:30, Michael Gogins |
Date | 2014-07-02 18:10 |
From | Michael Gogins |
Subject | Re: [Cs-dev] android question.. |
Attachments | None None |
Is there a shared library conflict between Csound and JUCE? What happens if you load JUCE just before you load Csound? There are some hints online on how to resolve dynamic loading dependencies on Android using command-line tools. I'm sorry but I don't remember exactly where. Just try Googling for "find shared library dependencies Android NDK".
Regards, Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Jul 2, 2014 at 12:55 PM, Rory Walsh <rorywalsh@ear.ie> wrote: The odd thing is that I can run the JUCE stuff by only calling |
Date | 2014-07-02 18:14 |
From | Steven Yi |
Subject | Re: [Cs-dev] android question.. |
Maybe your Android.mk file *is* off. I see that it has an "if" branch near the end, then proceeds to define LOCAL_LDLIBS 4 times. In the Csound Android.mk, it uses LOCAL_SHARED_LIBRARIES and LOCAL_LDLIBS both. Try adding: LOCAL_SHARED_LIBRARIES += gnustl_shared to your Android.mk, and adding: APP_STL := gnustl_shared to your Application.mk. That might not be it, but I'd suggest looking at those files in CsoundAndroid/jni folder for reference. On Wed, Jul 2, 2014 at 12:55 PM, Rory Walsh |
Date | 2014-07-02 18:48 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
Will do Steven thanks. That makefile is auto-generated :) But even with those changes you suggest I still get no improvement. The least amount of errors I get when I start is: 07-02 17:28:11.160: E/AndroidRuntime(1573): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "csoundGetScoreTime" referenced by "libjuce_jni.so"... 07-02 17:28:11.160: E/AndroidRuntime(1573): at java.lang.Runtime.loadLibrary(Runtime.java:371) 07-02 17:28:11.160: E/AndroidRuntime(1573): at java.lang.System.loadLibrary(System.java:535) 07-02 17:28:11.160: E/AndroidRuntime(1573): at com.yourcompany.cabbageandroid.CabbageAndroid. |
Date | 2014-07-02 18:57 |
From | Michael Gogins |
Subject | Re: [Cs-dev] android question.. |
Attachments | None None |
Why is c sound get score time referenced by lib juice jni? On Jul 2, 2014 1:49 PM, "Rory Walsh" <rorywalsh@ear.ie> wrote:
Will do Steven thanks. That makefile is auto-generated :) But even |
Date | 2014-07-02 19:13 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
I'm not sure. One thing is clear however, I've no idea what I'm at here! In a nutshell, what I've done is simply build Cabbage using a juce generated Android make file. When that worked I added -lcsoundandroid and -lsndfile to the LOCAL_LDLIBS in my makefile, along with header paths. Make builds without any issues and seems to link fine to Csound. I've not used Eclipse at all for any of this. I really can't get my head around that IDE. On 2 July 2014 19:57, Michael Gogins |
Date | 2014-07-02 19:29 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
Another quick question, I assume I can build for "armeabi-v7a" only and disgard with armeabi? Or maybe not. I guess armeabi-v7a/ is newer, which might be more recent that my target Android version. On 2 July 2014 20:13, Rory Walsh |
Date | 2014-07-02 19:34 |
From | Steven Yi |
Subject | Re: [Cs-dev] android question.. |
You can build for armeabi-v7a only if you like. It needs to be specified in the Application.mk I believe. Question: could you run ndk-depends on the libjuice_jni library? (ndk-depends comes with the Android NDK) On Wed, Jul 2, 2014 at 2:29 PM, Rory Walsh |
Date | 2014-07-02 19:34 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] android question.. |
Just wondering; Have you added libcsound and libsndfile JNI to your libs in the project? ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 2 Jul 2014, at 19:13, Rory Walsh |
Date | 2014-07-02 20:13 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
They are there alright. JUCE doesn't distribute an Android version as shared lib. One simply creates a project using the IntroJucer. The resulting makefile builds the libjuce.so every time I run it. Running ndk-depends on libjuce.so I get: libjuce_jni.so libsndfile.so liblog.so libgnustl_shared.so libcsoundandroid.so libstdc++.so libm.so libdl.so libc.so libGLESv2.so This JNI stuff is really lots of fun. I think I'm having football withdrawal!! On 2 July 2014 20:34, Victor Lazzarini |
Date | 2014-07-02 20:18 |
From | Michael Gogins |
Subject | Re: [Cs-dev] android question.. |
Attachments | None None |
Some will already be loaded by the system before the app tries loading anything, but put in code to load each one at a time in its own try/catch block. Regards, |
Date | 2014-07-02 20:26 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
Thanks everyone. I'll try it again tomorrow. Right now I'm building from the terminal and then running the emulator in Eclipse. But I can't tell if Eclipse is launching the correct APK or not. Tomorrow I'll try launching the emulator via the terminal too, just to make sure it's reading and loading the right package. I've no doubt it'll not be the last you hear of this adventure.. On 2 July 2014 21:18, Michael Gogins |
Date | 2014-07-02 20:28 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] android question.. |
So you’re sure they are being packed up in the APK? ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 2 Jul 2014, at 20:13, Rory Walsh |
Date | 2014-07-02 20:41 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
Attachments | Screenshot - 020714 - 21:38:00.png None None |
Yup. check the screenshot. Am I the only one that finds something off about the csoundGetScoreTime() error? If the Csound is not being found wouldn't I be getting a whole load of unsatisfied linker errors on startup? I'll throw in a few try/catches tomorrow as Mike suggested. That should give me a little more info. On 2 July 2014 21:28, Victor Lazzarini |
Date | 2014-07-02 20:49 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] android question.. |
It seems awfully small to me (5.1kB). Here in my computer it’s libcsoundandroid.so 13.3MB. mu-lap-4zj:armeabi-v7a victor$ ls -l total 8824 -rwxr-xr-x 1 victor staff 1849864 28 Apr 07:12 libcsoundandroid.so -rwxr-xr-x 1 victor staff 783996 28 Apr 07:12 libgnustl_shared.so -rwxr-xr-x 1 victor staff 1878496 28 Apr 07:12 libsndfile.so ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 2 Jul 2014, at 20:41, Rory Walsh |
Date | 2014-07-02 20:58 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] android question.. |
Actually 1.8MB, sorry I misread it. Still much bigger. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 2 Jul 2014, at 20:49, Victor Lazzarini |
Date | 2014-07-02 21:02 |
From | Michael Gogins |
Subject | Re: [Cs-dev] android question.. |
Attachments | None None |
He should be able to use the one from Csound6.apk. He will also need the swig generated java files. Regards, On Jul 2, 2014 3:50 PM, "Victor Lazzarini" <Victor.Lazzarini@nuim.ie> wrote:
It seems awfully small to me (5.1kB). Here in my computer it’s libcsoundandroid.so 13.3MB. |
Date | 2014-07-02 21:10 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
The one I'm bundling into my apk are from the CsoundAndroid package on sourceforge csound-android-6.03.2.zip Is this right? I simply unzipped it and then worked from there. I've not used any swig generated java files, I'm simply linking to the .so file. On 2 July 2014 22:02, Michael Gogins |
Date | 2014-07-02 21:15 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] android question.. |
But that libcsoundandroid.so is 1.9MB not 5.1KB. There is something wrong in this. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 2 Jul 2014, at 21:10, Rory Walsh |
Date | 2014-07-02 21:35 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
The libcsoundandroid in Csound6.apk is only 1.9Mbs? On 2 July 2014 22:15, Victor Lazzarini |
Date | 2014-07-02 21:36 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
That is to say, the libcsoundandroid.so in: http://kent.dl.sourceforge.net/project/csound/csound6/Csound6.03/Csound6.apk IS only 1.9 Mbs... On 2 July 2014 22:35, Rory Walsh |
Date | 2014-07-02 21:43 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] android question.. |
yes, but the one in your picture is 5.1kb. That’s not right. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 2 Jul 2014, at 21:36, Rory Walsh |
Date | 2014-07-02 21:55 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
Fair point. Too tired now. Thanks, I'll get back to it tomorrow at some stage! On 2 July 2014 22:43, Victor Lazzarini |
Date | 2014-07-03 15:00 |
From | Rory Walsh |
Subject | Re: [Cs-dev] android question.. |
I managed to sort out those issues. Im not sure what was causing the libraries to be the wrong size, but deleting and rebuilding the apk, along with a few changes to the .mk file seem to have done the trick. It's still not working, but at least it's building and linking correctly. On 2 July 2014 22:55, Rory Walsh |