How to use ANativeWindow_setBuffersDataSpace in NDK? - android

When I use ANativeWindow_setBuffersDataSpace in NDK,it prompts no error.But I build the project,the logcat shows that
"undefined reference to ANativeWindow_setBuffersDataSpace'clang++: error: linker command failed with exit code 1 " . However I can find this API in native_window.h "__INTRODUCED_IN(28);"and I set minsdk 28.

Add libnativewindow.so to linked libraries, e.g. if you use CMake:
add_library(MainActivity SHARED MainActivity.cpp)
target_link_libraries(MainActivity
android
native_app_glue
EGL
GLESv1_CM
nativewindow
)

Related

warning: libcryptopp.so: is missing DT_SONAME will use basename as a replacement

I am trying to build libcryptopp.so and include it in my JNI code, follow the guide in Android Crypto++, I experienced the following problems.
Missing symbol problems in Crypto++ 5.6.3
Originally I used Crypto++ 5.6.3, I came across this problem:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_Z9GlobalRNGv"
referenced by "/data/app/com.example.administrator.jnitest-2/lib/arm/libcryptopp.so"...
I check the libcryptopp.so:
$ readelf -Ws libcryptopp.so | grep _Z9GlobalRNGv
1406: 00000000 0 NOTYPE GLOBAL DEFAULT UND _Z9GlobalRNGv
15836: 00000000 0 NOTYPE GLOBAL DEFAULT UND _Z9GlobalRNGv
switching to Crypto++ 5.6.4 fix this problem, but I still do not know the cause and met another problem:
Missing DT_SONAME
12-21 09:50:20.837 21677-21677/com.example.administrator.jnitest
W/linker: /data/app/com.example.administrator.jnitest- 1/lib/arm/libcryptopp.so: is missing DT_SONAME will use basename as a
replacement: "libcryptopp.so"
Actually this is only a warning, app will not crash.
I am using the latest version of android Mashwallow MOB31K.
Somebody have also experienced similar problems using other libraries
https://github.com/bytedeco/javacpp-presets/issues/188
on Android N-preview.
Why am I getting the warning, and how do I fix it?
After some attempts, I find one imperfect solution.
It appears that android N turns requires library version now.
turn on SONAME flag on build.
Cryptopp turns off the version flag by defaults. In the GNUmakefile-cross,:
HAS_SOLIB_VERSION ?= 0
set the value to 1:
HAS_SOLIB_VERSION ?= 1
build, and then use the generated .so file. the warning will go.
the problem is that is library will not work on android 5.0. So we'd better leave alone this warning now.

Linker error Android - ndk :undefined reference to `G_STATIC_ASSERT'

I am Building android project for arm64-v8 and I am using NDK-r10e.I have build build Libnice 0.13 using its dependency (Glib 2.35.8) and I have all the dependencies of Glib compiled(intl,iconv,ffi).
So I was successfull in building the static libraries of Glib and then using my glib libraries to build a Libnice static library .
Now I am using these static libraries to build my android project ,I am getting the following errors and i have no clue why its giving me this linker errors because at the time of building those libraries everything was fine for me.
libnice.a(pseudotcp.o): In function `pseudo_tcp_socket_get_type':
/Users/aagman/Desktop/LibNIce/libnic/Newlibnice/jni/files/agent/pseudotcp.c:78: undefined reference to `G_STATIC_ASSERT'
In function `nice_agent_get_type':
/Users/aagman/Desktop/LibNIce/libnic/Newlibnice/jni/files/agent/agent.c:85: undefined reference to `G_STATIC_ASSERT'
/Users/aagman/Desktop/LibNIce/libnic/Newlibnice/jni/files/agent/agent.c:85: undefined reference to `G_STATIC_ASSERT'
This error occur if the address of an "unsigned int" is passed for a 64 bit build, which would be okay for a 32 bit build but should be an unsigned long for 64 bit. Pass -m64 / -m32 on the command line to control the build target.

How to make Eclipse work with Gstreamer SDK?

I try to develop an Android app using Gstreamer. I use Fedora 20 with installed Eclipse with ADT and NDT, Android SDK and NDK, gstreamer SDK for Android. But something goes wrong, when I try to build tutorials.
Everything is OK, when I build NDK samples (like hello-jni), but building is not complited working with samples from gstreamer SDK (definitely it is android-tutorial-1 from [gstreamer sdk installation]/share/gst-sdk/tutorials/). Here is what i see in log:
13:13:10 **** Auto Build of configuration Default for project Tutorial1 ****
/home/staslatgttt/work/android-ndk-r10c/ndk-build all
GStreamer : [GEN] => gst-build/gstreamer_android.c
GStreamer : [COMPILE] => gst-build/gstreamer_android.c
GStreamer : [LINK] => gst-build/libgstreamer_android.so
/home/staslatgttt/work/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/staslatgttt/work/gstreamer-sdk-android-arm-debug-2013.6//lib/libgstreamer-0.10.a(libgstparse_la-lex.priv_gst_parse_yy.o): in function priv_gst_parse_yylex:lex.priv_gst_parse_yy.c:1598: error: undefined reference to '__srget'
/home/staslatgttt/work/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/staslatgttt/work/gstreamer-sdk-android-arm-debug-2013.6//lib/libglib-2.0.a(libcharset_la-localcharset.o): in function _g_locale_get_charset_aliases:localcharset.c:158: error: undefined reference to '__srget'
/home/staslatgttt/work/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/staslatgttt/work/gstreamer-sdk-android-arm-debug-2013.6//lib/libglib-2.0.a(libcharset_la-localcharset.o): in function _g_locale_get_charset_aliases:localcharset.c:167: error: undefined reference to '__srget'
/home/staslatgttt/work/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/staslatgttt/work/gstreamer-sdk-android-arm-debug-2013.6//lib/libintl.a(localcharset.o): in function locale_charset:./localcharset.c:195: error: undefined reference to '__srget'
/home/staslatgttt/work/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/staslatgttt/work/gstreamer-sdk-android-arm-debug-2013.6//lib/libintl.a(log.o): in function __sputc:/home/slomo/Projects/android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.7/include-fixed/stdio.h:376: error: undefined reference to '__swbuf'
collect2: ld returned 1 exit status
make: *** [buildsharedlibrary] Error 1
13:13:11 Build Finished (took 972ms)
I tried to surf Internet, but I didn't find useful explanation how to solve this problem. All I understood is that problem is connected to Gold Linker. Only on this site http://docs.gstreamer.com/display/GstSDK/Installing+for+Android+development is a small tip about problems with Gold Linker on Windows, but I use Linux! Anyway, if I wanted to solve this problem on Windows, "this project" link mentioned there is not avaliable.
Can anyone help me with this? I don't know, what I do wrong, but I really need to solve this problem.
The NDK r10c wasn't support till 11-10-2014.
"The Android binaries are now built with the r10c NDK and as such binary compatible again with all NDK and Android releases" - http://gstreamer.freedesktop.org/
Try it again with the latest NDK and GStreamer Android SDK.
I encountered the same error... Google removed __srget starting from NDKr10c (check their official site in other fixed bugs). Downgrade to r10b or below and it should work.

Can't build streamer tutorial for android on mac

Can't build streamer tutorial_3 for android on mac
I,ve got all environment variables needed.
My eclipse can't to resolve some symbols, but to some of them i can get by pushing F3. It's very strange for me.
Here is the command line output:
23:04:06 **** Build of configuration Default for project Tutorial3 ****
/Users/antonivanuskin/android-develop/android-ndk-r10/ndk-build all
GStreamer : [GEN] => gst-build-armeabi/gstreamer_android.c
GStreamer : [COMPILE] => gst-build-armeabi/gstreamer_android.c
GStreamer : [LINK] => gst-build-armeabi/libgstreamer_android.so
lto1: fatal error: bytecode stream generated with LTO version 2.2 instead of the expected 3.0
compilation terminated.
lto-wrapper: /Users/antonivanuskin/android-develop/android-ndk-r10/toolchains/arm- linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc returned 1 exit status
/Users/antonivanuskin/android-develop/android-ndk-r10/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.gold: fatal error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [buildsharedlibrary_armeabi] Error 1
23:04:10 Build Finished (took 3s.740ms)*
I use ndk-10r and gst-1.4.0.
I know that there is no interfaces/xoverlay in new streamer.
EDIT
I've built ok, but steel got underlines of many glib-types and GST-macross. Here is a screenshot:
what is interesting that i have no underlined headers, for example: i've include pthread.h but have got underlined pthread_t and phtread_key_t....
i think that i have not install some general libraries on my mac, something like libc or what ever...may it couse this problem? The problem is that i can't run my app from eclipse. and for more: i use DS-5 CE IDE
This is most likely because we build the android 1.4.x cerbero packages with the r9d NDK.
You might want to use the r9d NDK until we provide binaries built with a more recent NDK (started some builds to see if everything goes through fine).

Debug Wrong library or version mismatch

I am trying to debug my iOS to android conversion and find this warning:
warning: .dynamic section for "/Users/MacUser/.apportable/cache/devices/033f426d/libs/libxml2.so" is not at the expected address (wrong library or version mismatch?)
warning: Could not load shared library symbols for 8 libraries, e.g. libdiag.so.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
The thing is the file exists at the path specified. Totally lost as to why this warning is occurring. Any ideas/input? Oh also i forgot to mention i ran the command [info sharedLibrary] it returns nothing
Un-copied library:
pull: /system/lib/libxt_native.so -> /Users/MacUser/.apportable/cache/devices/033f426d/libs/libxt_native.so
failed to copy '/system/lib/libxt_native.so' to '/Users/MacUser/.apportable/cache/devices/033f426d/libs/libxt_native.so': No such file or directory
try doing apportable clean_device_cache and running again

Categories

Resources