我在 Ubuntu Server 20.4 上尝试使用 Python、Django 和 wkhtmltopdf 将 html 转换为 pdf 时遇到一些错误。请参阅错误
wkhtmltopdf: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by wkhtmltopdf)
wkhtmltopdf: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.35' not found (required by /lib/x86_64-linux-gnu/libQt5Core.so.5)
wkhtmltopdf: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /lib/x86_64-linux-gnu/libQt5Core.so.5)
wkhtmltopdf: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /lib/x86_64-linux-gnu/libQt5Core.so.5)
wkhtmltopdf: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libQt5Core.so.5)
wkhtmltopdf: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /lib/x86_64-linux-gnu/libQt5Core.so.5)
wkhtmltopdf: /lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.13' not found (required by /lib/x86_64-linux-gnu/libQt5Core.so.5)
wkhtmltopdf: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libicuuc.so.70)
wkhtmltopdf: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /lib/x86_64-linux-gnu/libicuuc.so.70)
请帮帮我。致以最诚挚的问候,罗兰多。
答案1
您安装的二进制“包”是在相对于 ubuntu 20 的未来系统上编译或构建的。
$ docker run --rm ubuntu:20.04x dpkg -l | grep libc
ii libc-bin 2.31-0ubuntu9.2 amd64 GNU C Library: Binaries
ii libc6:amd64 2.31-0ubuntu9.2 amd64 GNU C Library: Shared libraries
ii libcap-ng0:amd64 0.7.9-2.1build1 amd64 An alternate POSIX capabilities library
ii libcom-err2:amd64 1.45.5-2ubuntu1 amd64 common error description library
ii libcrypt1:amd64 1:4.4.10-10ubuntu4 amd64 libcrypt shared library
在上面的输出中,您会看到包含的 libc 版本是 2.31。您粘贴的错误消息表明程序需要更高版本的 libc 运行时。
要解决该问题,您可以执行以下任一操作:
- 在你的系统上编译 wkhtmltopdf(不推荐)
- 找到适用于 ubuntu 20 的 wkhtmltopdf 版本(包)
- 在较新的系统(例如 ubuntu 22)上运行您拥有的 wkhtmltopdf 版本