I am trying to run this simple example on an external embedded device: https://doc.qt.io/qt-5/qtwebengine-webengine-minimal-example.html#
It runs fine on my desktop, but when I run it on my device I get the following output:
[0820/143911.204817:ERROR:nss_util.cc(94)] Failed to create /home/root/.pki/nssdb directory.
[0820/143911.325717:ERROR:nss_util.cc(94)] Failed to create /home/root/.pki/nssdb directory.
QFontDatabase: Cannot find font directory /usr/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig.
[2861:2880:0820/143911.407749:ERROR:surface_factory_qt.cpp(82)] eglGetProcAddress not found.
[2861:2876:0820/143911.513052:ERROR:nss_util.cc(94)] Failed to create /home/root/.pki/nssdb directory.
[2861:2861:0820/143911.534321:FATAL:platform_font_linux.cc(63)] Check failed: typeface. Could not find any font: sans, sans
#0 0x0000b322ee9a <unknown>
#1 0x0000b323924a <unknown>
#2 0x0000b358221e <unknown>
#3 0x0000b358255e <unknown>
#4 0x0000b3582636 <unknown>
#5 0x0000b357d5b4 <unknown>
#6 0x0000b2fb3f82 <unknown>
#7 0x0000b2fb3fd2 <unknown>
#8 0x0000b2d3443a QtWebEngineCore::WebContentsAdapter::initialize()
Aborted (core dumped)
I do set a default font to my application and bundle it as a resource.
int fontId = QFontDatabase::addApplicationFont(":/fonts/SourceHanSans-Regular.ttc");
if (fontId != -1) {
QFont m_font("Source Han San");
m_application->setFont(m_font);
}
I tried to search around, but didn't really find any useful information regarding the ERRORS. Anybody else had this issue before? I am using Qt 5.9.6.
Webengine needs working fontconfig and compatible fonts have to be installed in the directories searched by fontconfig.