Congratulations to our 2022 Qt Champions!

QMetaType::registerType: Binary compatibility break — Size mismatch for type ‘QPaintBufferCacheEntry’ [1024]. Previously registered size 0, now regist

  • Hi, all:

    I'm testing Qt5 . I have Qt5 installed at /opt/Qt5.0.1 (still with some Qt4 libraries installed at /usr/lib/i386-linux-gnu/ ) .
    However, whenever I tried to run my program, I got the following error message:

    bq. QMetaType::registerType: Binary compatibility break -- Size mismatch for type 'QPaintBufferCacheEntry' [1024]. Previously registered size 0, now registering size 12.
    Aborted (core dumped)

    People gave out several solutions, including:

    1. make distclean ( refer to "!topic/sdr-widget/HTVYpo05-vw":!topic/sdr-widget/HTVYpo05-vw )
    2. I can't see a solution but the topic has already been closed here
      ( "": )

    In addition,

    bq. $ echo $PATH

    In my project .pro,

    bq. LIBS += -L/usr/lib \

    -L/usr/lib/i386-linux-gnu \

    -L/opt/Qt5.0.1/5.0.1/gcc/lib \

    clearly, I don't have Qt4 libraries linked, but only Qt5 library path included.

    So, how to solve this problem? Thanks.


  • It seems my problem comes from the newly installed Qt, due to the reason that I have Qt5 installed under /opt/Qt5 .
    However, in my .pro file,
    [quote]CONFIG += qt warn_on debug staticlib[/quote]

    How can I make sure this project is able to find my manually installed Qt5 ?

    For now, the error
    [quote]fatal error: QGraphicsView: No such file or directory[/quote]
    is telling I'm not able to find Qt5 ...


  • Lifetime Qt Champion

    You have to use qmake from /opt/Qt5/bin, that should help to build things correctly

  • Yes, as you can see, I have

    bq. $ echo $PATH

    which means, I'm using qt5-qmake already !! In fact, I don't even have a 2nd qmake under /usr/bin

    Any further suggestions?


  • I guess the problem comes with QT configuration !! If I modify my original code from
    @#include <QWidget>@
    @#include <QtWidgets/QWidget>@

    everything compiles !!!
    Which seems to hint after I successfully Qt5,

    @CONFIG += qt@

    doesn't configure Qt correctly.

    Anyway, I can compile my program now. But, how to solve the Qt configuration issue?


  • Lifetime Qt Champion

    For 5.0, QWidget has moved. It is now in QtWidgets and not QtGui anymore.
    You have to add QT += widgets in your pro files

  • Thank you so much SGaist...

    However, problem continues:

    bq. QMetaType::registerType: Binary compatibility break -- Size mismatch for type 'QPaintBufferCacheEntry' [1024]. Previously registered size 0, now registering size 12.
    The program has unexpectedly finished.

    I've already solved Qt5 and Qwt (add feature) issue. However, the above error message keeps jumping out when I tried to run my program. Please do help...

    thank you

  • Lifetime Qt Champion

    Something worth to try, check that you don't have Qt4 libs in your path when running your application

  • Hi, SGaist. You hit the point !!! ^_^

    I'm running Ubuntu 12.10, in which some other packages rely on libqt4. Therefore, I didn't remove all qt4 packages.

    In fact, for now, beside a full version of Qt5 installed under /opt/Qt5.0.1/5.0.1/gcc/lib
    I still have some Qt4 packages installed at
    @/usr/lib/i386-linux-gnu$ ls libQt*

    So, is there a way for me to specify which Qt(5 or 4) I would like to use?


  • Lifetime Qt Champion

    Check "man ld", it will explain how you can modify the library loading i.e. before starting your program

  • I have the same problem, and trying with -rpath and rpath-link, but that doesnt help.
    In fact, Qt is using g++, and not ld.
    Please help how to come further with this.

  • Lifetime Qt Champion


    g++ is the compiler, ld is the library loader, they don't act at the same moment.

    Does you application use an external library that is linked against Qt 4 ?

  • Thank you for your reply.

    I checked that before but can't find any link to Qt4.
    I have installed Qt5.1.1, but as I have seen in this post before, also my Linux is having Qy4 libraries in the /usr/lib.

    The last action from Qt while building the app is:

    g++ -Wl,-rpath,/home/infologic/Qt5.1.1/5.1.1/gcc -Wl,-rpath,/home/infologic/Qt5.1.1/5.1.1/gcc/lib -o demo-player DemoPlayer.o main.o Enums.o Common.o Instance.o Error.o moc_DemoPlayer.o moc_Instance.o -lvlc -Wl,-rpath-link,/home/infologic/Qt5.1.1/5.1.1/gcc/lib -L/home/infologic/Qt5.1.1/5.1.1/gcc/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
    { test -n "" && DESTDIR="" || DESTDIR=.; } && test $(gdb --version | sed -e 's,[^0-9]+([0-9]).([0-9]).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $DESTDIR" -ex quit 'demo-player' && test -f demo-player.gdb-index && objcopy --add-section '.gdb_index=demo-player.gdb-index' --set-section-flags '.gdb_index=readonly' 'demo-player' 'demo-player' && rm -f demo-player.gdb-index || true

    Maybe you can find something out of this?

    Thanks in advance.

  • The ldd of the release returns:

    ldd demo-player (0xb77c2000) => /usr/lib/ (0xb7785000) => /home/infologic/Qt5.1.1/5.1.1/gcc/lib/ (0xb7159000) => /home/infologic/Qt5.1.1/5.1.1/gcc/lib/ (0xb6cee000) => /home/infologic/Qt5.1.1/5.1.1/gcc/lib/ (0xb686a000) => /usr/lib/ (0xb680b000) => /lib/ (0xb67f0000) => /usr/lib/ (0xb6704000) => /lib/ (0xb66c2000) => /lib/ (0xb66a4000) => /lib/ (0xb6529000) => /usr/lib/ (0xb6429000) => /usr/lib/ (0xb63da000) => /usr/lib/ (0xb62dc000) => /usr/lib/ (0xb61a2000) => /home/infologic/Qt5.1.1/5.1.1/gcc/lib/ (0xb5f7f000) => /home/infologic/Qt5.1.1/5.1.1/gcc/lib/ (0xb5e06000) => /lib/ (0xb5e01000) => /usr/lib/ (0xb5dfe000) => /lib/ (0xb5df5000)
    /lib/ (0xb77c3000) => /usr/lib/ (0xb5dde000) => /usr/lib/ (0xb5dcb000) => /usr/lib/ (0xb5dc7000) => /usr/lib/ (0xb5dc1000) => /usr/lib/ (0xb5dbe000) => /usr/lib/ (0xb5da4000) => /usr/lib/ (0xb5d81000) => /usr/lib/ (0xb5d7b000) => /usr/lib/ (0xb5d6d000) => /lib/ (0xb5d21000) => /usr/lib/ (0xb5d1a000) => /usr/lib/ (0xb5cb6000) => /home/infologic/Qt5.1.1/5.1.1/gcc/lib/ (0xb476d000) => /usr/lib/ (0xb4769000)

  • While testing around I found out that the Qt4 is installed in /usr/include, /usr/lib and Qt5 not.
    However, I do not see a possibility to install Qt5 in these directories. My KDE is using Qt4.

    As above, how can I force to only use Qt5 in my demo program?
    I also included the -I flag, but when checking the folders it still uses the /usr/include having the Qt4 files.

  • Lifetime Qt Champion

    Please use codings tags when posting code/ldd output etc... It will make them readable.

    Don't try to put the two sets of include/libraries in the same folders.

    Qt 5 is good where it is. Try to run your program with QT_DEBUG_PLUGINS=1 to see what plugins are loaded (i.e. the theme plugin) and check them to see whether one of them pulls Qt4 in

  • I have added the arguments, and the compile output gives:
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_DEBUG_PLUGINS=1

    Running the application gives:

    Starting /home/infologic/workspace/cpp/infologic/demo-player/demo-player...
    QMetaType::registerType: Binary compatibility break -- Size mismatch for type 'QPaintBufferCacheEntry' [1024]. Previously registered size 12, now registering size 0.
    The program has unexpectedly finished.
    /home/infologic/workspace/cpp/infologic/demo-player/demo-player exited with code 0

    It seems it crashes before loading the plugins.

    I managed to force Qt to only use include files from Qt5.

  • Lifetime Qt Champion

    Not build, run your program with QT_DEBUG_PLUGINS=1

  • I have found the reason. I created a new project, and that one gave me a backtrack.
    It's loading the, which is causing the troubles.
    Removing this file from the plugins dir solves the crash!

    I copied the plugins dir, removed the gui subdir and set the environment var VLC_PLUGIN_PATH=<new dir>

  • Lifetime Qt Champion

    That might indeed happen with all libraries that uses Qt (qca comes into mind)

    Glad you found out.

    Happy coding :)

Log in to reply