Task :libdeepspeech:compileDebugJavaWithJavac FAILED

hi @lissyx, im so sorry to borther you again ,but i hava been Plagued by this problem :I am trying to run run nativate_client/java, i have followed the introductions
to genareat libdeepspeech.so and deepspeech binary for Android on ARMv7 and ARM64 arch, and i cp libdeepspeech.so into the libdeepspeech/libs/{arm64-v8a,armeabi-v7a}/ matching subdirectories, then gradle: it successed ,but when i run ‘./gradlew libdeepspeech:build’ , i got the errorTask:libdeepspeech:compileDebugJavaWithJavac FAILED
. then when i run 'make apk ', i got another error :
‘‘Makefile:31: recipe for target ‘bindings’ failed
make: *** [bindings] Error 1’’

could you give me some advices? thanks very much!

processing as following :slight_smile:

(base) zhangp@zhangp:~/tmp/deepspeech-train-venv/tensorflow$ bazel build --workspace_status_command=“bash native_client/bazel_workspace_status_cmd.sh” --config=monolithic --config=android --config=android_arm64 --define=runtime=tflite --action_env ANDROID_NDK_API_LEVEL=21 --cxxopt=-std=c++11 --copt=-D_GLIBCXX_USE_C99 //native_client:libdeepspeech.so
Starting local Bazel server and connecting to it…
WARNING: The following configs were expanded more than once: [android]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior.
WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule ‘androidndk’ is 21. The major revisions supported by Bazel are [10, 11, 12, 13, 14, 15, 16, 17, 18]. Bazel will attempt to treat the NDK as if it was r18. This may cause compilation and linkage problems. Please download a supported NDK version.
INFO: Analysed target //native_client:libdeepspeech.so (47 packages loaded, 7515 targets configured).
INFO: Found 1 target…
INFO: From Executing genrule //native_client:workspace_status:
++ grep STABLE_TF_GIT_VERSION bazel-out/stable-status.txt
++ cut '-d ’ -f2

  • tf_git_version=v1.14.0-21-ge77504ac6b
    ++ grep STABLE_DS_VERSION bazel-out/stable-status.txt
    ++ cut '-d ’ -f2
  • ds_version=0.7.0-alpha.3
    ++ grep STABLE_DS_GIT_VERSION bazel-out/stable-status.txt
    ++ cut '-d ’ -f2
  • ds_git_version=v0.7.0-alpha.3-81-g40250988
    ++ grep STABLE_DS_GRAPH_VERSION bazel-out/stable-status.txt
    ++ cut '-d ’ -f2
  • ds_graph_version=6
  • cat
    INFO: From Compiling tensorflow/lite/kernels/depthwise_conv.cc:
    In file included from tensorflow/lite/kernels/depthwise_conv.cc:28:
    In file included from ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_multithread.h:21:
    In file included from ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h:23:
    ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:8296:9: warning: inline asm clobber list contains reserved registers: X18 [-Winline-asm]
    “sub sp, sp, #160\n” // =288
    ^
    :1:1: note: instantiated into assembly here
    sub sp, sp, #160
    ^
    ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:8296:9: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
    “sub sp, sp, #160\n” // =288
    ^
    :1:1: note: instantiated into assembly here
    sub sp, sp, #160
    ^
    In file included from tensorflow/lite/kernels/depthwise_conv.cc:28:
    In file included from ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_multithread.h:21:
    In file included from ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h:23:
    ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:8915:9: warning: inline asm clobber list contains reserved registers: X18 [-Winline-asm]
    “ldr w15, [%[function_params], #” STR(DP_OFFSET_OUTPUT_RESIDUAL_WIDTH) “]\n”
    ^
    :1:1: note: instantiated into assembly here
    ldr w15, [x4, #68 + 4 + 4 + 4 + 4 + 4 + 4]
    ^
    ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:8915:9: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
    “ldr w15, [%[function_params], #” STR(DP_OFFSET_OUTPUT_RESIDUAL_WIDTH) “]\n”
    ^
    :1:1: note: instantiated into assembly here
    ldr w15, [x4, #68 + 4 + 4 + 4 + 4 + 4 + 4]
    ^
    In file included from tensorflow/lite/kernels/depthwise_conv.cc:28:
    In file included from ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_multithread.h:21:
    In file included from ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h:23:
    ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:7197:9: warning: inline asm clobber list contains reserved registers: X18 [-Winline-asm]
    “sub sp, sp, #288\n” // =448
    ^
    :1:1: note: instantiated into assembly here
    sub sp, sp, #288
    ^
    ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:7197:9: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
    “sub sp, sp, #288\n” // =448
    ^
    :1:1: note: instantiated into assembly here
    sub sp, sp, #288
    ^
    In file included from tensorflow/lite/kernels/depthwise_conv.cc:28:
    In file included from ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_multithread.h:21:
    In file included from ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h:23:
    ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:7882:9: warning: inline asm clobber list contains reserved registers: X18 [-Winline-asm]
    “sub sp, sp, #32\n” // =192
    ^
    :1:1: note: instantiated into assembly here
    sub sp, sp, #32
    ^
    ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:7882:9: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
    “sub sp, sp, #32\n” // =192
    ^
    :1:1: note: instantiated into assembly here
    sub sp, sp, #32
    ^
    4 warnings generated.
    Target //native_client:libdeepspeech.so up-to-date:
    bazel-bin/native_client/libdeepspeech.so
    INFO: Elapsed time: 173.099s, Critical Path: 47.99s
    INFO: 270 processes: 270 local.
    INFO: Build completed successfully, 274 total actions

(base) zhangp@zhangp:~/tmp/deepspeech-train-venv/DeepSpeech/native_client$ /home/zhangp/Android/Sdk/ndk/21.0.6113669/ndk-build APP_PLATFORM=android-21 APP_BUILD_SCRIPT=$(pwd)/Android.mk NDK_PROJECT_PATH=$(pwd) APP_STL=c++_shared TFDIR=$(pwd)/…/…/tensorflow/ TARGET_ARCH_ABI=arm64-v8a
/home/zhangp/Android/Sdk/ndk/21.0.6113669/build/core/build-binary.mk:748: warning: overriding recipe for target ‘/home/zhangp/tmp/deepspeech-train-venv/tensorflow/native_client/obj/local/arm64-v8a/libc++_shared.so’
/home/zhangp/Android/Sdk/ndk/21.0.6113669/build/core/build-binary.mk:748: warning: ignoring old recipe for target ‘/home/zhangp/tmp/deepspeech-train-venv/tensorflow/native_client/obj/local/arm64-v8a/libc++_shared.so’
/home/zhangp/Android/Sdk/ndk/21.0.6113669/build/core/build-binary.mk:772: warning: overriding recipe for target ‘/home/zhangp/tmp/deepspeech-train-venv/tensorflow/native_client/libs/arm64-v8a/libc++_shared.so’
/home/zhangp/Android/Sdk/ndk/21.0.6113669/build/core/build-binary.mk:772: warning: ignoring old recipe for target ‘/home/zhangp/tmp/deepspeech-train-venv/tensorflow/native_client/libs/arm64-v8a/libc++_shared.so’
/home/zhangp/Android/Sdk/ndk/21.0.6113669/build/core/build-binary.mk:476: warning: overriding recipe for target ‘/home/zhangp/tmp/deepspeech-train-venv/tensorflow/native_client/obj/local/arm64-v8a/objs/deepspeech/client.o’


/home/zhangp/Android/Sdk/ndk/21.0.6113669/build/core/build-binary.mk:748: warning: ignoring old recipe for target ‘/home/zhangp/tmp/deepspeech-train-venv/tensorflow/native_client/obj/local/arm64-v8a/libdeepspeech.so’
/home/zhangp/Android/Sdk/ndk/21.0.6113669/build/core/build-binary.mk:772: warning: overriding recipe for target ‘/home/zhangp/tmp/deepspeech-train-venv/tensorflow/native_client/libs/arm64-v8a/libdeepspeech.so’
/home/zhangp/Android/Sdk/ndk/21.0.6113669/build/core/build-binary.mk:772: warning: ignoring old recipe for target ‘/home/zhangp/tmp/deepspeech-train-venv/tensorflow/native_client/libs/arm64-v8a/libdeepspeech.so’
[arm64-v8a] Prebuilt : libdeepspeech.so <= …/…/tensorflow//bazel-bin/native_client/
[arm64-v8a] Executable : deepspeech
[arm64-v8a] Install : deepspeech => libs/arm64-v8a/deepspeech
[arm64-v8a] Install : libdeepspeech.so => libs/arm64-v8a/libdeepspeech.so
[arm64-v8a] Install : libc++_shared.so => libs/arm64-v8a/libc++_shared.so

(base) zhangp@zhangp:~/tmp/deepspeech-train-venv/tensorflow/native_client/java$ gradle

Configure project :libdeepspeech
arm64-v8a armeabi-v7a x86_64
Task :help

Welcome to Gradle 5.1.1.

To run a build, run gradle …

To see a list of available tasks, run gradle tasks

To see a list of command-line options, run gradle --help

To see more detail about a task, run gradle help --task

For troubleshooting, visit https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface

BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed

(base) zhangp@zhangp:~/tmp/deepspeech-train-venv/tensorflow/native_client/java$ ./gradlew libdeepspeech:build

Configure project :libdeepspeech
arm64-v8a armeabi-v7a x86_64
Task :libdeepspeech:compileDebugJavaWithJavac FAILED
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechStreamingState.java:4: error: cannot find symbol
private SWIGTYPE_p_StreamingState _sp;
^
symbol: class SWIGTYPE_p_StreamingState
location: class DeepSpeechStreamingState
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechStreamingState.java:6: error: cannot find symbol
public DeepSpeechStreamingState(SWIGTYPE_p_StreamingState sp) {
^
symbol: class SWIGTYPE_p_StreamingState
location: class DeepSpeechStreamingState
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechStreamingState.java:10: error: cannot find symbol
public SWIGTYPE_p_StreamingState get() {
^
symbol: class SWIGTYPE_p_StreamingState
location: class DeepSpeechStreamingState
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:14: error: cannot find symbol
private SWIGTYPE_p_p_ModelState _mspp;
^
symbol: class SWIGTYPE_p_p_ModelState
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:15: error: cannot find symbol
private SWIGTYPE_p_ModelState _msp;
^
symbol: class SWIGTYPE_p_ModelState
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:134: error: cannot find symbol
public Metadata sttWithMetadata(short buffer, int buffer_size, int num_results) {
^
symbol: class Metadata
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:184: error: cannot find symbol
public Metadata intermediateDecodeWithMetadata(DeepSpeechStreamingState ctx, int num_results) {
^
symbol: class Metadata
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:215: error: cannot find symbol
public Metadata finishStreamWithMetadata(DeepSpeechStreamingState ctx, int num_results) {
^
symbol: class Metadata
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:18: error: cannot find symbol
DeepSpeech_Error_Codes code = DeepSpeech_Error_Codes.swigToEnum(errorCode);
^
symbol: class DeepSpeech_Error_Codes
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:18: error: cannot find symbol
DeepSpeech_Error_Codes code = DeepSpeech_Error_Codes.swigToEnum(errorCode);
^
symbol: variable DeepSpeech_Error_Codes
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:19: error: cannot find symbol
if (code != DeepSpeech_Error_Codes.ERR_OK) {
^
symbol: variable DeepSpeech_Error_Codes
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:20: error: cannot find symbol
throw new RuntimeException(“Error: " + impl.ErrorCodeToErrorMessage(errorCode) + " (0x” + Integer.toHexString(errorCode) + “).”);
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:34: error: cannot find symbol
this._mspp = impl.new_modelstatep();
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:35: error: cannot find symbol
evaluateErrorCode(impl.CreateModel(modelPath, this._mspp));
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:36: error: cannot find symbol
this._msp = impl.modelstatep_value(this._mspp);
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:46: error: cannot find symbol
return impl.GetModelBeamWidth(this._msp);
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:58: error: cannot find symbol
evaluateErrorCode(impl.SetModelBeamWidth(this._msp, beamWidth));
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:67: error: cannot find symbol
return impl.GetModelSampleRate(this._msp);
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:74: error: cannot find symbol
impl.FreeModel(this._msp);
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:85: error: cannot find symbol
evaluateErrorCode(impl.EnableExternalScorer(this._msp, scorer));
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:94: error: cannot find symbol
evaluateErrorCode(impl.DisableExternalScorer(this._msp));
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:106: error: cannot find symbol
evaluateErrorCode(impl.SetScorerAlphaBeta(this._msp, alpha, beta));
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:119: error: cannot find symbol
return impl.SpeechToText(this._msp, buffer, buffer_size);
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:135: error: cannot find symbol
return impl.SpeechToTextWithMetadata(this._msp, buffer, buffer_size, num_results);
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:148: error: cannot find symbol
SWIGTYPE_p_p_StreamingState ssp = impl.new_streamingstatep();
^
symbol: class SWIGTYPE_p_p_StreamingState
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:148: error: cannot find symbol
SWIGTYPE_p_p_StreamingState ssp = impl.new_streamingstatep();
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:149: error: cannot find symbol
evaluateErrorCode(impl.CreateStream(this._msp, ssp));
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:150: error: cannot find symbol
return new DeepSpeechStreamingState(impl.streamingstatep_value(ssp));
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:162: error: cannot find symbol
impl.FeedAudioContent(ctx.get(), buffer, buffer_size);
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:173: error: cannot find symbol
return impl.IntermediateDecode(ctx.get());
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:185: error: cannot find symbol
return impl.IntermediateDecodeWithMetadata(ctx.get(), num_results);
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:199: error: cannot find symbol
return impl.FinishStream(ctx.get());
^
symbol: variable impl
location: class DeepSpeechModel
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/java/libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/DeepSpeechModel.java:216: error: cannot find symbol
return impl.FinishStreamWithMetadata(ctx.get(), num_results);
^
symbol: variable impl
location: class DeepSpeechModel
33 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:libdeepspeech:compileDebugJavaWithJavac’.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface

BUILD FAILED in 0s
10 actionable tasks: 1 executed, 9 up-to-date

(base) zhangp@zhangp:~/tmp/deepspeech-train-venv/tensorflow/native_client/java$ make apk
./gradlew clean

Configure project :libdeepspeech
arm64-v8a armeabi-v7a x86_64
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface

BUILD SUCCESSFUL in 0s
5 actionable tasks: 3 executed, 2 up-to-date
rm -rf *.java jni/deepspeech_wrap.cpp
SWIG_LIB=“/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/share/swig/4.0.2/” PATH=“/opt/gradle/gradle-5.1.1/bin:/home/zhangp/anaconda3/bin:/home/zhangp/anaconda3/condabin:/home/zhangp/.local/bin:/home/zhangp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zhangp/tmp/deepspeech-venv/v-6-1/DeepSpeech-0.6.1/kenlm/build/bin:/home/zhangp/bin:/usr/local/cuda-10.0/bin:/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/bin” swig -version

SWIG Version 3.0.12

Compiled with g++ [x86_64-pc-linux-gnu]

Configured options: +pcre

Please see http://www.swig.org for reporting bugs and further information
SWIG_LIB=“/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/share/swig/4.0.2/” PATH=“/opt/gradle/gradle-5.1.1/bin:/home/zhangp/anaconda3/bin:/home/zhangp/anaconda3/condabin:/home/zhangp/.local/bin:/home/zhangp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zhangp/tmp/deepspeech-venv/v-6-1/DeepSpeech-0.6.1/kenlm/build/bin:/home/zhangp/bin:/usr/local/cuda-10.0/bin:/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/bin” swig -swiglib
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/share/swig/4.0.2/
SWIG_LIB=“/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/share/swig/4.0.2/” PATH=“/opt/gradle/gradle-5.1.1/bin:/home/zhangp/anaconda3/bin:/home/zhangp/anaconda3/condabin:/home/zhangp/.local/bin:/home/zhangp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zhangp/tmp/deepspeech-venv/v-6-1/DeepSpeech-0.6.1/kenlm/build/bin:/home/zhangp/bin:/usr/local/cuda-10.0/bin:/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/bin” swig -c++ -java -package org.mozilla.deepspeech.libdeepspeech -outdir libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/ -o jni/deepspeech_wrap.cpp jni/deepspeech.i
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/share/swig/4.0.2/java/java.swg:1382: Error: Syntax error in input(1).
Makefile:31: recipe for target ‘bindings’ failed
make: *** [bindings] Error 1

Why do you run that ? make apk is the only target you need.

Please fix your console output, it’s colmpletely unreadable and way too long for me to fix it for you.

If you just run ./gradlew without the swig, it’s expected you get those errors, thats why there is make apk

This is not good, you should have the prebuilt swig we bundle.

Can you verify you have a ds-swig here and a symlink swig ?

Please try to apply this patch and re-do make apk:

diff --git a/native_client/definitions.mk b/native_client/definitions.mk
index 68da5f10..85592956 100644
--- a/native_client/definitions.mk
+++ b/native_client/definitions.mk
@@ -196,7 +196,7 @@ SWIG_BIN := swig$(PLATFORM_EXE_SUFFIX)
 DS_SWIG_BIN := ds-swig$(PLATFORM_EXE_SUFFIX)
 DS_SWIG_BIN_PATH := $(SWIG_ROOT)/bin
 
-DS_SWIG_ENV := SWIG_LIB="$(SWIG_LIB)" PATH="${PATH}:$(DS_SWIG_BIN_PATH)"
+DS_SWIG_ENV := SWIG_LIB="$(SWIG_LIB)" PATH="$(DS_SWIG_BIN_PATH):${PATH}"
 
 $(DS_SWIG_BIN_PATH)/swig:
        mkdir -p $(SWIG_ROOT)

hi @lissyx, i followed your direction re-do , now i get a bew error: its same to short some ,but i dont know how to generate it .

console infor as following :slight_smile:

(base) zhangp@zhangp:~/tmp/deepspeech-train-venv/DeepSpeech/native_client/java$ make apk
./gradlew clean

Configure project :libdeepspeech
arm64-v8a armeabi-v7a x86_64
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface

BUILD SUCCESSFUL in 0s
5 actionable tasks: 2 executed, 3 up-to-date
rm -rf *.java jni/deepspeech_wrap.cpp
SWIG_LIB=“/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/share/swig/4.0.2/” PATH=“/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/bin:/home/zhangp/anaconda3/bin:/home/zhangp/anaconda3/condabin:/home/zhangp/.local/bin:/home/zhangp/bin:/opt/gradle/gradle-5.1.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zhangp/tmp/deepspeech-venv/v-6-1/DeepSpeech-0.6.1/kenlm/build/bin:/home/zhangp/bin:/usr/local/cuda-10.0/bin” swig -version

SWIG Version 4.0.2

Compiled with g++ [x86_64-unknown-linux-gnu]

Configured options: +pcre

Please see http://www.swig.org for reporting bugs and further information
SWIG_LIB=“/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/share/swig/4.0.2/” PATH=“/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/bin:/home/zhangp/anaconda3/bin:/home/zhangp/anaconda3/condabin:/home/zhangp/.local/bin:/home/zhangp/bin:/opt/gradle/gradle-5.1.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zhangp/tmp/deepspeech-venv/v-6-1/DeepSpeech-0.6.1/kenlm/build/bin:/home/zhangp/bin:/usr/local/cuda-10.0/bin” swig -swiglib
/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/share/swig/4.0.2/
SWIG_LIB=“/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/share/swig/4.0.2/” PATH=“/home/zhangp/tmp/deepspeech-train-venv/DeepSpeech/native_client/ds-swig/bin:/home/zhangp/anaconda3/bin:/home/zhangp/anaconda3/condabin:/home/zhangp/.local/bin:/home/zhangp/bin:/opt/gradle/gradle-5.1.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zhangp/tmp/deepspeech-venv/v-6-1/DeepSpeech-0.6.1/kenlm/build/bin:/home/zhangp/bin:/usr/local/cuda-10.0/bin” swig -c++ -java -package org.mozilla.deepspeech.libdeepspeech -outdir libdeepspeech/src/main/java/org/mozilla/deepspeech/libdeepspeech/ -o jni/deepspeech_wrap.cpp jni/deepspeech.i
mkdir libdeepspeech/libs/x86_64/
cp /home/zhangp/tmp/deepspeech-train-venv/tensorflow/bazel-out/x86_64-/bin/native_client/libdeepspeech.so libdeepspeech/libs/x86_64/
cp: cannot stat '/home/zhangp/tmp/deepspeech-train-venv/tensorflow/bazel-out/x86_64-
/bin/native_client/libdeepspeech.so’: No such file or directory
Makefile:20: recipe for target ‘libdeepspeech/libs/x86_64/libdeepspeech.so’ failed
make: *** [libdeepspeech/libs/x86_64/libdeepspeech.so] Error 1

Looks like you need to change gradle.properties or cross-build Android x86_64.

May I ask why you absolutely need to rebuild ? It’s documented in the README that you can directly use implementation ... if you just want to build the Android app and dont need to make change to the librry.

if i want to run with korean model ,whether i need rebuild the librry?

No, you should be able to run a v0.6.1-trained Korean model on top of the libdeepspeech AAR v0.6.1 we released.

so , i just need to download the proper *.so file ,and put it to libdeepspeech/libs/ proper , and run 'make apk ’ to generate the apk , and use my own model to replace model, am i right?

No, please just read the doc.

Just make sure you use the gradle dep as documented on : https://github.com/mozilla/DeepSpeech/blob/v0.6.1/native_client/java/README.rst#android-java--jni-bindings-libdeepspeech

implementation 'deepspeech.mozilla.org:libdeepspeech:0.6.1@aar'

We have example for this: https://github.com/mozilla/DeepSpeech-examples/blob/r0.6/android_mic_streaming/app/build.gradle#L37

hi @lissyx: i followed your instruction to operate, but unfortunately i can get apk , insteading get following error info: Could not find method implementation() for arguments [org.mozilla.deepspeech:libdeepspeech:0.6.1@aar] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

all i do just add "implementation ‘org.mozilla.deepspeech:libdeepspeech:0.6.1@aar’ " to native_client/java/build.gradle

console info :
FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/home/zhangp/tmp/ds-venv/DeepSpeech/native_client/java/build.gradle’ line: 11

  • What went wrong:
    A problem occurred evaluating root project ‘java’.
    *Could not find method implementation() for arguments [org.mozilla.deepspeech:libdeepspeech:0.6.1@aar] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 6s
Makefile:13: recipe for target ‘apk-clean’ failed
make: *** [apk-clean] Error 1

follwing is my build.gradle context:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'
implementation 'org.mozilla.deepspeech:libdeepspeech:0.6.1@aar'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

plugins {
id ‘com.gladed.androidgitversion’ version ‘0.4.9’
}

androidGitVersion {
prefix ‘v’
}

allprojects {
repositories {
google()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
dsVersionString = rootProject.file(’…/…/VERSION’).text.trim()
}

I am no expert in Android / gradle, you have two working examples provided, and it works for me.

if its worked for you , maybe i have done something wrong setting. if so,i wanted to ensure the operation processes:
1、what is your JDK version ?
2、whethe i just git clone the adapt version , cd to native_client/java subdirectory, and add "implementation ‘deepspeech.mozilla.org:libdeepspeech:0.6.1@aar’ " to build.gradle file . finally do make apk?

thanks!

because when in git clone DeepSpeech ,cd to native_client/java, and then " makimplementation 'deepspeech.mozilla.org:libdeepspeech:0.6.1@aar’" to build.gradle, finally do “make apk”, but i get a error :

(ds-venv) zhangp@zhangp:~/tmp/ds-venv/DeepSpeech/native_client/java$ make apk
./gradlew clean

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine java version from ‘11.0.6’.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org
    Makefile:13: recipe for target ‘apk-clean’ failed
    make: *** [apk-clean] Error 1

You were pointed to a Java example app: https://github.com/mozilla/DeepSpeech-examples/blob/r0.6/android_mic_streaming/app/build.gradle#L37

Why are you changing native_client/java? You don’t even need the main DeepSpeech repository at all for this.

because i want to use the native_client/java demo, i followed @lissyx direction , but it failed when i run "make apk " to generate the apk , i dont know if its my venv`s problem or my wrong operation.

I don’t know either, but you keep pasting the console output in a way that makes it unreadable and that removes informations.

This seems to be your error, but I have no idea what it refers to.

@lissyx, seem to be that the gradle version imcompatible with java version, i downgraded the java version ,it could compile ,but when i run "make apk"get another error:

(ds-venv) zhangp@zhangp:~/tmp/ds-venv/DeepSpeech/native_client/java$ make apk
./gradlew clean
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* Where:
Build file '/home/zhangp/tmp/ds-venv/DeepSpeech/native_client/java/build.gradle' line: 11

* What went wrong:
A problem occurred evaluating root project 'java'.
> Could not find method implementation() for arguments [org.mozilla.deepspeech:libdeepspeech:0.6.1@aar] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
Makefile:13: recipe for target 'apk-clean' failed
make: *** [apk-clean] Error 1

hi @lissyx, how can i cross-build Android x86_64? what is the code order ? thanks