Skip to content

Publish internal cairo symbols within libpoppler library.

Bohumír Zámečník requested to merge bzamecnik/poppler:cairo-symbols into master

The problem

Based on #83 (closed) in !252 (merged) the headers of internal poppler modules related to Cairo (CairoFontEngine, CairoOutputDev, CairoRescaleBox), were published as an unstable API. This put CairoOutputDev on par with other output devices such as TextOutputDev or SplashOutputDev.

However the binary symbols in the object files were only available through poppler-glib (as it uses them). Eventually in !39 (merged) (4ef2020d) the private symbols in poppler-glib were hidden (which makes sense). A bit strange thing was that libpoppler was still exposing other symbols (eg. TextOutputDev or SplashOutputDev), but not CairoOutputDev.

The cause is that in the CMakeLists.txt file the Cairo sources/libraries were not included at all. They were only included to poppler-glib and pdftocairo where they were used.

Solution

In this MR we try to rectify this situation. If the cairo parts of the internal API/ABI were already published via the headers also the binary symbols should be published.

In particular, the https://github.com/rossumai/pdfparser depends on this (even though it ideally should not and the required changes should be possibly ported directly to poppler).

Testing

I have build a PPA port of poppler-0.86.1 (for Ubuntu Focal) with these changes applied (https://launchpad.net/~bzamecnik/+archive/ubuntu/poppler/+packages) poppler - 0.86.1-0ubuntu1ppa~focal3 and it seems to work.

# Ubuntu 20.04
$ apt update && apt install -y binutils

$ apt install -y libpoppler97
$ objdump -T /usr/lib/x86_64-linux-gnu/libpoppler.so.97.0.0 |grep Cairo
# empty

$ export DEBIAN_FRONTEND=noninteractive
$ apt-get update && apt-get -y install software-properties-common
$ LC_ALL=C.UTF-8 add-apt-repository -y -u ppa:bzamecnik/poppler
$ apt-get update && apt-get install -y libpoppler97=0.86.1-0ubuntu1ppa~focal3
$ objdump -T /usr/lib/x86_64-linux-gnu/libpoppler.so.97.0.0 |grep Cairo|head
00000000002644e0 g    DF .text  0000000000000026  Base        _ZN14CairoOutputDev13clearSoftMaskEP8GfxState
0000000000264510 g    DF .text  00000000000000e3  Base        _ZN14CairoOutputDevD2Ev
0000000000267f80 g    DF .text  000000000000022d  Base        _ZN14CairoOutputDev6doPathEP6_cairoP8GfxStatePK7GfxPath
0000000000265940 g    DF .text  000000000000026d  Base        _ZN14CairoOutputDev16radialShadedFillEP8GfxStateP16GfxRadialShadingdd
0000000000263700 g    DF .text  00000000000007e0  Base        _ZN17CairoFreeTypeFont6createEP7GfxFontP4XRefP14FT_LibraryRec_b
000000000026e0a0  w   DF .text  000000000000000a  Base        _ZN19CairoImageOutputDev10upsideDownEv
000000000026e040  w   DF .text  000000000000000a  Base        _ZN14CairoOutputDev11useDrawCharEv
00000000002683f0 g    DF .text  00000000000000ea  Base        _ZN14CairoOutputDev20fillToStrokePathClipEP8GfxState
00000000002664d0 g    DF .text  0000000000000276  Base        _ZN14CairoOutputDev9endStringEP8GfxState
0000000000266180 g    DF .text  0000000000000096  Base        _ZN14CairoOutputDev19updateFillColorStopEP8GfxStated
Edited by Bohumír Zámečník

Merge request reports