Open kwatkins opened 6 years ago
If you were using the release tags, use the newest (1.2.1). Otherwise you can pull from master. Missing dependencies should be fixed.
Hi @sjd69 pulled master and still getting this linker error, do I need to install the DJI SDK or something similar ?
Full error:
Build command failed.
Error while executing process /Users/kevin_watkins/Library/Android/sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /grindhouse/workspace/rosettadrone-1.2.1/app/.externalNativeBuild/cmake/debug/armeabi-v7a --target djivideojni}
[1/2] Building C object CMakeFiles/djivideojni.dir/src/main/cpp/dji_video_jni.c.o
In file included from /grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:4:
In file included from ../../../../src/main/cpp/ffmpeg.h:34:
In file included from ../../../../src/main/cpp/cmdutils.h:28:
In file included from ../../../../src/main/cpp/include/libavcodec/avcodec.h:31:
In file included from ../../../../src/main/cpp/include/libavutil/samplefmt.h:24:
In file included from ../../../../src/main/cpp/include/libavutil/avutil.h:289:
In file included from ../../../../src/main/cpp/include/libavutil/common.h:401:
In file included from ../../../../src/main/cpp/include/libavutil/mem.h:33:
../../../../src/main/cpp/include/libavutil/error.h:121:5: warning: non-constant static local variable in inline function may be different in different files [-Wstatic-local-in-inline]
static char str[AV_ERROR_MAX_STRING_SIZE];
^
../../../../src/main/cpp/include/libavutil/error.h:119:1: note: use 'static' to give inline function 'av_err2str' internal linkage
av_always_inline char *av_err2str(int errnum) {
^
static
../../../../src/main/cpp/include/libavutil/attributes.h:37:30: note: expanded from macro 'av_always_inline'
# define av_always_inline __attribute__((always_inline)) inline
^
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:63:54: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const jbyte *' (aka 'const signed char *') converts between pointers to integer types with different sign [-Wpointer-sign]
(*env)->SetByteArrayRegion(env, jarray, 0, size, buf);
^~~
2 warnings generated.
[2/2] Linking C shared library ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libdjivideojni.so
FAILED: : && /Users/kevin_watkins/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi23 --gcc-toolchain=/Users/kevin_watkins/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 --sysroot=/Users/kevin_watkins/Library/Android/sdk/ndk-bundle/sysroot -fPIC -isystem /Users/kevin_watkins/Library/Android/sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot /Users/kevin_watkins/Library/Android/sdk/ndk-bundle/platforms/android-23/arch-arm -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--exclude-libs,libunwind.a -L/Users/kevin_watkins/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libdjivideojni.so -o ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libdjivideojni.so CMakeFiles/djivideojni.dir/src/main/cpp/dji_video_jni.c.o ../../../../src/main/cpp/lib/armeabi-v7a/libffmpeg.so -llog -latomic -lm && :
/Users/kevin_watkins/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: ../../../../src/main/cpp/lib/armeabi-v7a/libffmpeg.so:1:9: syntax error, unexpected STRING
/Users/kevin_watkins/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: ../../../../src/main/cpp/lib/armeabi-v7a/libffmpeg.so: not an object or archive
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:42: error: undefined reference to 'av_register_all'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:44: error: undefined reference to 'av_codec_next'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:76: error: undefined reference to 'avcodec_register_all'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:77: error: undefined reference to 'av_register_all'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:80: error: undefined reference to 'avcodec_find_decoder'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:81: error: undefined reference to 'avcodec_alloc_context3'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:82: error: undefined reference to 'av_parser_init'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:94: error: undefined reference to 'avcodec_open2'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:99: error: undefined reference to 'av_frame_alloc'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:120: error: undefined reference to 'av_init_packet'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:129: error: undefined reference to 'av_parser_parse2'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:162: error: undefined reference to 'av_free_packet'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:214: error: undefined reference to 'avcodec_close'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:218: error: undefined reference to 'av_free'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:219: error: undefined reference to 'av_free'
/grindhouse/workspace/rosettadrone-1.2.1/app/src/main/cpp/dji_video_jni.c:220: error: undefined reference to 'av_parser_close'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
I think I know the issue, it has to do with those files using Git Large File Storage (git lfs) You may want to add that to the README, similar to the important bullet at https://github.com/DJI-Mobile-SDK-Tutorials/Android-VideoStreamDecodingSample and pointing to installation of https://github.com/git-lfs/git-lfs/wiki/Installation
After installing git lfs, I then got:
Downloading app/src/main/cpp/lib/arm64-v8a/libffmpeg.so (20 MB)
Error downloading object: app/src/main/cpp/lib/arm64-v8a/libffmpeg.so (b5d53aa): Smudge error: Error downloading app/src/main/cpp/lib/arm64-v8a/libffmpeg.so (b5d53aa66e88d04079d6217f425d3ba39340d997f083f1682f78036e523f1418): batch response: Post https://github.com/diux-dev/rosettadrone.git/info/lfs/objects/batch: x509: certificate signed by unknown authority
So then to ignore verification:
GIT_SSL_NO_VERIFY=1 git clone https://github.com/diux-dev/rosettadrone.git
This then compiled and linked successfully.
@kwatkins details work for me. Thank you.
I have the same error ! How to solve it ?
I already tried : GIT_SSL_NO_VERIFY=1 git clone https://github.com/diux-dev/rosettadrone.git
Build command failed.
Error while executing process /home/kiki/Android/Sdk/cmake/3.10.2.4988404/bin/cmake with arguments {--build /home/kiki/Téléchargements/rosettadrone/app/.externalNativeBuild/cmake/debug/armeabi-v7a --target djivideojni}
[1/2] Building C object CMakeFiles/djivideojni.dir/src/main/cpp/dji_video_jni.c.o
In file included from ../../../../src/main/cpp/dji_video_jni.c:4:
In file included from ../../../../src/main/cpp/ffmpeg.h:34:
In file included from ../../../../src/main/cpp/cmdutils.h:28:
In file included from ../../../../src/main/cpp/include/libavcodec/avcodec.h:31:
In file included from ../../../../src/main/cpp/include/libavutil/samplefmt.h:24:
In file included from ../../../../src/main/cpp/include/libavutil/avutil.h:289:
In file included from ../../../../src/main/cpp/include/libavutil/common.h:401:
In file included from ../../../../src/main/cpp/include/libavutil/mem.h:33:
../../../../src/main/cpp/include/libavutil/error.h:121:5: warning: non-constant static local variable in inline function may be different in different files [-Wstatic-local-in-inline]
static char str[AV_ERROR_MAX_STRING_SIZE];
^
../../../../src/main/cpp/include/libavutil/error.h:119:1: note: use 'static' to give inline function 'av_err2str' internal linkage
av_always_inline char *av_err2str(int errnum) {
^
static
../../../../src/main/cpp/include/libavutil/attributes.h:37:30: note: expanded from macro 'av_always_inline'
# define av_always_inline __attribute__((always_inline)) inline
^
../../../../src/main/cpp/dji_video_jni.c:63:54: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const jbyte *' (aka 'const signed char *') converts between pointers to integer types with different sign [-Wpointer-sign]
(*env)->SetByteArrayRegion(env, jarray, 0, size, buf);
^~~
2 warnings generated.
[2/2] Linking C shared library ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libdjivideojni.so
FAILED: ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libdjivideojni.so
: && /home/kiki/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7-none-linux-androideabi23 --gcc-toolchain=/home/kiki/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64 -fPIC --sysroot /home/kiki/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mfpu=vfpv3-d16 -fno-addrsig -mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libdjivideojni.so -o ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libdjivideojni.so CMakeFiles/djivideojni.dir/src/main/cpp/dji_video_jni.c.o ../../../../src/main/cpp/lib/armeabi-v7a/libffmpeg.so /home/kiki/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/23/liblog.so -latomic -lm && :
/home/kiki/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: ../../../../src/main/cpp/lib/armeabi-v7a/libffmpeg.so:1:9: syntax error, unexpected STRING
/home/kiki/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: ../../../../src/main/cpp/lib/armeabi-v7a/libffmpeg.so: not an object or archive
../../../../src/main/cpp/dji_video_jni.c:42: error: undefined reference to 'av_register_all'
../../../../src/main/cpp/dji_video_jni.c:44: error: undefined reference to 'av_codec_next'
../../../../src/main/cpp/dji_video_jni.c:76: error: undefined reference to 'avcodec_register_all'
../../../../src/main/cpp/dji_video_jni.c:77: error: undefined reference to 'av_register_all'
../../../../src/main/cpp/dji_video_jni.c:80: error: undefined reference to 'avcodec_find_decoder'
../../../../src/main/cpp/dji_video_jni.c:81: error: undefined reference to 'avcodec_alloc_context3'
../../../../src/main/cpp/dji_video_jni.c:82: error: undefined reference to 'av_parser_init'
../../../../src/main/cpp/dji_video_jni.c:94: error: undefined reference to 'avcodec_open2'
../../../../src/main/cpp/dji_video_jni.c:99: error: undefined reference to 'av_frame_alloc'
../../../../src/main/cpp/dji_video_jni.c:120: error: undefined reference to 'av_init_packet'
../../../../src/main/cpp/dji_video_jni.c:129: error: undefined reference to 'av_parser_parse2'
../../../../src/main/cpp/dji_video_jni.c:162: error: undefined reference to 'av_free_packet'
../../../../src/main/cpp/dji_video_jni.c:214: error: undefined reference to 'avcodec_close'
../../../../src/main/cpp/dji_video_jni.c:218: error: undefined reference to 'av_free'
../../../../src/main/cpp/dji_video_jni.c:219: error: undefined reference to 'av_free'
../../../../src/main/cpp/dji_video_jni.c:220: error: undefined reference to 'av_parser_close'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
After weeks of download : I live in Africa ... Difficult to build APK ! Android will kill me ...
I had this problem too and the way I solved was doing this (Windows):
git lfs install
It should say "Git LFS initialized." Then
GIT_SSL_NO_VERIFY=1 git clone https://github.com/diux-dev/rosettadrone.git
After that I could finally build the apk.
I thought I removed the LFS dependency from this repository, but I guess not. This'll be fixed in the next update most likely in the next few weeks. It'll also update the SDK to 4.10
Ok it works now ! 3min build and apk generated in app/build/outputs/apk/release with name app-release-unsigned.apk
Unable to install on my android device : "package seems corrupt". Any idea ? What should I miss ?
For all. You can install git lfs. However, It hasn't helped for me. After messing around cmake and ninja, I needed t to check linking error as described above. I figured out that libffmpeg.so size is different to one downloaded manually from here https://github.com/diux-dev/rosettadrone/blob/master/app/src/main/cpp/lib/armeabi-v7a/libffmpeg.so
Also, I don't know exact reason but arm64-v8a libffmpeg cant be linked.
error adding symbols: File in wrong format ffmpeg.so
I downloaded from here the same lib https://github.com/yixia/VitamioBundleStudio/blob/master/vitamio/libs/arm64-v8a/libffmpeg.so and at least I was able to build project.
I'm using Lunux and Android Studio.
git lfs doesn't help, I'm agree with @engenegr What help is : GIT_SSL_NO_VERIFY=1 git clone https://github.com/diux-dev/rosettadrone.git
Then I did that : https://github.com/diux-dev/rosettadrone/issues/30
Removed android.enableAapt2=false in gradle.properties
@kikislater Cant confirm environment variable option because I've repeated it again and It didn't work. Dependencies weren't properly downloaded. I guess there must be a better way to include them into project.
I confirm that release archive 1.2.1 also has incomplete libffmpeg.so file.
Such a long way to go to launch my Mavic...
Using GIT_SSL_NO_VERIFY=1
works with one of the forks of the project
https://github.com/darienmt/rosettadrone
Be careful, in this fork DJI SDK key is provided via environment, not xml file.
@kikislater , can you say, what Android version and what equipment do you use for controlling your drone with rosetta? Because It just doesn't work on my Huawei Mate 20 with 9.0 (28) Android. I try to find a way to make things work.
Of course ! Android 7 with Miui customisation on Xiaomi Redmi note 4 (4gb ram / 64gb storage). I will upgrade to another model so may be I will have android 9. Ton of issue I read with Android 9 like emlid reach app is not working due to network scanning disable by Google since this version ... Hope Xiaomi deal with a workaround for that !
@kikislater Thanks! Right now I'm looking for cheap phones with Android 8 so you help me to make informed decision.
May be Huawei kill rosetta when it's in background. Check if there is an option for that !
Reporting for those who decide to get rid from DJI software.
Android 9 doesn't work with rosetta.
I've checked and found that 8.1 (API 27) is good for it.
I was able to launch it on very cheap smartphone in a matter of minutes. While I spent hours for Android 9 and powerful Huawei Mate 20.
Appreciate the feedback from all of you.
Here's a brief rundown of where we stand on this application:
The version in this repo does not work on 9+. This is due to the current version of the DJI SDK. This is updated to 4.10, which includes support all the way through Mavic 2 dual.
The LFS requirement is well, dumb. It'll be removed and the binaries optimized.
We cannot test on Huawei devices, nor help you troubleshoot (sorry). No way around this for this. That said, we mostly have tested on Samsung devices, but support for other OEMs (at least LG) should be significantly improved.
We plan to release the updated version later this month, updates are few and far between since this is basically a side project that I have to allot time for during work hours, as well as there's a lot of red tape around this due to being a government open source project. That said, I do read all the issues that are open here as soon as I'm notified of them, I just don't have time to respond generally.
@sjd69 thank you very much.
I will find new device and test application in the field soon. I'm very grateful for your recommendation about architecture, this could save equipment.
Getting this error w/ native compiling, on a mac, using Android Studio etc