How to cut down the unwanted dependencies in the PDFium build process?

283 views
Skip to first unread message

Deepak G

unread,
Feb 8, 2022, 2:51:39 AM2/8/22
to pdfium
When I build the PDFium dll using the instructions provided in the link https://pdfium.googlesource.com/pdfium/, I could successfully generate PDFium dll. However it has the following dependencies and found to be missing, so I was unable to use and test in my application?

missing dependencies.png
I could see in some other links, PDFium dll was build without the above dependencies. Could anyone please let me know which file need to be changed and what are the changes, to build PDFium without the above dependencies?

Thanks in Advance

Miklos Vajna

unread,
Feb 8, 2022, 3:48:13 AM2/8/22
to Deepak G, pdfium
Hi,

On Mon, Feb 07, 2022 at 11:51:39PM -0800, Deepak G <deepa...@gmail.com> wrote:
> When I build the PDFium dll using the instructions provided in the link
> https://pdfium.googlesource.com/pdfium/, I could successfully generate
> PDFium dll. However it has the following dependencies and found to be
> missing, so I was unable to use and test in my application?

My understanding is that you need absl/icu/zlib/standard c++ library to
use pdfium. But you can decide if you link these statically or get it
from pdfium or from somewhere else.

E.g. we (LibreOffice) let pdfium to use the bundled absl, but our
application already use icu/zlib/standard c++ library, so we build with
-DUSE_SYSTEM_ZLIB, -DUSE_SYSTEM_ICUUC etc to avoid the ones in pdfium.

In worst case you need to tweak how you build pdfium, but unpatched
pdfium code already supports this as-is.

Regards,

Miklos

Deepak G

unread,
Feb 8, 2022, 7:31:27 AM2/8/22
to pdfium
Hi  Miklos,

Thank you for you suggestion, based on your update, I understand that the above dlls are needed. I have faced the entry point is not bounded for the above mentioned 4 dlls (as in the attachment). Can you please share me your ideas on this for resolving the issue?

Regards,
Deepak G
Entry point.png

Lei Zhang

unread,
Feb 8, 2022, 1:40:40 PM2/8/22
to Deepak G, pdfium
I'm guessing you just want a single pdfium.dll, with absl.dll and
friends inside pdfium.dll and not separated out?
> --
> You received this message because you are subscribed to the Google Groups "pdfium" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pdfium/9df92ef8-f6ff-4f8e-98d5-51ef346793c9n%40googlegroups.com.

Deepak G

unread,
Feb 8, 2022, 2:02:50 PM2/8/22
to pdfium
Hi Lei,,

yes.

Deepak G

unread,
Feb 8, 2022, 3:03:50 PM2/8/22
to pdfium
Hi Lei,

Could you please let me know your suggestion on this?

Regards,
Deepak G

Lei Zhang

unread,
Feb 8, 2022, 10:44:21 PM2/8/22
to Deepak G, pdfium
Is there a reason it has to be pdfium.dll in your use case, and can't
be pdfium.lib?

I know https://github.com/pvginkel/PdfiumBuild builds pdfium.dll, but
that project has been retired and I have no idea how out of date it
is. I've also never tried it.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pdfium/88ff3cb0-84f6-45bd-b394-969338bbe4f0n%40googlegroups.com.

Deepak G

unread,
Feb 10, 2022, 12:38:26 AM2/10/22
to pdfium
Hi Lei,

Yes, we are building for Windows project. So it requires PDFium as dll

geisserml

unread,
Apr 17, 2022, 4:58:20 PM4/17/22
to pdfium
Hi Miklos,
Could you please explain how you are able to build pdfium with system-provided ICU?
While `use_system_zlib = true` works as expected in my args.gn, generate-ninja tells me that the option `use_system_icuuc` does not exist.
However, when calling ldd on `/usr/lib/libreoffice/program/libpdfiumlo.so`, I see it is linked against `libicuuc.so`.
What have I overlooked? Do you have a patch that adds this option, or was it present in an older version of pdfium and is now removed?
Kind regards

Miklos Vajna

unread,
Apr 18, 2022, 9:11:50 AM4/18/22
to geisserml, pdfium
Hi,

On Sun, Apr 17, 2022 at 01:58:20PM -0700, geisserml <geis...@gmail.com> wrote:
> Could you please explain how you are able to build pdfium with
> system-provided ICU?

We (libreoffice) only consume the pdfium C++ source, but we build the
code using our own build system (as GN is not available in our build
environment):

https://github.com/libreoffice/core/blob/49ee1c889665c3539fa9a1c99a865a42fc08ee97/external/pdfium/Library_pdfium.mk#L32
https://github.com/libreoffice/core/blob/49ee1c889665c3539fa9a1c99a865a42fc08ee97/external/pdfium/Library_pdfium.mk#L592-L593

> While `use_system_zlib = true` works as expected in my args.gn,
> generate-ninja tells me that the option `use_system_icuuc` does not exist.
> However, when calling ldd on `/usr/lib/libreoffice/program/libpdfiumlo.so`,
> I see it is linked against `libicuuc.so`.
> What have I overlooked? Do you have a patch that adds this option, or was
> it present in an older version of pdfium and is now removed?

pdfium already supports the -DUSE_SYSTEM_ICUUC build flag: if that's
provided, then it'll build against the system ICU. I did this a while
ago in pdfium.git commit fc0bbda00d476ba0c0b43dd88fd1d1a1d11577cc (core:
allow building against system icu-uc, 2018-05-16).

I'm not sure about linking as what to link is specific to the build
system and I'm not that familiar with GN. If you're interested in
looking into the GN bits, so it works similar to e.g.
system_libjpeg_config, that would be probably useful for those who use
GN to build the code.

Regards,

Miklos

geisserml

unread,
Apr 18, 2022, 9:33:28 AM4/18/22
to pdfium
Okay, thanks for the response! I see there is only the `-DUSE_SYSTEM_ICUUC` build flag but not a corresponding GN option.
I think it would be more consistent to also provide `use_system_icuuc` for the GN build, but I'm unfortunately not in a position to implement it myself.
Maybe a PDFium team member could implement this at some point?

lei thunder

unread,
Nov 18, 2022, 11:50:28 AM11/18/22
to pdfium
Hi Guys,  any update about how to create a single pdfium dll?  Thanks - Thunder
Reply all
Reply to author
Forward
0 new messages