1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 00:21:15 +03:00
WeasyPrint/weasyprint
Konstantin Alekseev 1571528da3 dlopen shared library symlink using major version name.
cffi.dlopen should use .so.N symlinks instead of .so to
make sure we load ABI compatible version of the library and
the same library used by the rest of the system.

cffi uses `ctypes.util.find_library` to search for libraries
and the docs for `find_library` states that
"The exact functionality is system dependent."
so different system may expect different names for the same library.

To overcome that problem we try to load several names until success
among these names exact file name with `.so` suffix
eg. `libcairo.so` but .so symlink is not always safe to use.

Shared library usually consist of two of three files:
- libcairo.so.N.M - N.M exact version number
- libcairo.so.N - symlink to library.so.N.M with major ABI version
- libcairo.so - symlink to library.so.N

When -lcairo flag is used linker search for libcairo.so,
but when the programm loaded it loads libcairo.so.N where N
is the version that it was linked with.

Some downsides of .so usage:
- .so may point to the wrong ABI version, e.g. we expect libcairo
  version 2 but libcairo.so points at libcairo.so.1
- usually .so files are shipped with development packages `-dev`
  in debian and `-devel` in centos and they are just symlinks
  to the .so.N files. So it safer to search for .so.N files they
  will exist even if dev package is not installed.
- hard symlink .so -> .so.N not always preserved, eg. if we zip
  them we get two copies of the library and while the rest of the
  system will use .so.N file we will load .so files that may lead
  to crash
2020-05-03 22:01:41 +03:00
..
css Don’t display template tags 2020-04-13 11:44:37 +02:00
formatting_structure Merge branch 'master' into clean 2020-01-07 22:36:38 +01:00
layout Fix column background position for rtl tables 2020-04-08 15:31:24 +02:00
tests Add failing test 2020-04-08 14:28:57 +02:00
tools Fix typo 2020-04-10 14:07:12 +02:00
__init__.py Try fixing a bug encountered when using weasyprint in Pyinstaller context 2020-03-25 18:43:05 +01:00
__main__.py Fully test __main__ 2020-01-11 18:33:59 +01:00
document.py remove trailing whitespace 2020-04-09 00:51:15 +00:00
draw.py Fix borders for rtl tables 2020-03-14 23:09:23 +01:00
fonts.py dlopen shared library symlink using major version name. 2020-05-03 22:01:41 +03:00
html.py Remove repeated copyright assignments in files 2020-01-02 14:10:09 +01:00
images.py Remove repeated copyright assignments in files 2020-01-02 14:10:09 +01:00
logger.py Remove repeated copyright assignments in files 2020-01-02 14:10:09 +01:00
pdf.py Support for post-processing by passing a finisher function to write_pdf 2020-04-08 23:46:11 +00:00
stacking.py Remove repeated copyright assignments in files 2020-01-02 14:10:09 +01:00
text.py dlopen shared library symlink using major version name. 2020-05-03 22:01:41 +03:00
urls.py Remove breakpoint 2020-01-13 21:50:13 +01:00
VERSION Support for post-processing by passing a finisher function to write_pdf 2020-04-08 23:46:11 +00:00