Important: Please read the Qt Code of Conduct -

error while make the Makefile on cross compiler on Ubuntu 14.04

  • Hi everyone, i'm using qt5.5 on my computer.
    And i got the issue while i make my Makefile.

    I will got Makefile by sending this code.

    qmake -spec ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/devices/linux-imx6-g++/ -o Makefile

    It has no problem with that but when send "make " to build my program, it will show this error to me.

    arm-poky-linux-gnueabi-g++ -c -pipe -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=softfp -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5 -I../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets -I../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -I../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I. -I../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/devices/linux-imx6-g++ -o main.o main.cpp
    In file included from ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtGui/qwindowdefs.h:37:0,
                     from ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets/qwidget.h:37,
                     from ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets/qmainwindow.h:37,
                     from ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets/QMainWindow:1,
                     from mainwindow.h:4,
                     from main.cpp:1:
    ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtCore/qglobal.h:39:21: fatal error: cstddef: No such file or directory
    compilation terminated.
    make: *** [main.o] Error 1

    And in the other method, i could do this command to get the Makefile too.


    In this case when i make my Makefile it doing fine.
    But if i using -spec to direct to the qmake.config that i want then will get the error like above.

    I don't know why will this happened.
    I'm using the meta-toolchain-qt5 for my cross compiler.

    Did i miss anything or it is the reason that gcc version is too old?

    Please Help !

  • Lifetime Qt Champion


    You should use the qmake that was built with your cross-compiled version of Qt. That should make things easier.

  • @SGaist
    You mean give the directly path to qmake?
    Is that mean my qmake version is too old?

  • Lifetime Qt Champion

    No I mean that when you are building an application with a specific version of Qt, it's always best to use the qmake built along that version of Qt. Doing so you ensure that all the defaults for your projects are already set.

    Most likely you'll be using a version of Qt that is more recent than the one provided with your Linux distribution thus having had bug fixes done.

  • @SGaist
    Now i'm just using


    instead of

    qmake -spec ...

    I saw a document here.

    I think it is the reason why i can't do the -spec to direct the specific qmake.config.

    But i still doubt this is the right way to fix it.
    I'm not sure that using default qmake can be the cross compile too?

  • Lifetime Qt Champion

    @victor-wang As @SGaist already said you should call qmake from your cross-built Qt!
    Like so:

    PATH_TO_CROSS_BUILT_QT/bin/qmake -spec...

    If you just call "qmake" you most probably call qmake from your host Qt, not cross compiled Qt.

  • @jsulm
    Actually i had already try it for like this.

    /mnt/raid115/victor/freescale/opt/fsl-imx-wayland/4.1.15/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake -spec ...

    And it still got the same problem.

    Is the document i gave is the reason why will show this error?

  • Lifetime Qt Champion

    IIRC you shouldn't need to pass the spec parameter since you are using a Qt build that should already be tailored for your device.

Log in to reply