2017-08-31 6 views
0

Ich fand this library, die SoundTouch-Android heißt.Android NDK - Fehler beim Kompilieren der Bibliothek

Ich kopierte die jni und die armeabi-v7a Ordner in mein Projekt.

nach im Terminal zum jni Ordner gehen Ich tippte:

export ANDROID_NDK=~/daniele/Android/Sdk/ndk-bundle 
export NDK_ROOT=$ANDROID_NDK 
export PATH=${PATH}:${ANDROID_NDK} 
ndk-build 

Das ist, was ich habe:

Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-14.  
Android NDK: WARNING:/home/daniele/AndroidStudioProjects/Chords2/app/jni/Android.mk:soundtouch: non-system libraries in linker flags: -lgcc  
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  
Android NDK: WARNING:/home/daniele/AndroidStudioProjects/Chords2/app/jni/Android.mk:soundtouch: non-system libraries in linker flags: -lgcc  
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-v7a] Compile++ thumb: soundtouch <= soundtouch-jni.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= AAFilter.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= FIFOSampleBuffer.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= FIRFilter.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= cpu_detect_x86.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= RateTransposer.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= SoundTouch.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= TDStretch.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= BPMDetect.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= PeakFinder.cpp 
[armeabi-v7a] SharedLibrary : libsoundtouch.so 
[armeabi-v7a] Install  : libsoundtouch.so => libs/armeabi-v7a/libsoundtouch.so 
[armeabi] Compile++ thumb: soundtouch <= soundtouch-jni.cpp 
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch-jni.cpp:133:2: error: 
     no matching function for call to 'convertInput16' 
     convertInput16(ar, fBufferIn, BUFF_SIZE); 
     ^~~~~~~~~~~~~~ 
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch-jni.cpp:58:13: note: 
     candidate function not viable: no known conversion from 
     'soundtouch::SAMPLETYPE *' (aka 'short *') to 'float *' for 2nd argument 
static void convertInput16(jbyte*, float*, int); 
      ^
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch-jni.cpp:210:16: error: 
     no matching function for call to 'write' 
       processed += write(fBufferIn, fBufferOut, nSamples * cha... 
          ^~~~~ 
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch-jni.cpp:56:12: note: 
     candidate function not viable: no known conversion from 
     'soundtouch::SAMPLETYPE *' (aka 'short *') to 'const float *' for 1st 
     argument 
static int write(const float*, queue<signed char>*, int, int); 
     ^
2 errors generated. 

Wie kann ich es beheben?

UPDATE:

ich es versucht, den Wiederaufbau nach meinem Application.mk modifizieren, wie in Dan Alberts Antwort vorgeschlagen. Jetzt habe ich ein anderes Protokoll, aber immer noch einen Fehler, den ich nicht beheben kann.

Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-14.  
Android NDK: WARNING:/home/daniele/AndroidStudioProjects/Chords2/app/jni/Android.mk:soundtouch: non-system libraries in linker flags: -lgcc  
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-v7a] Compile++ thumb: soundtouch <= soundtouch-jni.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= AAFilter.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= FIFOSampleBuffer.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= FIRFilter.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= cpu_detect_x86.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= RateTransposer.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= SoundTouch.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= TDStretch.cpp 
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch/source/SoundTouch/TDStretch.cpp:72:13: warning: 
     unused variable '_scanOffsets' [-Wunused-const-variable] 
const short _scanOffsets[5][24]={ 
      ^
1 warning generated. 
[armeabi-v7a] Compile++ thumb: soundtouch <= BPMDetect.cpp 
[armeabi-v7a] Compile++ thumb: soundtouch <= PeakFinder.cpp 
[armeabi-v7a] SharedLibrary : libsoundtouch.so 
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch/source/SoundTouch/RateTransposer.cpp:296: error: undefined reference to 'soundtouch::InterpolateLinearFloat::InterpolateLinearFloat()' 
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch/source/SoundTouch/RateTransposer.cpp:302: error: undefined reference to 'soundtouch::InterpolateShannon::InterpolateShannon()' 
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch/source/SoundTouch/RateTransposer.cpp:299: error: undefined reference to 'soundtouch::InterpolateCubic::InterpolateCubic()' 
clang++: error: linker command failed with exit code 1 (use -v to see invocation) 
make: *** [/home/daniele/AndroidStudioProjects/Chords2/app/obj/local/armeabi-v7a/libsoundtouch.so] Error 1 

Ich weiß nicht recht, ob es sinnvoll ist, aber ich werde mein Android.mk unten Post für Sie heraus zu überprüfen:

LOCAL_PATH := $(call my-dir) 

include $(CLEAR_VARS) 

# *** Remember: Change -O0 into -O2 in add-applications.mk *** 

LOCAL_MODULE := soundtouch 
LOCAL_SRC_FILES := soundtouch-jni.cpp soundtouch/source/SoundTouch/AAFilter.cpp soundtouch/source/SoundTouch/FIFOSampleBuffer.cpp \ 
       soundtouch/source/SoundTouch/FIRFilter.cpp soundtouch/source/SoundTouch/cpu_detect_x86.cpp \ 
       soundtouch/source/SoundTouch/RateTransposer.cpp soundtouch/source/SoundTouch/SoundTouch.cpp \ 
       soundtouch/source/SoundTouch/TDStretch.cpp soundtouch/source/SoundTouch/BPMDetect.cpp soundtouch/source/SoundTouch/PeakFinder.cpp 

# for native audio 
LOCAL_LDLIBS += -lgcc 
LOCAL_C_INCLUDES += $(LOCAL_PATH)/soundtouch/include 
# --whole-archive -lgcc 
# for logging 
LOCAL_LDLIBS += -llog 
# for native asset manager 
#LOCAL_LDLIBS += -landroid 
# don't export all symbols 
# added "-marm" switch to use arm instruction set instead of thumb for improved calculation performance. 
LOCAL_CFLAGS += -Wall -fvisibility=hidden -I soundtouch/source/../include -D ST_NO_EXCEPTION_HANDLING -fdata-sections -ffunction-sections -marm 

include $(BUILD_SHARED_LIBRARY) 
+0

Haben Sie Ihre eigene 'write' Funktion definieren? Wahrscheinlich eine schlechte Idee, Funktionen zu definieren, die dieselben Namen wie Funktionen in der Standardbibliothek haben ... –

+0

Nein, ich habe es nicht selbst definiert. Ich habe gerade versucht, die Bibliothek zu erstellen, als ich sie von dem Link heruntergeladen habe, den ich in der Frage angegeben habe. Ich nehme an, es hat etwas mit dem android.mk zu tun, obwohl ich es jetzt nicht posten kann. Ich werde die Frage später aktualisieren. – Daniele

Antwort

1

Es ist wie vielleicht der Code sieht für in ist nur gebrochen geprüft ist SOUND_TOUCH_INTEGER_SAMPLES: https://github.com/VladimirKulyk/SoundTouch-Android/blob/a614c7b37b0c4d58b20e0581aadfd6a43f3a5f2d/jni/soundtouch/include/STTypes.h#L139

Es sieht so aus, dass auf line 85 gesetzt wurde. Es tut dies nur für den Fall, dass es keine Gleitkomma-Hardware gibt (kann aus dem Protokoll sehen, dass dies für die meisten ABIs gut war, es ist nur für Arm5 fehlgeschlagen). Ich würde empfehlen, Arm5 zu deaktivieren. So gut wie jedes Gerät kann Arm7 machen. Im Application.mk file, ändern Sie die APP_ABI Linie:

APP_ABI := armeabi-v7a 
+0

Ok das könnte tun. Aber da ich ganz neu darin bin, würde es Ihnen etwas ausmachen, mir zu erklären, wie es geht? Vielen Dank – Daniele

+0

Die Antwort wurde aktualisiert. –

+0

Vielen Dank, ich werde es später versuchen – Daniele

Verwandte Themen