Re: Unresolved symbol in libQt6WebEngineCore.so.6.4.2

From: Alexander Leidinger <Alexander_at_leidinger.net>
Date: Mon, 24 Jul 2023 13:24:42 UTC
Quoting Jan Beich <jbeich@freebsd.org> (from Mon, 24 Jul 2023 14:50:48 +0200):

> Alexander Leidinger <Alexander@leidinger.net> writes:
>
>> Quoting Jan Beich <jbeich@freebsd.org> (from Mon, 24 Jul 2023  
>> 13:52:43 +0200):
>>
>>> Alexander Leidinger <Alexander@leidinger.net> writes:
>>>
>>>> Hi,
>>>>
>>>> a build with non-standard port options (mostly nox11 und related stuff
>>>> for a headless system, except for some ports where this doesn't work)
>>>> is giving me an unresolved symbol in
>>>> libQt6WebEngineCore.so.6.4.2. This symbol is
>>>> _ZN7sandbox6policy12SandboxLinux11GetInstanceEv.
>>>>
>>>> I'm seeking some insight where this symbol comes from, so it would be
>>>> nice if someone could report back if their
>>>> libQt6WebEngineCore.so.6.4.2 also has this symbol as unresolved and
>>>> which libary does provide this symbol via:
>>>>   find /usr/local/lib -type f -print0 | xargs -0 nm -dynamic
>>>>   --print-file-name | grep SandboxLinux
>>>
>>> The symbol is defined by WebEngine itself.
>>>
>>> $ cd www/qt6-webengine
>>> $ make clean patch
>>> $ cd `make -V WRKSRC`
>>> $ rg -lF 'SandboxLinux::GetInstance() {'
>>> src/3rdparty/chromium/sandbox/policy/linux/sandbox_linux.cc
>>> src/3rdparty/chromium/sandbox/policy/openbsd/sandbox_openbsd.cc
>>> src/3rdparty/chromium/sandbox/policy/freebsd/sandbox_freebsd.cc
>>
>> That doesn't sound promising. The qt6-webengine build succeeded, but
>> this symbol is missing... :(
>> As the port only has the audio options, it's not some direct influence
>> which is causing it, but some indirect dependency on something in the
>> dependecy chain I would assume.
>
> If -Wl,--no-undefined (or -Wl,-z,defs) isn't passed then DSOs are
> allowed to have unresolved references. This is useful for plugins
> unlike shared libraries.

But then the sandbox code should be linked in even if there are some  
symbols (e.g. from X11) not available...

>> I had a look at the faq and explanation of the sandbox at
>> chromium.googlesource.com, but I didn't see any low level stuff which
>> could help to identify why it isn't in the lib.
>
> Check the build glue and/or ifdefs.
>
> src/3rdparty/chromium/sandbox/policy/BUILD.gn:
>
>   if ((is_linux || is_chromeos) && !is_bsd) {
>     sources += [
>     ...
>       "linux/sandbox_linux.cc",
>       "linux/sandbox_linux.h",
>     ...
>     ]
>   ...
>   }
>   if (is_openbsd) {
>     sources += [
>       "openbsd/sandbox_openbsd.cc",
>       "openbsd/sandbox_openbsd.h",
>     ]
>   ...
>   }
>   # Required to avoid assertion errors during build of QtPDF
>   if (is_freebsd && ozone_platform_x11) {
>     sources += [
>       "freebsd/sandbox_freebsd.cc",
>       "freebsd/sandbox_freebsd.h",
>     ]
>   ...
>   }
>
> src/3rdparty/chromium/build/config/ozone.gni:
>
>     } else if (is_linux && !is_bsd) {
>       ozone_platform = "x11"
>       ozone_platform_wayland = true
>       ozone_platform_x11 = true
>     } else if (is_openbsd) {
>       ozone_platform = "x11"
>       ozone_platform_wayland = false
>       ozone_platform_x11 = true
>     } else if (is_freebsd) {
>       ozone_platform = "x11"
>       ozone_platform_wayland = true
>       ozone_platform_x11 = true


In general I have X11 and wayland disabled in the port options, except  
in some strategic places which resulted in build failures before.  
Seems some ports have changed regarding this and I need to find out  
what causes the sandbox code not to be included. I see references to  
X11 libs in the webengine libs, so :
---snip---
/usr/local/lib/qt6/libQt6WebEngineCore.so.6.4.2:
         libthr.so.3 => /lib/libthr.so.3 (0x2762513e0000)
         libnss3.so => /usr/local/lib/libnss3.so (0x27625c482000)
         libsmime3.so => /usr/local/lib/libsmime3.so (0x27625bb0c000)
         libnssutil3.so => /usr/local/lib/libnssutil3.so (0x27625d457000)
         libplds4.so => /usr/local/lib/libplds4.so (0x27625dd34000)
         libplc4.so => /usr/local/lib/libplc4.so (0x27625ef9f000)
         libnspr4.so => /usr/local/lib/libnspr4.so (0x27625e740000)
         libdl.so.1 => /usr/lib/libdl.so.1 (0x27625fb67000)
         libkvm.so.7 => /lib/libkvm.so.7 (0x2762606d3000)
         libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x276260b5a000)
         libutil.so.9 => /lib/libutil.so.9 (0x2762625a6000)
         libevent-2.1.so.7 => /usr/local/lib/libevent-2.1.so.7 (0x2762617bd000)
         libz.so.6 => /lib/libz.so.6 (0x276263772000)
         libjpeg.so.8 => /usr/local/lib/libjpeg.so.8 (0x276262755000)
         libm.so.5 => /lib/libm.so.5 (0x2762646e6000)
         libopus.so.0 => /usr/local/lib/libopus.so.0 (0x2762655ce000)
         libavcodec.so.60 => /usr/local/lib/libavcodec.so.60 (0x276268c00000)
         libavformat.so.60 => /usr/local/lib/libavformat.so.60 (0x276265730000)
         libavutil.so.58 => /usr/local/lib/libavutil.so.58 (0x2762660a4000)
         libopenh264.so.6 => /usr/local/lib/libopenh264.so.6 (0x276266a54000)
         libvpx.so.8 => /usr/local/lib/libvpx.so.8 (0x27626773d000)
         libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1  
(0x2762689f2000)
         libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x27626b144000)
         libwebp.so.7 => /usr/local/lib/libwebp.so.7 (0x27626cfce000)
         libwebpmux.so.3 => /usr/local/lib/libwebpmux.so.3 (0x27626a5c6000)
         libwebpdemux.so.2 => /usr/local/lib/libwebpdemux.so.2 (0x27626bb60000)
         libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x27626c01b000)
         libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x27626dcb7000)
         libharfbuzz-subset.so.0 =>  
/usr/local/lib/libharfbuzz-subset.so.0 (0x27626ea2f000)
         libharfbuzz.so.0 => /usr/local/lib/libharfbuzz.so.0 (0x2762705aa000)
         libre2.so.10 => /usr/local/lib/libre2.so.10 (0x27626f387000)
         libpci.so.3 => /usr/local/lib/libpci.so.3 (0x27626f463000)
         libasound.so.2 => /usr/local/lib/libasound.so.2 (0x276270081000)
         libsnappy.so.1 => /usr/local/lib/libsnappy.so.1 (0x276270948000)
         libdbus-1.so.3 => /usr/local/lib/libdbus-1.so.3 (0x2762710e5000)
         libminizip.so.1 => /usr/local/lib/libminizip.so.1 (0x276271fbe000)
         libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x2762721a3000)
         libxslt.so.1 => /usr/local/lib/libxslt.so.1 (0x276273082000)
         liblcms2.so.2 => /usr/local/lib/liblcms2.so.2 (0x276273702000)
         liblcms2_fast_float.so.1 =>  
/usr/local/lib/liblcms2_fast_float.so.1 (0x276274ea1000)
         liblcms2_threaded.so.1 =>  
/usr/local/lib/liblcms2_threaded.so.1 (0x27627436e000)
         libxkbcommon.so.0 => /usr/local/lib/libxkbcommon.so.0 (0x276275969000)
         libQt6Quick.so.6 => /usr/local/lib/qt6/libQt6Quick.so.6  
(0x276277400000)
         libQt6OpenGL.so.6 => /usr/local/lib/qt6/libQt6OpenGL.so.6  
(0x276276101000)
         libQt6Gui.so.6 => /usr/local/lib/qt6/libQt6Gui.so.6 (0x276279800000)
         libGLX.so.0 => /usr/local/lib/libGLX.so.0 (0x276276583000)
         libOpenGL.so.0 => /usr/local/lib/libOpenGL.so.0 (0x276277e47000)
         libQt6QmlModels.so.6 =>  
/usr/local/lib/qt6/libQt6QmlModels.so.6 (0x276278c81000)
         libQt6WebChannel.so.6 =>  
/usr/local/lib/qt6/libQt6WebChannel.so.6 (0x27627ab7f000)
         libQt6Qml.so.6 => /usr/local/lib/qt6/libQt6Qml.so.6 (0x27627bcaf000)
         libQt6Network.so.6 => /usr/local/lib/qt6/libQt6Network.so.6  
(0x27627dbf9000)
         libQt6Positioning.so.6 =>  
/usr/local/lib/qt6/libQt6Positioning.so.6 (0x27627b9e2000)
         libQt6Core.so.6 => /usr/local/lib/qt6/libQt6Core.so.6 (0x276280c00000)
         libc++.so.1 => /lib/libc++.so.1 (0x27627c956000)
         libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x27627d0c5000)
         libc.so.7 => /lib/libc.so.7 (0x276250578000)
         libelf.so.2 => /lib/libelf.so.2 (0x27624f87e000)
         libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x27627ebf0000)
         libswresample.so.4 => /usr/local/lib/libswresample.so.4  
(0x27627ede6000)
         liblzma.so.5 => /usr/lib/liblzma.so.5 (0x27627f993000)
         libdav1d.so.6 => /usr/local/lib/libdav1d.so.6 (0x276280480000)
         libaom.so.3 => /usr/local/lib/libaom.so.3 (0x276283150000)
         libjxl.so.0.8 => /usr/local/lib/libjxl.so.0.8 (0x276281212000)
         libjxl_threads.so.0.8 => /usr/local/lib/libjxl_threads.so.0.8  
(0x27628257f000)
         libSvtAv1Enc.so.1 => /usr/local/lib/libSvtAv1Enc.so.1 (0x276284903000)
         libtheoraenc.so.1 => /usr/local/lib/libtheoraenc.so.1 (0x27628532b000)
         libtheoradec.so.1 => /usr/local/lib/libtheoradec.so.1 (0x276285980000)
         libvorbis.so.0 => /usr/local/lib/libvorbis.so.0 (0x27628723d000)
         libvorbisenc.so.2 => /usr/local/lib/libvorbisenc.so.2 (0x276286835000)
         libx264.so.164 => /usr/local/lib/libx264.so.164 (0x27628783e000)
         libx265.so.192 => /usr/local/lib/libx265.so.192 (0x276288ea2000)
         libSvtHevcEnc.so.1 => /usr/local/lib/libSvtHevcEnc.so.1  
(0x27628c800000)
         libxvidcore.so.4 => /usr/local/lib/libxvidcore.so.4 (0x276288596000)
         libbz2.so.4 => /usr/lib/libbz2.so.4 (0x27628ac62000)
         libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x27628b80f000)
         libgnutls.so.30 => /usr/local/lib/libgnutls.so.30 (0x27628d983000)
         libdrm.so.2 => /usr/local/lib/libdrm.so.2 (0x27628deae000)
         libsharpyuv.so.0 => /usr/local/lib/libsharpyuv.so.0 (0x27628efdf000)
         libbrotlidec.so.1 => /usr/local/lib/libbrotlidec.so.1 (0x27628edb4000)
         libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x27628f2b7000)
         libgraphite2.so.3 => /usr/local/lib/libgraphite2.so.3 (0x27629100c000)
         librt.so.1 => /usr/lib/librt.so.1 (0x27628fc7a000)
         libicui18n.so.73 => /usr/local/lib/libicui18n.so.73 (0x27628fd28000)
         libicuuc.so.73 => /usr/local/lib/libicuuc.so.73 (0x276291f0d000)
         libicudata.so.73 => /usr/local/lib/libicudata.so.73 (0x27629365e000)
         libEGL.so.1 => /usr/local/lib/libEGL.so.1 (0x27629274b000)
         libQt6DBus.so.6 => /usr/local/lib/qt6/libQt6DBus.so.6 (0x2762943b6000)
         libgthread-2.0.so.0 => /usr/local/lib/libgthread-2.0.so.0  
(0x276294d4c000)
         libGLdispatch.so.0 => /usr/local/lib/libGLdispatch.so.0  
(0x276295966000)
         libX11.so.6 => /usr/local/lib/libX11.so.6 (0x276295ed1000)
         libzstd.so.1 => /usr/local/lib/libzstd.so.1 (0x276296f08000)
         libdouble-conversion.so.3 =>  
/usr/local/lib/libdouble-conversion.so.3 (0x276298932000)
         libpcre2-16.so.0 => /usr/local/lib/libpcre2-16.so.0 (0x2762976cc000)
         libmd.so.6 => /lib/libmd.so.6 (0x276297e94000)
         libhwy.so.1 => /usr/local/lib/libhwy.so.1 (0x276298ca4000)
         libbrotlienc.so.1 => /usr/local/lib/libbrotlienc.so.1 (0x27629a1f8000)
         libogg.so.0 => /usr/local/lib/libogg.so.0 (0x27629913d000)
         libintl.so.8 => /usr/local/lib/libintl.so.8 (0x276299b34000)
         libp11-kit.so.0 => /usr/local/lib/libp11-kit.so.0 (0x27629afc4000)
         libunistring.so.5 => /usr/local/lib/libunistring.so.5 (0x27629b413000)
         libtasn1.so.6 => /usr/local/lib/libtasn1.so.6 (0x27629c8c1000)
         libnettle.so.8 => /usr/local/lib/libnettle.so.8 (0x27629bef7000)
         libhogweed.so.6 => /usr/local/lib/libhogweed.so.6 (0x27629cf3b000)
         libbrotlicommon.so.1 => /usr/local/lib/libbrotlicommon.so.1  
(0x27629dea6000)
         libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x27629ee92000)
         libpcre2-8.so.0 => /usr/local/lib/libpcre2-8.so.0 (0x27629f868000)
         libxcb.so.1 => /usr/local/lib/libxcb.so.1 (0x2762a0c13000)
         libffi.so.8 => /usr/local/lib/libffi.so.8 (0x2762a0843000)
         libXau.so.6 => /usr/local/lib/libXau.so.6 (0x2762a1921000)
         libXdmcp.so.6 => /usr/local/lib/libXdmcp.so.6 (0x2762a214f000)
---snip---

Bye,
Alexander.

-- 
http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    netchild@FreeBSD.org  : PGP 0x8F31830F9F2772BF