maintainer-approval requested: [Bug 262008] editors/libreoffice failed to build : [Attachment 232274] Fix build with PDFIUM and LTO enabled.

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 05 Mar 2022 22:58:15 UTC
Florian Walpen <dev@submerge.ch> has asked FreeBSD Office Team
<office@FreeBSD.org> for maintainer-approval:
Bug 262008: editors/libreoffice failed to build
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262008

Attachment 232274: Fix build with PDFIUM and LTO enabled.
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=232274&action=edit



--- Comment #46 from Florian Walpen <dev@submerge.ch> ---
Created attachment 232274
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=232274&action=edit
Fix build with PDFIUM and LTO enabled.

This supposedly fixes the build failure with PDFIUM and LTO enabled:

When libvcllo.so is linked together with libpdfiumlo.so, it also needs
libopenjp2.so from graphics/openjpeg, since pdfium depends on that.
Building with LTO exposes this as an error, complaining about undefined
references to openjpeg library functions.

This patch adds the missing linker flag "-lopenjp2".

Tested on 13.0-RELEASE-p7, successfully opened some documents.

What puzzles me is that the LTO package seems to use more disk space than the
one without LTO. But I don't have time to investigate now.