aacdecoder-android icon indicating copy to clipboard operation
aacdecoder-android copied to clipboard

Text relocations and crash in android 6.0

Open wildfatduck opened this issue 9 years ago • 25 comments

When decoder library is loaded we have this warning:

W/linker: libaacdecoder.so has text relocations. This is wasting memory and prevents security hardening. Please fix.

But, if we set build target to API 23 and run this app on android 6.0 (emulator or device, doesnt matter) this causes exception and app force close.

wildfatduck avatar Sep 26 '15 04:09 wildfatduck

I can confirm that setting the target SDK version to 23 causes my app to crash when playing AACPlayer. It does not crash when the target SDK version is 22. This was tested on the Marshmallow armeabi-v7a emulator.

The issue is that the native components have text relations, and Marshmallow won't load them. Earlier versions of Android would load native components even if they had text relocations.

I believe the solution is to recompile with the latest version of the NDK, and make sure there are no text relocations. More:

  • http://slowbutdeadly.blogspot.mk/2015/09/javalangunsatisfiedlinkerror-dlopen.html
  • http://stackoverflow.com/questions/32346402/libavcodec-so-has-text-relocations

I have not rebuilt the aacdecoder components yet myself, since I will target SDK version 22 for the time being.

gc435 avatar Oct 19 '15 22:10 gc435

Recompile with the latest version of the NDK is not helped

wildfatduck avatar Oct 20 '15 14:10 wildfatduck

Fixed here.

tarigo avatar Dec 01 '15 15:12 tarigo

@tarigo

Hmm.. when I've used *.so files that I've compiled from your code I'm getting this:

12-11 20:40:10.142 1888-1888/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 12-11 20:40:10.142 1888-1888/? A/DEBUG: Build fingerprint: 'google/shamu/shamu:6.0/MRA58R/2308909:user/release-keys' 12-11 20:40:10.142 1888-1888/? A/DEBUG: Revision: '0' 12-11 20:40:10.142 1888-1888/? A/DEBUG: ABI: 'arm' 12-11 20:40:10.142 1888-1888/? A/DEBUG: pid: 5741, tid: 5787, name: Thread-64612 >>> com.myapp:audio <<< 12-11 20:40:10.142 1888-1888/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 12-11 20:40:10.157 1888-1888/? A/DEBUG: r0 a7c64940 r1 9c6f74b0 r2 00000000 r3 9c6f74b0 12-11 20:40:10.157 1888-1888/? A/DEBUG: r4 00000000 r5 1328c580 r6 13256f40 r7 a7c64940 12-11 20:40:10.157 1888-1888/? A/DEBUG: r8 708fb340 r9 acbdf400 sl 9c6f77ec fp 9c6f76c4 12-11 20:40:10.157 1888-1888/? A/DEBUG: ip a8283231 sp 9c6f7470 lr a026a0ab pc a8283246 cpsr a0070030 12-11 20:40:10.180 1888-1888/? A/DEBUG: backtrace: 12-11 20:40:10.181 1888-1888/? A/DEBUG: #00 pc 00004246 /data/app/com.myapp-2/lib/arm/libaacdecoder.so (Java_com_spoledge_aacdecoder_Decoder_nativeStart+21) 12-11 20:40:10.181 1888-1888/? A/DEBUG: #01 pc 02b990a9 /data/app/com.myapp-2/oat/arm/base.odex (offset 0x1365000) (int com.spoledge.aacdecoder.Decoder.nativeStart(int, com.spoledge.aacdecoder.BufferReader, com.spoledge.aacdecoder.Decoder$Info)+132) 12-11 20:40:10.181 1888-1888/? A/DEBUG: #02 pc 02b9928b /data/app/com.myapp-2/oat/arm/base.odex (offset 0x1365000) (com.spoledge.aacdecoder.Decoder$Info com.spoledge.aacdecoder.Decoder.start(com.spoledge.aacdecoder.BufferReader)+254) 12-11 20:40:10.181 1888-1888/? A/DEBUG: #03 pc 02b944d9 /data/app/com.myapp-2/oat/arm/base.odex (offset 0x1365000) (void com.spoledge.aacdecoder.AACPlayer.playImpl(java.io.InputStream, int)+428) 12-11 20:40:10.181 1888-1888/? A/DEBUG: #04 pc 02b93c4b /data/app/com.myapp-2/oat/arm/base.odex (offset 0x1365000) (void com.spoledge.aacdecoder.AACPlayer.play(java.io.InputStream, int)+198) 12-11 20:40:10.181 1888-1888/? A/DEBUG: #05 pc 02b93e25 /data/app/com.myapp-2/oat/arm/base.odex (offset 0x1365000) (void com.spoledge.aacdecoder.AACPlayer.play(java.lang.String, int)+312) 12-11 20:40:10.181 1888-1888/? A/DEBUG: #06 pc 02b906b7 /data/app/com.myapp-2/oat/arm/base.odex (offset 0x1365000) (void com.spoledge.aacdecoder.AACPlayer$1.run()+82) 12-11 20:40:10.182 1888-1888/? A/DEBUG: #07 pc 728608d1 /data/dalvik-cache/arm/system@[email protected] (offset 0x1eb1000) 12-11 20:40:10.796 1888-1888/? A/DEBUG: Tombstone written to: /data/tombstones/tombstone_09

Any ideas?

radzio avatar Dec 11 '15 19:12 radzio

@radzio Apparently segfault, memory SEGV_MAPERR - address not mapped to object. Without exact steps to reproduce I can guess only.

tarigo avatar Dec 14 '15 17:12 tarigo

@tarigo it was my fault. I didn't update java code. After it everything has started working like a charm! THX!

radzio avatar Dec 15 '15 09:12 radzio

could anyone provide the compiled files armeabi / libaacdecoder.so armeabi-v7a / libaacdecoder.so

thx so much

089apps avatar Jan 14 '16 14:01 089apps

@089apps Here it is :)

android.zip

lucViana avatar Jan 14 '16 15:01 lucViana

@tarigo how do I use your fork? sorry im noob yet with github but I need to use aacdecoder on android M. Can somebody please help me?

Informatheus avatar Mar 23 '16 18:03 Informatheus

@karaoak how do i use your fork?

Informatheus avatar Apr 12 '16 14:04 Informatheus

I'm already using the new lib and it works on Android M. I hosted the files, if someone want: https://mega.nz/#!EQIVTLIL!mwwakCztR5yd_VjAjS7TJ0kCKO3hrH5mqFkcth9SLc0

Informatheus avatar Apr 13 '16 14:04 Informatheus

@Informatheus where did u find it the new lib?

lucViana avatar Apr 13 '16 14:04 lucViana

@lucViana are the same that you posted. I only structured according to project folders and zipped with an instructions file. Very thanks.

Informatheus avatar Apr 13 '16 14:04 Informatheus

@Informatheus ooh great :)

lucViana avatar Apr 13 '16 14:04 lucViana

@lucViana you have no idea how much u helped me and other developers. How did you get the files? And from where?

Informatheus avatar Apr 13 '16 14:04 Informatheus

Hi Informatheus,

I see this lib is nice and could we improve further because there are some other issues as well in this lib.

  1. the network packets possible to drop during decoding time so now it is show the log that it is waiting, but there is not event or something to trigger to top level to inform users.
  2. sometimes it is stopped even there is stream available from the server. So if we could retry a few times before give up that would be better.
  3. improve the quality of audio

ravenet avatar Apr 28 '16 03:04 ravenet

Awesome, Informatheus , I am just using the new lib and testing a shoutcast audio/aacp on Eclipse Android 6.0 Emulator and it is working so f...ing awesome, thanks.

citerio avatar Jul 20 '16 01:07 citerio

Same thing on Android Studio 2, working great on Android 6.0 emulator.

citerio avatar Jul 20 '16 03:07 citerio

Just tested it on Nexus 5x with Nougat works like a charm after replacing the .jar and .so files with the ones from the zip provided on the link above. Thank you so very much :)

bkoruznjak avatar Jan 22 '17 01:01 bkoruznjak

"Informatheus" that's work!

a442509097 avatar Apr 03 '17 17:04 a442509097

I needed for 64bit (Oreo) for arm64-v8a, armeabi-v7a and x86

AppWerft avatar Nov 30 '18 13:11 AppWerft

I needed for 64bit (Oreo) for arm64-v8a, armeabi-v7a and x86

@AppWerft You can download the requsted so files from https://github.com/maximxt/aacdecoder-android/commit/fd8d24bd56fe10658e88d81b617d41536e480960

I have tested its working fine but this https://github.com/maximxt/aacdecoder-android/issues/1 issue occurs rarely.

mylselgan avatar Jul 30 '19 14:07 mylselgan

Currently I'm using a libs package from a phonegap project: https://github.com/AppWerft/HoerDat/tree/master/modules/android/com.woohoo.androidaudiostreamer/3.0.0/libs

AppWerft avatar Jul 30 '19 14:07 AppWerft

@AppWerft have you recreated your app from scratch using Phonegap or can we just use these .so files in our android app for 64 bit support? what about signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) crash issues?

mylselgan avatar Jul 30 '19 14:07 mylselgan

I found this libs in an phonegap project and I'm using it in my Titanium project. I never seen this crash.

AppWerft avatar Jul 30 '19 14:07 AppWerft