bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.6k stars 1.59k forks source link

java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil in Marshmallow #245

Closed boybeak closed 8 years ago

boybeak commented 9 years ago
mFrameRecorder = new FFmpegFrameRecorder(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath() + File.separator + "new.mp4", 480, 480, 1);

crash happened in this code after i update my nexus5 to Marshmallow,and it works fine before.And the error log below:

10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime: FATAL EXCEPTION: main
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime: Process: com.beak.petsfbi, PID: 22095
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at java.lang.Class.classForName(Native Method)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at java.lang.Class.forName(Class.java:324)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacpp.Loader.load(Loader.java:390)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacpp.Loader.load(Loader.java:358)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1407)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.beak.petsfbi.activity.VideoRecorderActivity.startRecord(VideoRecorderActivity.java:177)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.beak.petsfbi.activity.VideoRecorderActivity$1.onClick(VideoRecorderActivity.java:57)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.view.View.performClick(View.java:5198)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.view.View$PerformClick.run(View.java:21147)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.os.Handler.handleCallback(Handler.java:739)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:95)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:148)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5417)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
pedroSG94 commented 8 years ago

I tried with those binaries and know crash with this error:

A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 16167

Only a line no more log. According this post: https://hub.jmonkeyengine.org/t/adnroid-project-fails-with-a-libc-fatal-signal-11-sigsegv-code-2-fault-addr-0x40a00000-in-tid-21434-gcdaemon/34034/3

Native libc tries to access invalid address

pedroSG94 commented 8 years ago

more log for my error:

05-13 12:04:22.199 20760-20760/com.example.pedro.ffmpeg30 A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 20760 (.pedro.ffmpeg30)
05-13 12:04:22.307 371-371/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-13 12:04:22.313 371-371/? A/DEBUG: Build fingerprint: 'google/shamu/shamu:6.0.1/MMB29K/2419427:user/release-keys'
05-13 12:04:22.314 371-371/? A/DEBUG: Revision: '0'
05-13 12:04:22.314 371-371/? A/DEBUG: ABI: 'arm'
05-13 12:04:22.316 371-371/? A/DEBUG: pid: 20760, tid: 20760, name: .pedro.ffmpeg30  >>> com.example.pedro.ffmpeg30 <<<
05-13 12:04:22.316 371-371/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
05-13 12:04:22.319 371-371/? W/debuggerd: type=1400 audit(0.0:145): avc: denied { search } for name="com.example.pedro.ffmpeg30" dev="dm-1" ino=539446 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
05-13 12:04:22.343 371-371/? A/DEBUG:     r0 00000000  r1 00000002  r2 b684b031  r3 b3a53e7c
05-13 12:04:22.343 371-371/? A/DEBUG:     r4 b3a4f594  r5 b67fba61  r6 ab482d04  r7 00000001
05-13 12:04:22.343 371-371/? A/DEBUG:     r8 b6f866ec  r9 0000000b  sl ab482d04  fp b6f7f2fc
05-13 12:04:22.343 371-371/? A/DEBUG:     ip fffffe8c  sp becaf850  lr b39f2ec1  pc b39f458a  cpsr 000d0030
05-13 12:04:22.329 371-371/? W/debuggerd: type=1400 audit(0.0:146): avc: denied { search } for name="com.example.pedro.ffmpeg30" dev="dm-1" ino=539446 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
05-13 12:04:22.364 371-371/? A/DEBUG:     #00 pc 0001a58a  /data/data/com.example.pedro.ffmpeg30/cache/javacpp13478039802826/libc.so
05-13 12:04:22.364 371-371/? A/DEBUG:     #01 pc 00016695  /data/data/com.example.pedro.ffmpeg30/cache/javacpp13478039802826/libc.so
05-13 12:04:22.364 371-371/? A/DEBUG:     #02 pc 00002465  /system/bin/linker (__dl__ZN6soinfo13call_functionEPKcPFvvE+48)
05-13 12:04:22.365 371-371/? A/DEBUG:     #03 pc 0000252f  /system/bin/linker (__dl__ZN6soinfo10call_arrayEPKcPPFvvEjb+134)
05-13 12:04:22.365 371-371/? A/DEBUG:     #04 pc 000026f5  /system/bin/linker (__dl__ZN6soinfo17call_constructorsEv+160)
05-13 12:04:22.365 371-371/? A/DEBUG:     #05 pc 00006115  /system/bin/linker (__dl__Z9do_dlopenPKciPK17android_dlextinfo+224)
05-13 12:04:22.365 371-371/? A/DEBUG:     #06 pc 00001c95  /system/bin/linker (__dl_dlopen+20)
05-13 12:04:22.365 371-371/? A/DEBUG:     #07 pc 0025b13b  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+650)
05-13 12:04:22.369 371-371/? A/DEBUG:     #08 pc 002d13d7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
05-13 12:04:22.370 371-371/? A/DEBUG:     #09 pc 738b0105  /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x1ec9000)
05-13 12:04:22.359 371-371/? W/debuggerd: type=1400 audit(0.0:147): avc: denied { search } for name="com.example.pedro.ffmpeg30" dev="dm-1" ino=539446 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
05-13 12:04:22.668 371-371/? E/DEBUG: AM write failed: Broken pipe
05-13 12:04:22.669 863-879/? I/BootReceiver: Copying /data/tombstones/tombstone_06 to DropBox (SYSTEM_TOMBSTONE)
05-13 12:04:22.679 863-20795/? W/ActivityManager:   Force finishing activity com.example.pedro.ffmpeg30/.MainActivity
05-13 12:04:22.717 863-20795/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 104)
05-13 12:04:22.719 863-20795/? W/ActivityManager: Exception thrown during pause
                                                  android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
                                                      at android.os.BinderProxy.transactNative(Native Method)
                                                      at android.os.BinderProxy.transact(Binder.java:503)
                                                      at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:727)
                                                      at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:867)
                                                      at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2907)
                                                      at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2763)
                                                      at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2760)
                                                      at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:12037)
                                                      at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:11933)
                                                      at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12622)
                                                      at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:12129)
                                                      at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
05-13 12:04:22.735 275-275/? E/lowmemorykiller: Error writing /proc/20760/oom_score_adj; errno=22
05-13 12:04:22.776 863-5760/? I/OpenGLRenderer: Initialized EGL, version 1.4
05-13 12:04:22.799 387-387/? I/Zygote: Process 20760 exited due to signal (11)
05-13 12:04:22.800 863-1693/? I/ActivityManager: Process com.example.pedro.ffmpeg30 (pid 20760) has died
05-13 12:04:22.827 4337-4337/? I/MicroDetectionWorker: Micro detection mode: [mDetectionMode: [1]].
05-13 12:04:22.841 4337-20799/? I/MicroRecognitionRunner: Starting detection.
05-13 12:04:22.841 4337-18339/? I/MicrophoneInputStream: mic_starting com.google.android.apps.gsa.speech.audio.ah@a5e2527
05-13 12:04:22.845 374-20802/? I/AudioFlinger: AudioFlinger's thread 0xb28c0000 ready to run
05-13 12:04:22.846 374-1270/? I/SoundTriggerHwService::Module: void android::SoundTriggerHwService::Module::onCallbackEvent(const android::sp<android::SoundTriggerHwService::CallbackEvent>&) mClient == 0
05-13 12:04:22.847 4337-18339/? I/MicrophoneInputStream: mic_started com.google.android.apps.gsa.speech.audio.ah@a5e2527
05-13 12:04:22.857 374-20802/? D/audio_hw_primary: select_devices: out_snd_device(0: none) in_snd_device(61: voice-rec-mic)
05-13 12:04:22.857 374-20802/? D/msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(61) acdb_id(62)
05-13 12:04:22.857 374-20802/? D/audio_hw_primary: enable_snd_device: snd_device(61: voice-rec-mic)
05-13 12:04:22.861 374-20802/? D/audio_hw_primary: enable_audio_route: apply and update mixer path: audio-record
05-13 12:04:22.871 4337-20800/? I/DeviceStateChecker: DeviceStateChecker cancelled
05-13 12:04:22.874 4337-4337/? I/MicroDetector: Keeping mic open: false
05-13 12:04:22.874 4337-4337/? I/MicrophoneInputStream: mic_close com.google.android.apps.gsa.speech.audio.ah@a5e2527
05-13 12:04:22.875 4337-18339/? E/AudioRecord-JNI: Error -4 during AudioRecord native read
05-13 12:04:22.989 374-20802/? D/audio_hw_primary: disable_audio_route: reset and update mixer path: audio-record
05-13 12:04:22.991 374-20802/? D/audio_hw_primary: disable_snd_device: snd_device(61: voice-rec-mic)
05-13 12:04:22.996 374-1270/? I/SoundTriggerHwService::Module: void android::SoundTriggerHwService::Module::onCallbackEvent(const android::sp<android::SoundTriggerHwService::CallbackEvent>&) mClient == 0
05-13 12:04:22.998 4337-20799/? I/MicroRecognitionRunner: Detection finished
05-13 12:04:22.999 4337-4688/? I/MicroRecognitionRunner: Stopping hotword detection.
05-13 12:04:23.384 1751-1935/? W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
05-13 12:04:26.936 863-1325/? D/WifiStateMachine: starting scan for "Droiders-dev"WPA_PSK with 5240,2462,2437
05-13 12:04:33.311 863-875/? I/UsageStatsService: User[0] Flushing usage stats to disk
05-13 12:04:40.319 863-2032/? D/NetlinkSocketObserver: NeighborEvent{elapsedMs=13496201, 192.168.2.1, [A0481CB8D7BD], RTM_NEWNEIGH, NUD_PROBE}
05-13 12:04:46.939 863-1325/? D/WifiStateMachine: starting scan for "Droiders-dev"WPA_PSK with 5240,2462,2437
05-13 12:04:58.191 863-2032/? D/NetlinkSocketObserver: NeighborEvent{elapsedMs=13514072, 192.168.2.1, [A0481CB8D7BD], RTM_NEWNEIGH, NUD_STALE}
saudet commented 8 years ago

@pedroSG94 It looks like you're hitting bug https://github.com/bytedeco/javacv/issues/133. Please follow the workaround, or if you don't like it, please report the problem upstream to Google. If you don't complain, they will not listen.

pedroSG94 commented 8 years ago

this link is down

https://oss.sonatype.org/content/repositories/snapshots/org/bytedeco/javacv/1.2-SNAPSHOT/ https://oss.sonatype.org/content/repositories/snapshots/org/bytedeco/javacpp/1.2-SNAPSHOT/

saudet commented 8 years ago

Yes, version 1.2 has been released. Please use that version: http://search.maven.org/#search|ga|1|bytedeco

saudet commented 8 years ago

And thanks to you all for helping me debug this!!

jsichi commented 8 years ago

@pedroSG94 : I hit the same sigsegv stack as you. To fix it, besides upgrading to 1.2, I also needed to use 1.2.1 for the version of the javacpp artifact (even though all of the other artifacts are currently at 1.2.

So in my build.sbt:

libraryDependencies ++= Seq(
  "org.bytedeco"                 % "javacpp"         % "1.2.1",
  "org.bytedeco"                 % "javacv"          % "1.2",
  "org.bytedeco.javacpp-presets" % "opencv" % "3.1.0-1.2" classifier "",
  "org.bytedeco.javacpp-presets" % "opencv" % "3.1.0-1.2" classifier "android-arm",
  "org.bytedeco.javacpp-presets" % "ffmpeg" % "3.0.2-1.2" classifier "",
  "org.bytedeco.javacpp-presets" % "ffmpeg" % "3.0.2-1.2") classifier "android-arm"
)
praveen-kanwar commented 7 years ago

In gradle simply put this lines

compile(group: 'org.bytedeco', name: 'javacv-platform', version: '1.3'){
exclude group: 'org.bytedeco.javacpp-presets'
}
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-arm'
monxarat commented 7 years ago

@praveen-kanwar Thank you so much.