Can LibreOffice be built on a headless server?

Hello, I want to build LibreOffice 25.x from source, so it can run on an old server running Debian 11 (which has now-obsolete versions of libc etc. which prevent using the pre-compiled .debs). It’s a headless webserver; I only need to use the command line to do libreoffice --convert-to ....

However a regression test fails, so I’m wondering if I am checking out exactly the code which was released (I’m assuming here that all tests passed before releasing). Do the “make check” tests require a graphical display to run?

Here’s what I did:

git clone https://gerrit.libreoffice.org/core libreoffice
cd ./libreoffice
git checkout libreoffice-25.8.6.1

cat >autogen.input <<'EOF'
CC=/home/test/opt/gcc-13.2.0/bin/gcc
CXX=/home/test/opt/gcc-13.2.0/bin/g++
MESON=/home/test/opt/meson_1.0.1-5/usr/bin/meson
EOF

export MESON=/home/test/opt/meson_1.0.1-5/usr/bin/meson
export PYTHONPATH=$HOME/opt/meson_1.0.1-5/usr/lib/python3/dist-packages${PYTHONPATH+":$PYTHONPATH"}

make && make check

The build succeeds but a test always fails:

======================================================================
ERROR: test_12_.uno:InsertFieldCtrl (openDialogs.openDialogs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/test/src/libreoffice/sw/qa/uitest/writer_dialogs/openDialogs.py", line 143, in <lambda>
    return lambda self: self.check(dialog)
  File "/home/test/src/libreoffice/sw/qa/uitest/writer_dialogs/openDialogs.py", line 135, in check
    testAppDialog(self, "writer", dialog)
  File "/home/test/src/libreoffice/uitest/uitest/uihelper/testDialog.py", line 27, in testAppDialog
    xOKBtn = None
  File "/usr/lib/python3.9/contextlib.py", line 124, in __exit__
    next(self.gen)
  File "/home/test/src/libreoffice/uitest/uitest/test.py", line 151, in execute_dialog_through_command
    yield from self.wait_and_yield_dialog(event, xDialogParent, close_button)
  File "/home/test/src/libreoffice/uitest/uitest/test.py", line 142, in wait_and_yield_dialog
    self.close_dialog_through_button(dialog.getChild(close_button), dialog)
  File "/home/test/src/libreoffice/uitest/uitest/test.py", line 198, in close_dialog_through_button
    button.executeAction("CLICK", tuple())
AttributeError: executeAction

----------------------------------------------------------------------
Ran 21 tests in 19.893s

FAILED (errors=1)
Tests run: 21
Tests failed: 0
Tests errors: 1
Tests skipped: 0
tearDown: calling terminate()...
...done

Error: a unit test failed:

To rerun just this failed test without all others, use:
    make UITest_writer_dialogs