Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qt5-base] libx11-xcb-dev is not the only package required for the GUI components #11727

Closed
davidebeatrici opened this issue Jun 2, 2020 · 26 comments
Assignees
Labels
requires:repro The issue is not currently repro-able

Comments

@davidebeatrici
Copy link
Contributor

The port warns the user that libx11-xcb-dev is required, but it's not the only dependency.

Qt's build system skips targets it doesn't find the dependencies for, resulting in the Xcb platform plugin not being compiled. Without this plugin GUI applications cannot work:

qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Aborted (core dumped)

From https://forum.qt.io/post/537667:

Daniel Williams Jun 26, 2019, 7:45 PM

This is what I ultimately had to do to resolve the issue:

sudo apt install libxkbcommon-dev
sudo apt install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev

../Qt/5.12.4/Src/configure -static -prefix ~/qt-5124 -system-xcb -recheck-all

Note:
I had a build directory that I used for an interim build location: ~/qt-5124-build. In that directory, there were two very useful file:
config.log
config.summary

I'm not sure whether all packages are actually needed, but I can confirm that installing them results in the plugin being compiled on Ubuntu 18.04. On 16.04 too, but it's not supported by Qt anymore.

If Qt is built as static, the plugin has to be linked to the target in CMake:

if(TARGET Qt5::QXcbIntegrationPlugin)
	include_qt_plugin(my_app PRIVATE QXcbIntegrationPlugin)
	target_link_libraries(my_app PRIVATE Qt5::QXcbIntegrationPlugin)
endif()

include_qt_plugin() can be found at https://github.com/davidebeatrici/mumble/blob/cmake/cmake/qt-utils.cmake.

@davidebeatrici
Copy link
Contributor Author

Unfortunately applications crash as soon as Qt tries to load the fonts, after freezing for a few seconds.

Running https://github.com/davidebeatrici/CMake_Qt_Example:

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff434b801 in __GI_abort () at abort.c:79
#2  0x00007ffff4394897 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff44c1b9a "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff439b90a in malloc_printerr (str=str@entry=0x7ffff44bfd88 "free(): invalid pointer") at malloc.c:5350
#4  0x00007ffff43a2e1c in _int_free (have_lock=0, p=0x555558c32b10, av=0x7ffff46f6c40 <main_arena>) at malloc.c:4157
#5  __GI___libc_free (mem=0x555558c32b20) at malloc.c:3124
#6  0x00005555563500b3 in ft_free (memory=0x555558b4b610, block=0x555558c32b20) at /home/user/vcpkg/buildtrees/freetype/src/2.10.1-ea10bbeefe/src/base/ftsystem.c:138
#7  0x000055555634e57f in ft_mem_free (memory=0x555558b4b610, P=0x555558c32b20) at /home/user/vcpkg/buildtrees/freetype/src/2.10.1-ea10bbeefe/src/base/ftutil.c:174
#8  0x000055555634c7d3 in FT_Stream_ReleaseFrame (stream=0x555558b8b500, pbytes=0x7fffffffbfe8) at /home/user/vcpkg/buildtrees/freetype/src/2.10.1-ea10bbeefe/src/base/ftstream.c:226
#9  0x000055555635c081 in cff_index_forget_element (idx=0x555558bb7c38, pbytes=0x7fffffffbfe8) at /home/user/vcpkg/buildtrees/freetype/src/2.10.1-ea10bbeefe/src/cff/cffload.c:604
#10 0x0000555556358531 in cff_free_glyph_data (face=0x555558b70b50, pointer=0x7fffffffbfe8, length=847) at /home/user/vcpkg/buildtrees/freetype/src/2.10.1-ea10bbeefe/src/cff/cffgload.c:110
#11 0x0000555556358f3c in cff_slot_load (glyph=0x555558b50ab0, size=0x0, glyph_index=30478, load_flags=523) at /home/user/vcpkg/buildtrees/freetype/src/2.10.1-ea10bbeefe/src/cff/cffgload.c:462
#12 0x000055555635739e in cff_glyph_load (cffslot=0x555558b50ab0, cffsize=0x555558ba7d30, glyph_index=30478, load_flags=523) at /home/user/vcpkg/buildtrees/freetype/src/2.10.1-ea10bbeefe/src/cff/cffdrivr.c:193
#13 0x0000555556342302 in FT_Load_Glyph (face=0x555558b70b50, glyph_index=30478, load_flags=523) at /home/user/vcpkg/buildtrees/freetype/src/2.10.1-ea10bbeefe/src/base/ftobjs.c:952
#14 0x00005555561c3c1b in FcFreeTypeCheckGlyph (face=0x555558b70b50, ucs4=31850, glyph=30478, blanks=0x555558aeea20 <fcBlanks>, advance=0x7fffffffcd38, using_strike=0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcfreetype.c:2223
#15 0x00005555561c3e2f in FcFreeTypeCharSetAndSpacingForSize (face=0x555558b70b50, blanks=0x555558aeea20 <fcBlanks>, spacing=0x7fffffffce78, strike_index=-1)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcfreetype.c:2304
#16 0x00005555561c4600 in FcFreeTypeCharSetAndSpacing (face=0x555558b70b50, blanks=0x555558aeea20 <fcBlanks>, spacing=0x7fffffffce78) at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcfreetype.c:2480
#17 0x00005555561c319a in FcFreeTypeQueryFace (face=0x555558b70b50, file=0x555558b80820 "/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc", id=1, blanks=0x555558aeea20 <fcBlanks>)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcfreetype.c:1855
#18 0x00005555561c0021 in FcFileScanFontConfig (set=0x555558bb63f0, blanks=0x555558aeea20 <fcBlanks>, file=0x555558b80820 "/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc", config=0x555558b364c0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcdir.c:102
#19 0x00005555561c032d in FcFileScanConfig (set=0x555558bb63f0, dirs=0x555558b4b570, blanks=0x555558aeea20 <fcBlanks>, file=0x555558b80820 "/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc", config=0x555558b364c0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcdir.c:204
#20 0x00005555561c05ea in FcDirScanConfig (set=0x555558bb63f0, dirs=0x555558b4b570, blanks=0x555558aeea20 <fcBlanks>, dir=0x555558b4b6b0 "/usr/share/fonts/opentype/noto", force=1, config=0x555558b364c0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcdir.c:305
#21 0x00005555561c0802 in FcDirCacheScan (dir=0x555558b48c00 "/usr/share/fonts/opentype/noto", config=0x555558b364c0) at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcdir.c:371
#22 0x00005555561c0b3e in FcDirCacheRead (dir=0x555558b48c00 "/usr/share/fonts/opentype/noto", force=0, config=0x555558b364c0) at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcdir.c:470
#23 0x00005555561b6834 in FcConfigAddDirList (config=0x555558b364c0, set=FcSetSystem, dirSet=0x555558b4cce0) at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fccfg.c:380
#24 0x00005555561b6904 in FcConfigBuildFonts (config=0x555558b364c0) at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fccfg.c:413
#25 0x00005555561c56b3 in FcInitLoadOwnConfigAndFonts (config=0x555558b364c0) at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcinit.c:163
#26 0x00005555561c56de in FcInitLoadConfigAndFonts () at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcinit.c:174
#27 0x00005555561b5d4a in FcConfigEnsure () at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fccfg.c:46
#28 0x00005555561b5d87 in FcConfigInit () at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fccfg.c:59
#29 0x00005555561c56e9 in FcInit () at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f/src/fcinit.c:183
#30 0x00005555561b225f in QFontconfigDatabase::populateFontDatabase (this=<optimized out>) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp:524
#31 0x0000555555c89b29 in initializeDb () at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/gui/text/qfontdatabase.cpp:893
#32 0x0000555555c8c98b in QFontDatabase::findFont (request=..., script=script@entry=2) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/gui/text/qfontdatabase.cpp:2652
#33 0x0000555555c8d52f in QFontDatabase::load (d=d@entry=0x555558b3e530, script=script@entry=2) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/gui/text/qfontdatabase.cpp:2817
#34 0x0000555555c752ed in QFontPrivate::engineForScript (this=0x555558b3e530, script=script@entry=2) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/gui/text/qfont.cpp:217
#35 0x0000555555c93de8 in QScriptLine::setDefaultHeight (this=this@entry=0x555558b7c218, eng=0x555558b51400) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/gui/text/qtextengine.cpp:2811
#36 0x0000555555ca9910 in QTextLine::layout_helper (this=this@entry=0x7fffffffdaf0, maxGlyphs=maxGlyphs@entry=2147483647) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/gui/text/qtextlayout.cpp:1796
#37 0x0000555555cab3e7 in QTextLine::setNumColumns (this=this@entry=0x7fffffffdaf0, numColumns=numColumns@entry=2147483647) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/gui/text/qtextlayout.cpp:1612
#38 0x0000555555cab558 in QTextLayout::endLayout (this=this@entry=0x555558b4aff8) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/gui/text/qtextlayout.cpp:667
#39 0x000055555591f81c in QWidgetLineControl::redoTextLayout (this=this@entry=0x555558b4af20) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/widgets/widgets/qwidgetlinecontrol.cpp:78
#40 0x000055555591fcc6 in QWidgetLineControl::updateDisplayText (this=this@entry=0x555558b4af20, forceUpdate=forceUpdate@entry=false)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/widgets/widgets/qwidgetlinecontrol.cpp:140
#41 0x0000555555920066 in QWidgetLineControl::init (this=this@entry=0x555558b4af20, txt=...) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/widgets/widgets/qwidgetlinecontrol.cpp:371
#42 0x0000555555b68462 in QWidgetLineControl::QWidgetLineControl (txt=..., this=0x555558b4af20)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/include/QtWidgets/5.12.8/QtWidgets/private/../../../../../src/widgets/widgets/qwidgetlinecontrol_p.h:108
#43 QLineEditPrivate::init (this=0x555558b4ac90, txt=...) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/widgets/widgets/qlineedit_p.cpp:181
#44 0x0000555555918bc4 in QLineEdit::QLineEdit (this=0x555558b832e0, contents=..., parent=0x555558b837f0) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/widgets/widgets/qlineedit.cpp:280
#45 0x0000555555918bfa in QLineEdit::QLineEdit (this=<optimized out>, parent=<optimized out>) at /home/user/vcpkg/buildtrees/qt5-base/src/5.12.8-58a5dc6709/src/widgets/widgets/qlineedit.cpp:261
#46 0x0000555555841c87 in Ui_MainWindow::setupUi (this=0x555558b46880, MainWindow=0x7fffffffdde0) at cmake_qt_example_autogen/include/ui_MainWindow.h:37
#47 0x000055555584187a in MainWindow::MainWindow (this=0x7fffffffdde0, parent=0x0) at ../src/MainWindow.cpp:8
#48 0x00005555558416e6 in main (argc=1, argv=0x7fffffffdf18) at ../src/main.cpp:25

@JackBoosY
Copy link
Contributor

@Neumann-A Could you please take a look?

Thanks.

@Neumann-A
Copy link
Contributor

@JackBoosY: related: 6b10332
I thought about adding all those libs to the message but the message becomes very long. I thought about just adding a hint to https://doc.qt.io/qt-5/linux-requirements.html
About the Font issue: Maybe some other qt plugins are missing? I would first retry to switch to 5.14 or try the 5.15 PR since there plugin integration in static builds is automatic. Otherwise try switching all of Qt to dynamic library linkage.

@davidebeatrici
Copy link
Contributor Author

davidebeatrici commented Jul 14, 2020

I'm building Qt again now that #11596 is merged.

For reference: the portfile initially failed to build during the configure step because libxkbcommon-x11-dev was not installed.

@Neumann-A
Copy link
Contributor

As long as you are on ubuntu 18.04 you should be fine. on 20.04 we need to update or fix our fontconfig first to make it work.
Unfortunately Qt requires a bunch of system libraries:

# Install common build dependencies
APT_PACKAGES="at curl unzip tar libxt-dev gperf libxaw7-dev cifs-utils \
build-essential g++ gfortran zip libx11-dev libxkbcommon-x11-dev libxi-dev \
libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxinerama-dev \
libxcursor-dev yasm libnuma1 libnuma-dev python-six python3-six python-yaml \
flex libbison-dev autoconf libudev-dev libncurses5-dev libtool libxrandr-dev \
xutils-dev dh-autoreconf libgles2-mesa-dev ruby-full pkg-config"
# Additionally required by qt5-base
APT_PACKAGES="$APT_PACKAGES libxext-dev libxfixes-dev libxrender-dev \
libxcb1-dev libx11-xcb-dev libxcb-glx0-dev"
# Additionally required by qt5-base for qt5-x11extras
APT_PACKAGES="$APT_PACKAGES libxkbcommon-dev libxcb-keysyms1-dev \
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev \
libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev \
libxcb-render-util0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev"

@davidebeatrici
Copy link
Contributor Author

Unfortunately qt5-declarative fails to build:
package-build-x64-linux-dbg-err.log

@JackBoosY
Copy link
Contributor

JackBoosY commented Jul 15, 2020

@Neumann-A Seems the compiler can't open many json files.

@Neumann-A
Copy link
Contributor

@davidebeatrici: Have you retried? I cannot find an error in there which is not a killed 9. Either you killed the process or your system killed the process. https://stackoverflow.com/questions/726690/what-killed-my-process-and-why

@JackBoosY: I think the *.json failures can be ignored. It seems like it is a new feature of qt to export json files for metatypes which is not yet fleshed out. On my machine (WSL2) qt5-declarative builds fine despite the missing files.

@Neumann-A
Copy link
Contributor

@JackBoosY: since qt5network_metatypes.json would be generated by qt5-base here is a file list of arch_linux for qt5-base 5.15. It also does not contain the file. https://www.archlinux.org/packages/extra/x86_64/qt5-base/files/

@davidebeatrici
Copy link
Contributor Author

@Neumann-A I initially thought it was due to the virtual machine's RAM being full, however after increasing it and retrying multiple times the behavior didn't change.

Only qt5core_metatypes.json, qt5gui_metatypes.json and qt5widgets_metatypes.json are generated.

@Neumann-A
Copy link
Contributor

Only qt5core_metatypes.json, qt5gui_metatypes.json and qt5widgets_metatypes.json are generated.

@davidebeatrici That seems to be normal. Since in a successful built only those exists and those also are the only ones in the arch linux filelist. If the process is killed you have to find out why it is killed. The logs do not indicate a problem.

@davidebeatrici
Copy link
Contributor Author

Sorry, I missed the second part of your message.

I tried to lower the thread count from 8 to 4, but ld still gets killed.
I'm going to increase the physical RAM so that I can assign more GB to the VM and let you know how it goes.

@JackBoosY JackBoosY added the requires:repro The issue is not currently repro-able label Jul 16, 2020
@JackBoosY
Copy link
Contributor

@davidebeatrici Any progress?

@davidebeatrici
Copy link
Contributor Author

@JackBoosY Waiting for the RAM sticks to arrive.

@davidebeatrici
Copy link
Contributor Author

Now that I assigned 16 GB and 8 threads to the VM Qt successfully built, but unfortunately I'm encountering the exact same issue:

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff3a798b1 in __GI_abort () at abort.c:79
#2  0x00007ffff3ac2907 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff3befdfa "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff3ac997a in malloc_printerr (str=str@entry=0x7ffff3bedefd "corrupted size vs. prev_size") at malloc.c:5350
#4  0x00007ffff3ac9b7c in malloc_consolidate (av=av@entry=0x7ffff3e24c40 <main_arena>) at malloc.c:4456
#5  0x00007ffff3ad10ab in _int_free (have_lock=0, p=<optimized out>, av=0x7ffff3e24c40 <main_arena>) at malloc.c:4362
#6  __GI___libc_free (mem=0x555559f77000) at malloc.c:3124
#7  0x000055555732293e in ft_free (memory=0x555559f18cb0, block=0x555559f77000)
    at /home/user/vcpkg/buildtrees/freetype/src/2.10.2-e314d3310b.clean/builds/unix/ftsystem.c:158
#8  0x000055555729ca1a in ft_mem_free (memory=0x555559f18cb0, P=0x555559f77000)
    at /home/user/vcpkg/buildtrees/freetype/src/2.10.2-e314d3310b.clean/src/base/ftutil.c:174
#9  0x00005555572a9936 in cff_index_done (idx=0x555559f6e9b0)
    at /home/user/vcpkg/buildtrees/freetype/src/2.10.2-e314d3310b.clean/src/cff/cffload.c:335
#10 0x00005555572acdc2 in cff_subfont_done (memory=0x555559f18cb0, subfont=0x555559f6e538)
    at /home/user/vcpkg/buildtrees/freetype/src/2.10.2-e314d3310b.clean/src/cff/cffload.c:2165
#11 0x00005555572ada9d in cff_font_done (font=0x555559fce1b0)
    at /home/user/vcpkg/buildtrees/freetype/src/2.10.2-e314d3310b.clean/src/cff/cffload.c:2540
#12 0x00005555572afef2 in cff_face_done (cffface=0x555559f2a490)
    at /home/user/vcpkg/buildtrees/freetype/src/2.10.2-e314d3310b.clean/src/cff/cffobjs.c:1145
#13 0x0000555557290d1e in destroy_face (memory=0x555559f18cb0, face=0x555559f2a490, driver=0x555559f19560)
    at /home/user/vcpkg/buildtrees/freetype/src/2.10.2-e314d3310b.clean/src/base/ftobjs.c:1184
#14 0x00005555572932f8 in FT_Done_Face (face=0x555559f2a490)
    at /home/user/vcpkg/buildtrees/freetype/src/2.10.2-e314d3310b.clean/src/base/ftobjs.c:2799
#15 0x000055555674a8e6 in FcFileScanFontConfig (set=0x555559f55df0, blanks=0x555559e7b820 <fcBlanks>, 
    file=0x555559f18ce0 "/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc", config=0x555559f19dd0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fcdir.c:103
#16 0x000055555674abe2 in FcFileScanConfig (set=0x555559f55df0, dirs=0x555559f18c50, blanks=0x555559e7b820 <fcBlanks>, 
    file=0x555559f18ce0 "/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc", config=0x555559f19dd0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fcdir.c:204
#17 0x000055555674ae9f in FcDirScanConfig (set=0x555559f55df0, dirs=0x555559f18c50, blanks=0x555559e7b820 <fcBlanks>, 
    dir=0x555559f18c20 "/usr/share/fonts/opentype/noto", force=1, config=0x555559f19dd0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fcdir.c:305
#18 0x000055555674b0b7 in FcDirCacheScan (dir=0x555559f19f50 "/usr/share/fonts/opentype/noto", config=0x555559f19dd0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fcdir.c:371
#19 0x000055555674b3f3 in FcDirCacheRead (dir=0x555559f19f50 "/usr/share/fonts/opentype/noto", force=0, config=0x555559f19dd0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fcdir.c:470
#20 0x00005555567410e9 in FcConfigAddDirList (config=0x555559f19dd0, set=FcSetSystem, dirSet=0x555559ed86b0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fccfg.c:380
#21 0x00005555567411b9 in FcConfigBuildFonts (config=0x555559f19dd0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fccfg.c:413
#22 0x000055555674ff68 in FcInitLoadOwnConfigAndFonts (config=0x555559f19dd0)
    at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fcinit.c:163
#23 0x000055555674ff93 in FcInitLoadConfigAndFonts () at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fcinit.c:174
#24 0x00005555567405ff in FcConfigEnsure () at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fccfg.c:46
#25 0x000055555674063c in FcConfigInit () at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fccfg.c:59
#26 0x000055555674ff9e in FcInit () at /home/user/vcpkg/buildtrees/fontconfig/src/2.12.4-4b62bc356f.clean/src/fcinit.c:183
#27 0x00005555564be4d3 in QFontconfigDatabase::populateFontDatabase (this=<optimized out>)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp:541
#28 0x00005555561d266d in initializeDb ()
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/gui/text/qfontdatabase.cpp:900
#29 0x00005555561d684e in QFontDatabase::findFont (request=..., script=script@entry=2)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/gui/text/qfontdatabase.cpp:2656
#30 0x00005555561d75f9 in QFontDatabase::load (d=d@entry=0x555559ef4400, script=script@entry=2)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/gui/text/qfontdatabase.cpp:2823
#31 0x00005555561bf34f in QFontPrivate::engineForScript (this=0x555559ef4400, script=script@entry=2)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/gui/text/qfont.cpp:227
#32 0x00005555561ddaea in QScriptLine::setDefaultHeight (this=this@entry=0x555559f198e8, eng=0x555559f1bed0)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/gui/text/qtextengine.cpp:2821
#33 0x00005555561f288a in QTextLine::layout_helper (this=this@entry=0x7fffffffdae0, maxGlyphs=maxGlyphs@entry=2147483647)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/gui/text/qtextlayout.cpp:1812
#34 0x00005555561f4335 in QTextLine::setNumColumns (this=this@entry=0x7fffffffdae0, numColumns=numColumns@entry=2147483647)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/gui/text/qtextlayout.cpp:1621
#35 0x00005555561f44a2 in QTextLayout::endLayout (this=this@entry=0x555559ed48c8)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/gui/text/qtextlayout.cpp:678
#36 0x0000555555e5f8c8 in QWidgetLineControl::redoTextLayout (this=this@entry=0x555559ed47f0)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/widgets/widgets/qwidgetlinecontrol.cpp:79
#37 0x0000555555e5fe31 in QWidgetLineControl::updateDisplayText (this=this@entry=0x555559ed47f0, forceUpdate=forceUpdate@entry=false)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/widgets/widgets/qwidgetlinecontrol.cpp:136
#38 0x0000555555e601d2 in QWidgetLineControl::init (this=this@entry=0x555559ed47f0, txt=...)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/widgets/widgets/qwidgetlinecontrol.cpp:367
#39 0x00005555560aba70 in QWidgetLineControl::QWidgetLineControl (txt=..., this=0x555559ed47f0)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/include/QtWidgets/5.15.0/QtWidgets/private/../../../../../src/widgets/widgets/qwidgetlinecontrol_p.h:104
#40 QLineEditPrivate::init (this=0x555559f190d0, txt=...)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/widgets/widgets/qlineedit_p.cpp:182
#41 0x0000555555e58dea in QLineEdit::QLineEdit (this=0x555559f02c20, contents=..., parent=0x555559ef2aa0)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/widgets/widgets/qlineedit.cpp:280
#42 0x0000555555e58e20 in QLineEdit::QLineEdit (this=<optimized out>, parent=<optimized out>)
    at /home/user/vcpkg/buildtrees/qt5-base/src/5.15.0-f256990b37.clean/src/widgets/widgets/qlineedit.cpp:261
#43 0x0000555555d7e406 in Ui_MainWindow::setupUi (this=0x555559f113e0, MainWindow=0x7fffffffdde0) at cmake_qt_example_autogen/include/ui_MainWindow.h:37
#44 0x0000555555d7e003 in MainWindow::MainWindow (this=0x7fffffffdde0, parent=0x0) at ../src/MainWindow.cpp:8
#45 0x0000555555d7de76 in main (argc=1, argv=0x7fffffffdf18) at ../src/main.cpp:25

@JackBoosY
Copy link
Contributor

#1  0x00007ffff3a798b1 in __GI_abort () at abort.c:79
#2  0x00007ffff3ac2907 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff3befdfa "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff3ac997a in malloc_printerr (str=str@entry=0x7ffff3bedefd "corrupted size vs. prev_size") at malloc.c:5350
#4  0x00007ffff3ac9b7c in malloc_consolidate (av=av@entry=0x7ffff3e24c40 <main_arena>) at malloc.c:4456
#5  0x00007ffff3ad10ab in _int_free (have_lock=0, p=<optimized out>, av=0x7ffff3e24c40 <main_arena>) at malloc.c:4362
#6  __GI___libc_free (mem=0x555559f77000) at malloc.c:3124

Seems like still have memory issues here.

@Neumann-A
Copy link
Contributor

No that is probably an issue with fontconfig not correctly setup. If this is Ubuntu 20.04 you cannot use vcpkgs Qt currently because an update to fontconfig is required. You could try manually setting up the fontdatabase with the fontconfig version of vcpkg but this requires knowledge on how to set that up (and a way to build fc-cache). you could try  #11776 which updates fontconfig and generates a valid fontconfig conf file and database. (You still need to set environment var FONTCONFIG_FILE to point to the generated config though)

@davidebeatrici
Copy link
Contributor Author

davidebeatrici commented Jul 28, 2020

Sorry, I didn't mention that I'm currently building and testing the environment on Ubuntu 18.04:

$ uname -a
Linux ubuntu 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.4 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

Does your suggestion apply to this version of Ubuntu as well?

@ghost
Copy link

ghost commented Aug 20, 2020

Recent vcpkg upgrade --no-dry-run to 5.15 and I am able to compile our project in up to date Debian 10 (Buster). I ran sudo apt-get build-dep qt5-default to address issues with any dependencies in Debian. When I launch our project there is no text in the menus at the root or sub level. There are several Fontconfig errors and warnings similar to this report:

https://bbs.archlinux.org/viewtopic.php?id=235643

I'm not sure that a 32 bit package should be the cause but they do point out possible version issues or changes.

@Neumann-A
Copy link
Contributor

When I launch our project there is no text in the menus at the root or sub level.

That is probably due to fontconfig in vcpkg being outdated. should be fixed by #11776

@kafeg
Copy link
Contributor

kafeg commented Aug 24, 2020

Hey all! I had the same problem.

There is a dirty solution to fix crash inside fontconfig on FcFileScanFontConfig. You could use this CONTROL and portfile.cmake to replace your own files in fontconfig port and rebuild it. After that Qt5 GUI apps will work correctly:

CONTROL

Source: fontconfig
Version: 2.8.0
Homepage: https://www.freedesktop.org/software/fontconfig/front.html
Description: Library for configuring and customizing font access.
Build-Depends: freetype, expat, libiconv, dirent

portfile.cmake

include(vcpkg_common_functions)

set(FONTCONFIG_VERSION 2.8.0)
vcpkg_download_distfile(ARCHIVE
    URLS "https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.gz"
    FILENAME "fontconfig-${FONTCONFIG_VERSION}.tar.gz"
    SHA512 a110e72cc631f1e374324a02f6ba9526b89a547cafe2ae27b9913938b19018843b2940084d62f0dfaf38a6919dea6974fb98422d3908026f6873d5fba17c55a0
)

vcpkg_extract_source_archive_ex(
    OUT_SOURCE_PATH SOURCE_PATH
    ARCHIVE ${ARCHIVE}
    REF ${FONTCONFIG_VERSION}
)

set(ENV{LDFLAGS} "${VCPKG_LINKER_FLAGS} -L${CURRENT_INSTALLED_DIR}/lib/")
set(ENV{LIBS} "$ENV{LIBS} -lfreetype -lbz2 -lpng -lz -lm")

vcpkg_configure_make(
    AUTOCONFIG
    SOURCE_PATH ${SOURCE_PATH}
    OPTIONS --disable-docs --enable-static --with-freetype-config=no
)

vcpkg_install_make()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/var" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" "${CURRENT_PACKAGES_DIR}/var" 
                    "${CURRENT_PACKAGES_DIR}/share/fontconfig/man1" "${CURRENT_PACKAGES_DIR}/debug/share")

vcpkg_fixup_pkgconfig()

file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/fontconfig)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/fontconfig/COPYING ${CURRENT_PACKAGES_DIR}/share/fontconfig/copyright)

As you could see, i downgraded fontconfig from 2.12 to 2.8.0 which could be used to build Qt 5.12.* and changed build from cmake-based to standard configure, make way.

@Neumann-A @JackBoosY @davidebeatrici

PS: I also tried the newest version from #11776 but it doesn't' work for me because i can't compile it.

@davidebeatrici
Copy link
Contributor Author

@kafeg I confirm it works, thank you very much!

Please note that I had to link to the Brotli libraries:

set(ENV{LIBS} "$ENV{LIBS} -lfreetype -lbz2 -lpng -lz -lm -lbrotlidec-static -lbrotlicommon-static")

Otherwise:

/home/user/vcpkg/installed/x64-linux/lib//libfreetype.a(sfnt.c.o): In function `woff2_open_font.isra.18':
sfnt.c:(.text+0xc055): undefined reference to `BrotliDecoderDecompress'
collect2: error: ld returned 1 exit status

@JackBoosY
Copy link
Contributor

Hi guys, since #11776 was merged, does this issue resolved?

@Krzmbrzl
Copy link
Contributor

I am currently in the process of performing some tests with regards to this. Should get results in the upcoming days... ☝️

@davidebeatrici
Copy link
Contributor Author

@JackBoosY Sorry for the delay.

I just checked and the issue appears to be completely fixed.

@Krzmbrzl
Copy link
Contributor

I can confirm that it is working fine now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires:repro The issue is not currently repro-able
Projects
None yet
Development

No branches or pull requests

5 participants