bblanchon / pdfium-binaries

📰 Binary distribution of PDFium
789 stars 166 forks source link

Shared libraries cannot locate symbol "__register_atfork", Android API 21-22-23 #147

Closed lion0508 closed 1 month ago

lion0508 commented 5 months ago

Hello, When im trying to use .so on Android 5.1, i received this error: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__register_atfork" referenced by "/data/app/io.legere.pdfiumandroidkt-1/lib/arm64/libpdfium_v2.so"

lion0508 commented 5 months ago

Similar issue i have, when im trying to use .so on Android 6, i received this error: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__write_chk" referenced by "/data/app/io.legere.pdfiumandroidkt-1/lib/arm64/libpdfium_v2.so"

bblanchon commented 5 months ago

Hi,

I ran llvm -D to get all libpdfium.so's symbols and found the following lines:

U __register_atfork@LIBC
U __write_chk@LIBC_N

It seems that it should find those symbols in the libc. Could it be a problem with the libc version, as in #82?

Best regards, Benoit

lion0508 commented 5 months ago

Hello Thanks, for your response, as i understand correctly, for quick fix, i should use this way for that:

chrome_2023-12-01_23-14-06

Is it correct understanding from my side?

lion0508 commented 5 months ago

I have one more small question, how i can include another *.so libs together with libpdfium.so:

chrome_2023-12-01_23-56-08
bblanchon commented 5 months ago

You can try to lower the requirements, but I'm pretty sure the PDFium and Chromium teams already configured it to support the oldest possible Android version. If you need to support an old version of Android, you'll probably have to use an old version of PDFium.

The libpdfium.so provided here should already be bundled with all the required dependencies.

bblanchon commented 5 months ago

Chromium dropped support for Android API 23 a year ago: https://groups.google.com/a/chromium.org/g/chromium-dev/c/z_RvoPoIeoM

lion0508 commented 5 months ago

@bblanchon I added some changes for patches:

  1. Added changes for "shared_library" patches/android/build.patch 2023-12-03_19-10-20
  2. Created new patch and added changes regarding "default_min_sdk_version" 2023-12-03_19-12-07

Now it works for Android 23! For Android 21-22 i received error "UnsatisfiedLinkError: dlopen failed: cannot locate symbol "FPDFBookmark_GetFirstChild" referenced"

Do you have any ideas, regarding Android 21-22? Or i should use older version of pdfium which is supported minimum Android 21-22, what do you think? Whats the latest version of pdfium which supported Android 21?

bblanchon commented 5 months ago

You should address these questions to the official PDFium mailing list.

lion1988dev commented 2 months ago

Hello, @bblanchon Could you provide please link, of your latest version of so libs:

Thanks

bblanchon commented 2 months ago

According to the conversation mentioned above, the commit that dropped the support for Android API level 23 is this one: https://chromium-review.googlesource.com/c/chromium/src/+/4000311

It was rolled out to PDFium with this commit: https://pdfium.googlesource.com/pdfium/+/e57c44ecfebda5bab1fd1d6aebbfdd3e56f5b97f

The first build that included this change is 110.0.5459.0. The last build before this change is 110.0.5445.0

lion1988dev commented 2 months ago

@bblanchon Thanks for your response and links! Last question, could you provide please link, of your latest version of so libs:

bblanchon commented 2 months ago

There was a lot of back-and-forth between 21 and 23:

The commit that definitely set the minimum version to 23 is https://chromium-review.googlesource.com/c/chromium/src/+/3232601

It was rolled to pdfium in this commit https://pdfium.googlesource.com/pdfium/+/b40183476292b2c6a92dc8dfbb4e02d570849e87 This commit is in branch chromium/4743.

The first build to include this change is 98.0.4750.0 The last build before this change is 98.0.4736.0.

However, since there has been a lot of back-and-forth between 21 and 23, it's possible that some of the builds before 98.0.4750.0 already require version 23.

lion1988dev commented 2 months ago

Hello, @bblanchon I have tried this build so libs 8.0.4736.0, but i received this error:

java.lang.UnsatisfiedLinkError: dlopen failed: library "libabsl.cr.so" not found

No implementation found for long com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(int, java.lang.String) (tried Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument and Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument__ILjava_lang_String_2) 2024-03-12 16:24:04.364 2587-2587 PDFView com.github.barteksc.sample E load pdf error java.lang.UnsatisfiedLinkError: No implementation found for long com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(int, java.lang.String) (tried Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument and Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument__ILjava_lang_String_2) at com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(Native Method) at com.shockwave.pdfium.PdfiumCore.newDocument(PdfiumCore.java:132) at com.github.barteksc.pdfviewer.source.AssetSource.createDocument(AssetSource.java:41) at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:53) at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:27) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

Could you check please, what can be wrong?

varahash commented 1 month ago

@bblanchon @lion1988dev Thank you for raising this issue and you time to investigate this. I have dig little bit more to understand the root problem. Here is my finding https://github.com/bblanchon/pdfium-binaries/pull/161, please take a look.

lion1988dev commented 1 month ago

@varahash Thanks for your investigation, let me check this solution, I will try to create patch with these changes and will rebuild so files. Will let you know after checking