Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "av_version_info" referenced by "/data/app/com.domain.appname-1/lib/arm/libjniavutil.so"... #970

Closed
DeKinci opened this issue Apr 22, 2018 · 10 comments
Labels

Comments

@DeKinci
Copy link

DeKinci commented Apr 22, 2018

I'm currently getting this error on some devices (exactly on Meizu Pro 6) but on others with same cpu (Huawei Honor 9 Lite) everything works fine,
I use manual installation with unpacking .so files into jniLibs and relinker:

ReLinker.Logger logger = message -> Log.v("NativeLoader", message);

        ReLinker.log(logger).recursively().loadLibrary(context, "jniavcodec");
        ReLinker.log(logger).recursively().loadLibrary(context, "avcodec");

        ReLinker.log(logger).recursively().loadLibrary(context, "jniavdevice");
        ReLinker.log(logger).recursively().loadLibrary(context, "avdevice");

        ReLinker.log(logger).recursively().loadLibrary(context, "jniavfilter");
        ReLinker.log(logger).recursively().loadLibrary(context, "avfilter");

        ReLinker.log(logger).recursively().loadLibrary(context, "jniavformat");
        ReLinker.log(logger).recursively().loadLibrary(context, "avformat");

        ReLinker.log(logger).recursively().loadLibrary(context, "jniavutil");
        ReLinker.log(logger).recursively().loadLibrary(context, "avutil");

        ReLinker.log(logger).recursively().loadLibrary(context, "jnipostproc");
        ReLinker.log(logger).recursively().loadLibrary(context, "postproc");

        ReLinker.log(logger).recursively().loadLibrary(context, "jniswresample");
        ReLinker.log(logger).recursively().loadLibrary(context, "swresample");

        ReLinker.log(logger).recursively().loadLibrary(context, "jniswscale");
        ReLinker.log(logger).recursively().loadLibrary(context, "swscale");

This code is called from the first activity of application, before any library elements used.

This is log I have:

  E/ACRA (12118): Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "av_version_info" referenced by "/data/app/com.domain.appname-1/lib/arm/libjniavutil.so"... 
  E/ACRA (12118): at java.lang.Runtime.loadLibrary(Runtime.java:372) 
  E/ACRA (12118): at java.lang.System.loadLibrary(System.java:1076) 
  E/ACRA (12118): at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1220) 
  E/ACRA (12118): at org.bytedeco.javacpp.Loader.load(Loader.java:980) 
  E/ACRA (12118): at org.bytedeco.javacpp.Loader.load(Loader.java:879) 
  E/ACRA (12118): at org.bytedeco.javacpp.avutil.(avutil.java:10) 

What I found sometimes it goes with the com.domain.appname-1 directory, and sometimes with the com.domain.appname-2.

Also it worked in a couple of builds, but mostly not (I did not change anything in library loading)

@saudet
Copy link
Member

saudet commented Apr 22, 2018

Before jniavutil, you'll need to load avutil, and that before everything else (avcodec, avformat, etc)

@saudet saudet closed this as completed Apr 22, 2018
@DeKinci
Copy link
Author

DeKinci commented Apr 22, 2018

Well, I loaded all the non jni libs before all non-jni and avutils (with jniavutils) before all of them and that did not help

@saudet
Copy link
Member

saudet commented Apr 22, 2018

That's fine, but we still need to load avutil before anything else.

@DeKinci
Copy link
Author

DeKinci commented Apr 22, 2018

Yes, I do it like this:

        ReLinker.log(logger).recursively().loadLibrary(context, "avutil");
        ReLinker.log(logger).recursively().loadLibrary(context, "jniavutil");

        ReLinker.log(logger).recursively().loadLibrary(context, "avcodec");
        ReLinker.log(logger).recursively().loadLibrary(context, "jniavcodec");

        ReLinker.log(logger).recursively().loadLibrary(context, "avdevice");
        ReLinker.log(logger).recursively().loadLibrary(context, "jniavdevice");

        ReLinker.log(logger).recursively().loadLibrary(context, "avfilter");
        ReLinker.log(logger).recursively().loadLibrary(context, "jniavfilter");

        ReLinker.log(logger).recursively().loadLibrary(context, "avformat");
        ReLinker.log(logger).recursively().loadLibrary(context, "jniavformat");

        ReLinker.log(logger).recursively().loadLibrary(context, "postproc");
        ReLinker.log(logger).recursively().loadLibrary(context, "jnipostproc");

        ReLinker.log(logger).recursively().loadLibrary(context, "swresample");
        ReLinker.log(logger).recursively().loadLibrary(context, "jniswresample");

        ReLinker.log(logger).recursively().loadLibrary(context, "swscale");
        ReLinker.log(logger).recursively().loadLibrary(context, "jniswscale");

and it is not working

@saudet
Copy link
Member

saudet commented Apr 22, 2018

Please post the full Android log.

@DeKinci
Copy link
Author

DeKinci commented Apr 22, 2018

I don't have one. Error pops on a remote phone, and I only get ACRA repot, which (idk why) does not include relinker log (but includes android log, which I already posted)

@DeKinci
Copy link
Author

DeKinci commented Apr 24, 2018

Sorry, my bad: I called av_log_set_level(AV_LOG_DEBUG); before using relinker

@saudet
Copy link
Member

saudet commented Apr 24, 2018

Anyway, there's probably another avutil.so somewhere on that device that is interfering with the one from JavaCPP/JavaCV. You could rebuild from source and give it another name, but I'm wondering if something like described on https://github.com/bytedeco/javacpp-presets/wiki/The-UnsatisfiedLinkError-X-File-%28a-real-experience%29 works around that:

Loader.loadLibrary(new URL[0], "avutil");

@DeKinci
Copy link
Author

DeKinci commented Apr 24, 2018

I'll try that when whill get access to such device

saudet added a commit to bytedeco/javacpp that referenced this issue May 24, 2018
@saudet
Copy link
Member

saudet commented May 24, 2018

FYI, commit bytedeco/javacpp@f1f21ae should take care of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants