pdfium-binaries icon indicating copy to clipboard operation
pdfium-binaries copied to clipboard

arm64 linux library need GLIBC_2.29

Open zx950921 opened this issue 2 years ago • 5 comments

glibc 2.29 version too high, I tried compiling with Ubuntu 18.04, but It still need to rely on glibc 2.29 in the end, How to downgrade glibc version to at least 2.27?

https://github.com/zx950921/pdfium-binaries/runs/6945770416?check_suite_focus=true#step:13:69

zx950921 avatar Jun 19 '22 02:06 zx950921

I just spent three hours trying to find a solution to this problem; here are my conclusions.

First, I observed that this problem only occurs on ARM64, not ARM.

As far as I can tell, this dependency on glibc 2.29 comes from the sysroot used to build chromium: https://source.chromium.org/chromium/chromium/src/+/main:build/linux/sysroot_scripts/install-sysroot.py

I could track down the symbols here in pdfium/build/linux/debian_bullseye_amd64-sysroot/debian/libc6/DEBIAN/symbols, line 3305:

 pow10@GLIBC_2.2.5 2.2.5
 pow10f@GLIBC_2.2.5 2.2.5
 pow10l@GLIBC_2.2.5 2.2.5
 pow@GLIBC_2.2.5 2.2.5
 pow@GLIBC_2.29 2.29
 powf128@GLIBC_2.26 2.26
 powf32@GLIBC_2.27 2.27
 powf32x@GLIBC_2.27 2.27
 powf64@GLIBC_2.27 2.27
 powf64x@GLIBC_2.27 2.27
 powf@GLIBC_2.2.5 2.2.5
 powf@GLIBC_2.27 2.27
 powl@GLIBC_2.2.5 2.2.5

Strangely, pow, exp, and log are among the few duplicated symbols in this list. I wonder if it's a bug in the sysroot...

From what I understood, the following script patches the sysroot to lower the required glibc version to 2.17: https://source.chromium.org/chromium/chromium/src/+/main:build/linux/sysroot_scripts/reversion_glibc.py;drc=f6901be733e76832721ad7fb8d4d51715df77095

This script is run by the following script: https://source.chromium.org/chromium/chromium/src/+/main:build/linux/sysroot_scripts/sysroot-creator.sh;drc=8161edc5a2ee57e0aa7dee00a9ef3579f87326e4

Interestingly, on line 426, we can see that the invocation is skipped with the comment:

 # Skip reversion_glibc.py. Glibc is compiled in a way where many libm math
 # functions do not have compatibility symbols for versions <= 2.17.

This fairly recent (April 4th) change was introduced in the following commit: https://chromium.googlesource.com/chromium/src/build/+/04efde6a08d590775ced1a3cb0509c0690dbaabb

The commit message says:

Symbol reversioning is disabled altogether for ARM64

Disable glibc symbols with no supported version

reversion_glibc.py rewrites the default version of symbols if it is higher than GLIBC_2.17 and another version <= 2.17 exists. On the other hand, if there is no sufficiently old version available, it left it alone.

This CL changes it to disable these symbols either way.

A list of exceptions is added: the linux-chromeos build makes a few syscalls that aren't supported in glibc 2.17. We want to continue supporting this configuration.

I tried checking a version older than this commit but got the same error.

I'll stop working on this until I get more information.

bblanchon avatar Jun 20 '22 09:06 bblanchon

Many thanks for the detailed investigation. Have you considered contacting upstream about these matters through pdfium's mailing list or bug tracker?

mara004 avatar Jun 20 '22 16:06 mara004

No, I haven't because I don't know this topic at all so I wouldn't know what to ask.

bblanchon avatar Jun 20 '22 16:06 bblanchon

Thank you very much for your help, the complexity of this problem seems to be beyond my knowledge level and can only be tried to solve later

zx950921 avatar Jun 21 '22 02:06 zx950921

I posted a question on the PDFium mailing list: https://groups.google.com/g/pdfium/c/--TpUDMv4s8/m/H0gYjZ9vBAAJ

PS: also on Chromium's mailing list: https://groups.google.com/a/chromium.org/g/chromium-dev/c/SdCs9k3celo/m/TMJqiKYaBQAJ

bblanchon avatar Jun 21 '22 15:06 bblanchon

I tried checking a version older than this commit but got the same error.

Hmm, theoretically I'd believe patching sysroot-creator.sh to enable symbol reversioning should do the trick. However, as far as I understand, the tooling just downloads a sysroot image from Google storage, so to make changes to sysroot-creator.sh take effect, I suppose one would have to rebuild the sysroot locally - did you do this when you rolled back to an older commit?

(Disclaimer: This is just an idea, I only took a brief look and my guess might well be wrong.)

mara004 avatar Jan 02 '23 18:01 mara004

Quoting Lei Zhang:

This issue recently got resolved in https://crrev.com/1084974, and PDFium will pick up that change in the very near future.

mara004 avatar Jan 03 '23 23:01 mara004

@bblanchon I think this issue can be closed?

mara004 avatar May 11 '23 16:05 mara004