Juce and csound for android

Dear all,

I’m trying to use JUCE since a few weeks. I’m trying to build an app for
Android, using JUCE and Csound.
And of course, having an issue :slight_smile:

First of all, i checked that my android studio is correctly installed, and
could build a JUCE example quite easily.
My current app uses only JUCE standard libs, and csound c++ libs
(csound.hpp, and csPerfThread.hpp). I could compile the linux makefile
easily.
But, when compiling in the android studio, it seems there is the problem
linking the csound libraries.
In the projucer, the project was configured so that includepath has access
to csound.hpp and csPerfThread.hpp (included in my project), and so that
linker can link with libcsound64.so and libcsnd6.so (with the -L and -l
flags).

The output error message (below) seems to indicate that the .so files aren’t
found or linked correctly. But i’m not really sure why.

Did anyone experienced any issue like this when linking any shared library ?
Sorry if it’s a really easy case, but it’s my first android project, and,
after googling for hours, i don’t find any answer adapted to this issue.

/

Build command failed.

Error while executing process

/home/johann/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {–build

/home/johann/JUCE/Projects/touchApp/Builds/Android/app/.externalNativeBuild/cmake/debug_Debug/x86

–target juce_jni}

[1/2] Building CXX object

CMakeFiles/juce_jni.dir/home/johann/JUCE/Projects/touchApp/Source/Main.cpp.o

[2/2] Linking CXX shared library

…/…/…/…/build/intermediates/cmake/debug_/debug/obj/x86/libjuce_jni.so

FAILED: : &&

/home/johann/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++

–target=i686-none-linux-android24

–gcc-toolchain=/home/johann/Android/Sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64

–sysroot=/home/johann/Android/Sdk/ndk-bundle/sysroot -fPIC -isystem

/home/johann/Android/Sdk/ndk-bundle/sysroot/usr/include/i686-linux-android

-g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong

-no-canonical-prefixes -Wa,–noexecstack -Wformat -Werror=format-security

-std=c++11 -fexceptions -frtti -fsigned-char -std=gnu++14

-I/usr/local/include/csound -O0 -fno-limit-debug-info -O0

-Wl,–exclude-libs,libgcc.a -Wl,–exclude-libs,libatomic.a -nostdlib++

–sysroot /home/johann/Android/Sdk/ndk-bundle/platforms/android-24/arch-x86

-Wl,–build-id -Wl,–warn-shared-textrel -Wl,–fatal-warnings

-L/home/johann/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86

-Wl,–no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro

-Wl,-z,now -Wl,–gc-sections -Wl,-z,nocopyreloc -pie -fPIE

-L/home/johann/csound/cs6make -L/usr/local/lib -shared

-Wl,-soname,libjuce_jni.so -o

…/…/…/…/build/intermediates/cmake/debug_/debug/obj/x86/libjuce_jni.so

CMakeFiles/juce_jni.dir/home/johann/JUCE/Projects/touchApp/Source/Main.cpp.o

CMakeFiles/juce_jni.dir/home/johann/JUCE/Projects/touchApp/JuceLibraryCode/include_juce_core.cpp.o

CMakeFiles/juce_jni.dir/home/johann/JUCE/Projects/touchApp/JuceLibraryCode/include_juce_data_structures.cpp.o

CMakeFiles/juce_jni.dir/home/johann/JUCE/Projects/touchApp/JuceLibraryCode/include_juce_events.cpp.o

CMakeFiles/juce_jni.dir/home/johann/JUCE/Projects/touchApp/JuceLibraryCode/include_juce_graphics.cpp.o

CMakeFiles/juce_jni.dir/home/johann/JUCE/Projects/touchApp/JuceLibraryCode/include_juce_gui_basics.cpp.o

/home/johann/Android/Sdk/ndk-bundle/platforms/android-24/arch-x86/usr/lib/liblog.so

/home/johann/Android/Sdk/ndk-bundle/platforms/android-24/arch-x86/usr/lib/libandroid.so

/home/johann/Android/Sdk/ndk-bundle/platforms/android-24/arch-x86/usr/lib/libGLESv3.so

/home/johann/Android/Sdk/ndk-bundle/platforms/android-24/arch-x86/usr/lib/libEGL.so

libcpufeatures.a -latomic -lm

“/home/johann/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a”

“/home/johann/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86/libc++abi.a”

&& :

/home/johann/JUCE/Projects/touchApp/Source/MultiTouchDemo.h:78: error:

undefined reference to

‘CsoundPerformanceThread::CsoundPerformanceThread(Csound*)’

/home/johann/JUCE/Projects/touchApp/Source/MultiTouchDemo.h:79: error:

undefined reference to ‘CsoundPerformanceThread::Play()’

/usr/local/include/csound/csound.hpp:834: error: undefined reference to

‘csoundCreate’

/usr/local/include/csound/csound.hpp:118: error: undefined reference to

‘csoundInitializeCscore’

/usr/local/include/csound/csound.hpp:122: error: undefined reference to

‘csoundGetVersion’

/usr/local/include/csound/csound.hpp:126: error: undefined reference to

‘csoundGetAPIVersion’

/usr/local/include/csound/csound.hpp:130: error: undefined reference to

‘csoundGetHostData’

/usr/local/include/csound/csound.hpp:134: error: undefined reference to

‘csoundSetHostData’

/usr/local/include/csound/csound.hpp:138: error: undefined reference to

‘csoundGetEnv’

/usr/local/include/csound/csound.hpp:142: error: undefined reference to

‘csoundSetGlobalEnv’

/usr/local/include/csound/csound.hpp:146: error: undefined reference to

‘csoundSetOption’

/usr/local/include/csound/csound.hpp:149: error: undefined reference to

‘csoundSetParams’

/usr/local/include/csound/csound.hpp:152: error: undefined reference to

‘csoundGetParams’

/usr/local/include/csound/csound.hpp:155: error: undefined reference to

‘csoundSetOutput’

/usr/local/include/csound/csound.hpp:158: error: undefined reference to

‘csoundSetInput’

/usr/local/include/csound/csound.hpp:161: error: undefined reference to

‘csoundSetMIDIInput’

/usr/local/include/csound/csound.hpp:164: error: undefined reference to

‘csoundSetMIDIFileInput’

/usr/local/include/csound/csound.hpp:167: error: undefined reference to

‘csoundSetMIDIOutput’

/usr/local/include/csound/csound.hpp:170: error: undefined reference to

‘csoundSetMIDIFileOutput’

/usr/local/include/csound/csound.hpp:174: error: undefined reference to

‘csoundParseOrc’

/usr/local/include/csound/csound.hpp:178: error: undefined reference to

‘csoundCompileTree’

/usr/local/include/csound/csound.hpp:182: error: undefined reference to

‘csoundDeleteTree’

/usr/local/include/csound/csound.hpp:186: error: undefined reference to

‘csoundCompileOrc’

/usr/local/include/csound/csound.hpp:190: error: undefined reference to

‘csoundEvalCode’

/usr/local/include/csound/csound.hpp:194: error: undefined reference to

‘csoundReadScore’

/usr/local/include/csound/csound.hpp:198: error: undefined reference to

‘csoundCompileArgs’

/usr/local/include/csound/csound.hpp:202: error: undefined reference to

‘csoundCompile’

/usr/local/include/csound/csound.hpp:210: error: undefined reference to

‘csoundCompile’

/usr/local/include/csound/csound.hpp:219: error: undefined reference to

‘csoundCompile’

/usr/local/include/csound/csound.hpp:229: error: undefined reference to

‘csoundCompile’

/usr/local/include/csound/csound.hpp:257: error: undefined reference to

‘csoundCompileCsd’

/usr/local/include/csound/csound.hpp:261: error: undefined reference to

‘csoundCompileCsdText’

/usr/local/include/csound/csound.hpp:265: error: undefined reference to

‘csoundStart’

/usr/local/include/csound/csound.hpp:269: error: undefined reference to

‘csoundPerform’

/usr/local/include/csound/csound.hpp:275: error: undefined reference to

‘csoundPerform’

/usr/local/include/csound/csound.hpp:277: error: undefined reference to

‘csoundCleanup’

/usr/local/include/csound/csound.hpp:289: error: undefined reference to

‘csoundPerform’

/usr/local/include/csound/csound.hpp:291: error: undefined reference to

‘csoundCleanup’

/usr/local/include/csound/csound.hpp:304: error: undefined reference to

‘csoundPerform’

/usr/local/include/csound/csound.hpp:306: error: undefined reference to

‘csoundCleanup’

/usr/local/include/csound/csound.hpp:322: error: undefined reference to

‘csoundCleanup’

/usr/local/include/csound/csound.hpp:363: error: undefined reference to

‘csoundPerformKsmps’

/usr/local/include/csound/csound.hpp:367: error: undefined reference to

‘csoundPerformBuffer’

/usr/local/include/csound/csound.hpp:371: error: undefined reference to

‘csoundStop’

/usr/local/include/csound/csound.hpp:379: error: undefined reference to

‘csoundReset’

/usr/local/include/csound/csound.hpp:383: error: undefined reference to

‘csoundGetSr’

/usr/local/include/csound/csound.hpp:387: error: undefined reference to

‘csoundGetKr’

/usr/local/include/csound/csound.hpp:391: error: undefined reference to

‘csoundGetKsmps’

/usr/local/include/csound/csound.hpp:395: error: undefined reference to

‘csoundGetNchnls’

/usr/local/include/csound/csound.hpp:399: error: undefined reference to

‘csoundGetNchnlsInput’

/usr/local/include/csound/csound.hpp:403: error: undefined reference to

‘csoundGet0dBFS’

/usr/local/include/csound/csound.hpp:407: error: undefined reference to

‘csoundGetInputBufferSize’

/usr/local/include/csound/csound.hpp:411: error: undefined reference to

‘csoundGetOutputBufferSize’

/usr/local/include/csound/csound.hpp:415: error: undefined reference to

‘csoundGetInputBuffer’

/usr/local/include/csound/csound.hpp:419: error: undefined reference to

‘csoundGetOutputBuffer’

/usr/local/include/csound/csound.hpp:423: error: undefined reference to

‘csoundGetSpin’

/usr/local/include/csound/csound.hpp:427: error: undefined reference to

‘csoundGetSpout’

/usr/local/include/csound/csound.hpp:431: error: undefined reference to

‘csoundGetOutputName’

/usr/local/include/csound/csound.hpp:434: error: undefined reference to

‘csoundGetCurrentTimeSamples’

/usr/local/include/csound/csound.hpp:438: error: undefined reference to

‘csoundSetHostImplementedAudioIO’

/usr/local/include/csound/csound.hpp:442: error: undefined reference to

‘csoundSetHostImplementedMIDIIO’

/usr/local/include/csound/csound.hpp:446: error: undefined reference to

‘csoundGetScoreTime’

/usr/local/include/csound/csound.hpp:450: error: undefined reference to

‘csoundIsScorePending’

/usr/local/include/csound/csound.hpp:454: error: undefined reference to

‘csoundSetScorePending’

/usr/local/include/csound/csound.hpp:458: error: undefined reference to

‘csoundGetScoreOffsetSeconds’

/usr/local/include/csound/csound.hpp:462: error: undefined reference to

‘csoundSetScoreOffsetSeconds’

/usr/local/include/csound/csound.hpp:466: error: undefined reference to

‘csoundRewindScore’

/usr/local/include/csound/csound.hpp:470: error: undefined reference to

‘csoundSetCscoreCallback’

/usr/local/include/csound/csound.hpp:474: error: undefined reference to

‘csoundScoreSort’

/usr/local/include/csound/csound.hpp:478: error: undefined reference to

‘csoundScoreExtract’

/usr/local/include/csound/csound.hpp:484: error: undefined reference to

‘csoundMessageV’

/usr/local/include/csound/csound.hpp:491: error: undefined reference to

‘csoundMessageV’

/usr/local/include/csound/csound.hpp:496: error: undefined reference to

‘csoundMessageV’

/usr/local/include/csound/csound.hpp:502: error: undefined reference to

‘csoundSetMessageCallback’

/usr/local/include/csound/csound.hpp:506: error: undefined reference to

‘csoundGetMessageLevel’

/usr/local/include/csound/csound.hpp:510: error: undefined reference to

‘csoundSetMessageLevel’

/usr/local/include/csound/csound.hpp:514: error: undefined reference to

‘csoundInputMessage’

/usr/local/include/csound/csound.hpp:518: error: undefined reference to

‘csoundKeyPress’

/usr/local/include/csound/csound.hpp:522: error: undefined reference to

‘csoundScoreEvent’

/usr/local/include/csound/csound.hpp:527: error: undefined reference to

‘csoundScoreEventAbsolute’

/usr/local/include/csound/csound.hpp:532: error: undefined reference to

‘csoundSetExternalMidiInOpenCallback’

/usr/local/include/csound/csound.hpp:537: error: undefined reference to

‘csoundSetExternalMidiReadCallback’

/usr/local/include/csound/csound.hpp:542: error: undefined reference to

‘csoundSetExternalMidiInCloseCallback’

/usr/local/include/csound/csound.hpp:547: error: undefined reference to

‘csoundSetExternalMidiOutOpenCallback’

/usr/local/include/csound/csound.hpp:552: error: undefined reference to

‘csoundSetExternalMidiWriteCallback’

/usr/local/include/csound/csound.hpp:557: error: undefined reference to

‘csoundSetExternalMidiOutCloseCallback’

/usr/local/include/csound/csound.hpp:562: error: undefined reference to

‘csoundSetExternalMidiErrorStringCallback’

/usr/local/include/csound/csound.hpp:566: error: undefined reference to

‘csoundSetIsGraphable’

/usr/local/include/csound/csound.hpp:571: error: undefined reference to

‘csoundSetMakeGraphCallback’

/usr/local/include/csound/csound.hpp:576: error: undefined reference to

‘csoundSetDrawGraphCallback’

/usr/local/include/csound/csound.hpp:581: error: undefined reference to

‘csoundSetKillGraphCallback’

/usr/local/include/csound/csound.hpp:586: error: undefined reference to

‘csoundSetExitGraphCallback’

/usr/local/include/csound/csound.hpp:592: error: undefined reference to

‘csoundNewOpcodeList’

/usr/local/include/csound/csound.hpp:598: error: undefined reference to

‘csoundDisposeOpcodeList’

/usr/local/include/csound/csound.hpp:607: error: undefined reference to

‘csoundAppendOpcode’

/usr/local/include/csound/csound.hpp:612: error: undefined reference to

‘csoundSetYieldCallback’

/usr/local/include/csound/csound.hpp:617: error: undefined reference to

‘csoundSetPlayopenCallback’

/usr/local/include/csound/csound.hpp:622: error: undefined reference to

‘csoundSetRtplayCallback’

/usr/local/include/csound/csound.hpp:627: error: undefined reference to

‘csoundSetRecopenCallback’

/usr/local/include/csound/csound.hpp:632: error: undefined reference to

‘csoundSetRtrecordCallback’

/usr/local/include/csound/csound.hpp:637: error: undefined reference to

‘csoundSetRtcloseCallback’

/usr/local/include/csound/csound.hpp:641: error: undefined reference to

‘csoundGetDebug’

/usr/local/include/csound/csound.hpp:645: error: undefined reference to

‘csoundSetDebug’

/usr/local/include/csound/csound.hpp:649: error: undefined reference to

‘csoundTableLength’

/usr/local/include/csound/csound.hpp:653: error: undefined reference to

‘csoundTableGet’

/usr/local/include/csound/csound.hpp:657: error: undefined reference to

‘csoundTableSet’

/usr/local/include/csound/csound.hpp:663: error: undefined reference to

‘csoundGetTable’

/usr/local/include/csound/csound.hpp:668: error: undefined reference to

‘csoundTableCopyOut’

/usr/local/include/csound/csound.hpp:671: error: undefined reference to

‘csoundTableCopyIn’

/usr/local/include/csound/csound.hpp:675: error: undefined reference to

‘csoundCreateGlobalVariable’

/usr/local/include/csound/csound.hpp:679: error: undefined reference to

‘csoundQueryGlobalVariable’

/usr/local/include/csound/csound.hpp:683: error: undefined reference to

‘csoundQueryGlobalVariableNoCheck’

/usr/local/include/csound/csound.hpp:687: error: undefined reference to

‘csoundDestroyGlobalVariable’

/usr/local/include/csound/csound.hpp:691: error: undefined reference to

‘csoundGetRtRecordUserData’

/usr/local/include/csound/csound.hpp:695: error: undefined reference to

‘csoundGetRtPlayUserData’

/usr/local/include/csound/csound.hpp:700: error: undefined reference to

‘csoundRegisterSenseEventCallback’

/usr/local/include/csound/csound.hpp:704: error: undefined reference to

‘csoundRunUtility’

/usr/local/include/csound/csound.hpp:708: error: undefined reference to

‘csoundListUtilities’

/usr/local/include/csound/csound.hpp:712: error: undefined reference to

‘csoundDeleteUtilityList’

/usr/local/include/csound/csound.hpp:716: error: undefined reference to

‘csoundGetUtilityDescription’

/usr/local/include/csound/csound.hpp:723: error: undefined reference to

‘csoundGetChannelPtr’

/usr/local/include/csound/csound.hpp:731: error: undefined reference to

‘csoundListChannels’

/usr/local/include/csound/csound.hpp:737: error: undefined reference to

‘csoundDeleteChannelList’

/usr/local/include/csound/csound.hpp:742: error: undefined reference to

‘csoundSetControlChannelHints’

/usr/local/include/csound/csound.hpp:746: error: undefined reference to

‘csoundGetControlChannelHints’

/usr/local/include/csound/csound.hpp:750: error: undefined reference to

‘csoundSetControlChannel’

/usr/local/include/csound/csound.hpp:754: error: undefined reference to

‘csoundSetControlChannel’

/usr/local/include/csound/csound.hpp:758: error: undefined reference to

‘csoundSetStringChannel’

/usr/local/include/csound/csound.hpp:762: error: undefined reference to

‘csoundSetStringChannel’

/usr/local/include/csound/csound.hpp:766: error: undefined reference to

‘csoundSetAudioChannel’

/usr/local/include/csound/csound.hpp:770: error: undefined reference to

‘csoundGetControlChannel’

/usr/local/include/csound/csound.hpp:774: error: undefined reference to

‘csoundGetControlChannel’

/usr/local/include/csound/csound.hpp:778: error: undefined reference to

‘csoundGetStringChannel’

/usr/local/include/csound/csound.hpp:782: error: undefined reference to

‘csoundGetAudioChannel’

/usr/local/include/csound/csound.hpp:786: error: undefined reference to

‘csoundSetPvsChannel’

/usr/local/include/csound/csound.hpp:791: error: undefined reference to

‘csoundGetPvsChannel’

/usr/local/include/csound/csound.hpp:795: error: undefined reference to

‘csoundSetInputChannelCallback’

/usr/local/include/csound/csound.hpp:799: error: undefined reference to

‘csoundSetOutputChannelCallback’

/usr/local/include/csound/csound.hpp:809: error: undefined reference to

‘csoundCreateConfigurationVariable’

/usr/local/include/csound/csound.hpp:814: error: undefined reference to

‘csoundSetConfigurationVariable’

/usr/local/include/csound/csound.hpp:818: error: undefined reference to

‘csoundParseConfigurationVariable’

/usr/local/include/csound/csound.hpp:822: error: undefined reference to

‘csoundQueryConfigurationVariable’

/usr/local/include/csound/csound.hpp:826: error: undefined reference to

‘csoundListConfigurationVariables’

/usr/local/include/csound/csound.hpp:830: error: undefined reference to

‘csoundDeleteConfigurationVariable’

/usr/local/include/csound/csound.hpp:872: error: undefined reference to

‘csoundDestroy’

/usr/local/include/csound/csound.hpp:881: error: undefined reference to

‘csoundCreateMessageBuffer’

/usr/local/include/csound/csound.hpp:885: error: undefined reference to

‘csoundGetFirstMessage’

/usr/local/include/csound/csound.hpp:889: error: undefined reference to

‘csoundGetFirstMessageAttr’

/usr/local/include/csound/csound.hpp:893: error: undefined reference to

‘csoundPopFirstMessage’

/usr/local/include/csound/csound.hpp:897: error: undefined reference to

‘csoundGetMessageCnt’

/usr/local/include/csound/csound.hpp:901: error: undefined reference to

‘csoundDestroyMessageBuffer’

/usr/local/include/csound/csound.hpp:905: error: undefined reference to

‘csoundAddSpinSample’

/usr/local/include/csound/csound.hpp:909: error: undefined reference to

‘csoundGetSpoutSample’

/usr/local/include/csound/csound.hpp:913: error: undefined reference to

‘csoundGetInputName’

clang++: error: linker command failed with exit code 1 (use -v to see

invocation)

ninja: build stopped: subcommand failed.

It’s not finding the Csound library. You may have more luck asking about this on the Csound mailing list or slack channel? Btw, if you are using JUCE to handle audio from Csound, you don’t need to bother with the CsoundPerformanceThread class. Just call Csound’s perfksmps() method in the Audioprocessor::processBlcok()

1 Like

I had a quick look at the CSound download for Android (https://csound.com/download.html) and if you check under CsoundAndroid/src/main/jniLibs you’ll see that it only contains shared libraries for ARM, whereas you’re building for the x86 architecture (presumably the Android emulator).

You have 2 solutions:

  1. Use a real Android device as your target
  2. Compile CSound for the x86 architectures (x86 and x86_64)

I’d go for 2. And it’d be really great if you could post your build steps back here so other developers can use CSound on the emulator.