Bug 249328 - editors/libreoffice: link failure on canvasdemo
Summary: editors/libreoffice: link failure on canvasdemo
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: FreeBSD Office Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-15 08:48 UTC by Bertrand Petit
Modified: 2021-11-10 15:10 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (office)


Attachments
Ports configuration tree of the affected host (A) (50.89 KB, text/plain)
2020-09-15 20:21 UTC, Bertrand Petit
no flags Details
Ports configuration tree of the unaffected host (B) (45.58 KB, text/plain)
2020-09-15 20:21 UTC, Bertrand Petit
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bertrand Petit 2020-09-15 08:48:31 UTC
The libreoffice port revision 7.0.1.2 fails to link canvasdemo

[...]
[build LNK] Executable/canvasdemo
S=/usr/obj/ports/usr/ports/editors/libreoffice/work/libreoffice-7.0.1.2 && I=$S/instdir && W=$S/workdir &&  c++ -pthread    -Wl,-z,origin '-Wl,-rpath,$ORIGIN/../Library' -Wl,-rpath-link,$I/program -fstack-protector-strong -Wl,-rpath-link,/lib:/usr/lib -Wl,-z,combreloc  -Wl,--hash-style=gnu  -Wl,-Bsymbolic-functions -L$W/LinkTarget/StaticLibrary -L$I/sdk/lib  -L$I/program  -L$I/program  -L$W/LinkTarget/Library -L/usr/local/lib -Wl,-rpath,/usr/local/lib -fstack-protector-strong    -L/usr/local/lib  $W/CxxObject/canvas/workben/canvasdemo.o      -Wl,--start-group $W/LinkTarget/StaticLibrary/libvclmain.a $W/LinkTarget/StaticLibrary/libglxtest.a -lm  -lX11   -Wl,--end-group -Wl,--no-as-needed -lbasegfxlo -lcomphelper -luno_cppu -luno_cppuhelpergcc3 -ltllo -luno_sal -luno_salhelpergcc3 -lvcllo  -o $W/LinkTarget/Executable/canvasdemo 
/usr/obj/ports/usr/ports/editors/libreoffice/work/libreoffice-7.0.1.2/instdir/program/libskialo.so: undefined reference to `XGetXCBConnection'
c++: error: linker command failed with exit code 1 (use -v to see invocation)
[...]

Shouldn't -lX11-xcb be used instead of -lX11?
Comment 1 Li-Wen Hsu freebsd_committer freebsd_triage 2020-09-15 15:08:44 UTC
Just wanted to make sure, do you use the default options or there are some customized settings?
Comment 2 Bertrand Petit 2020-09-15 20:21:03 UTC
Created attachment 217980 [details]
Ports configuration tree of the affected host (A)
Comment 3 Bertrand Petit 2020-09-15 20:21:37 UTC
Created attachment 217981 [details]
Ports configuration tree of the unaffected host (B)
Comment 4 Bertrand Petit 2020-09-15 20:27:48 UTC
I attempted two installations of lo on two different hosts with two different outcomes: one for which the failure is reported above (host A); one on which the port was successfully installed (host B). For both hosts I attached the full ports configuration tree.

Host A runs 11-STABLE (rev 365447), host B runs 12-STABLE (rev 360207).
Comment 5 Gleb Popov freebsd_committer freebsd_triage 2021-11-10 12:31:46 UTC
Bumped into something like this when building LibreOffice master:

Failed to load /home/arr/libreoffice_build/instdir/program/libsofficeapp.so: /usr/home/arr/libreoffice_build/instdir/program/libskialo.so: Undefined symbol "XGetXCBConnection"

% ldd /usr/home/arr/libreoffice_build/instdir/program/libskialo.so
/usr/home/arr/libreoffice_build/instdir/program/libskialo.so:
        libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x800674000)
        libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1 (0x80073e000)
        libz.so.6 => /lib/libz.so.6 (0x80078c000)
        libjpeg.so.8 => /usr/local/lib/libjpeg.so.8 (0x8016fa000)
        libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x8007a8000)
        libuno_sal.so.3 => /usr/home/arr/libreoffice_build/instdir/program/libuno_sal.so.3 (0x8017a4000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x801861000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x801933000)
        libm.so.5 => /lib/libm.so.5 (0x801956000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x8007e7000)
        libthr.so.3 => /lib/libthr.so.3 (0x801989000)
        libc.so.7 => /lib/libc.so.7 (0x800263000)
        libbz2.so.4 => /usr/lib/libbz2.so.4 (0x8019b6000)
        libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x8019cc000)

I guess, this library should be linked to libxcb.so or something.
Comment 6 Gleb Popov freebsd_committer freebsd_triage 2021-11-10 12:35:13 UTC
This needs patching:

./external/skia/Library_skia.mk:98

ifeq ($(OS),LINUX)
$(eval $(call gb_Library_add_libs,skia,\
    -lm \
    -ldl \
    -lX11-xcb \
    -lX11 \
))
endif


How does one express or in GNU Make?
Comment 7 Bertrand Petit 2021-11-10 13:44:55 UTC
(In reply to Gleb Popov from comment #6)
There is not explicit or operator but, for the same effect, you can use
something like this:

ifneq ($(filter OS1 OS2 OSn, $(OS)),)
...
endif
Comment 8 Gleb Popov freebsd_committer freebsd_triage 2021-11-10 14:43:31 UTC
(In reply to Bertrand Petit from comment #7)
Thanks, that indeed fixed the problem with my build.

However, our Ports tree already carries such patch: https://github.com/freebsd/freebsd-ports/blob/main/editors/libreoffice/files/patch-external_skia_Library__skia.mk

The problem should be fixed by now. Can we close this?
Comment 9 Bertrand Petit 2021-11-10 15:10:04 UTC
This issue is obviously fixed and closable.