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

From: <>
Date: Sat, 05 Mar 2022 22:58:15 UTC
Florian Walpen <> has asked FreeBSD Office Team
<> for maintainer-approval:
Bug 262008: editors/libreoffice failed to build

Attachment 232274: Fix build with PDFIUM and LTO enabled.

--- Comment #46 from Florian Walpen <> ---
Created attachment 232274
Fix build with PDFIUM and LTO enabled.

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

When is linked together with, it also needs 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.