Important: Please read the Qt Code of Conduct -

Cross Compiling Qtbase 5.3.1 for i.MX6

  • Hello,

    I try to cross compile the qtbase 5.3.1 module for the i.MX6 family.

    As described in the following tutorial at freescale web page, I have configured the qtbase module:


    However, the linking process fails with the error:

    @arm-linux-gnueabi-ld: unrecognized option '-Wl,--gc-sections'@

    Normally the -Wl option is used for the gcc call to assign options to the linker directly.

    But why is the -Wl option not removed and only --gc-sections is asigned to ld?

    In the raspberry pi forum, the user bazza has had the same problem and fixed it by removing some environment. variables. Unfortunately he does not decribe the procedure in detail.

    Has somebody an idea, why the -Wl option is not removed by gcc?



  • Linker is defined in your qtbase/mkspecs/$(QMAKESPEC)/qmake.conf as QMAKE_LINK. Command line parameter for --gc-section is defined in qtbase/mkspecs/common/linux.conf with 'Wl'.
    If you use ld as linker, you should remove '-Wl' part from this parameter.

  • You can try this

    intergrated with Wayland 1.5 and Qt 5.3.1

  • Hello,

    many thanks for your response.

    in the file "qtbase/mkspecs/common/linux.conf" I have removed -Wl from the QMAKE_LFLAGS_GCSECTIONS variable:

    @QMAKE_LFLAGS_GCSECTIONS = --gc-sections@

    However, the configure script fails:
    @g++: error: unrecognized command line option ‘--gc-sections’@

    When I delete the QMAKE_LFLAGS_GCSECTIONS completly, the linker fails with the following error:

    @arm-linux-gnueabi-ld: unrecognized option '-Wl,-O1'@

    I use ccache 3.1.8. Is it possible that the ccache is responsible for the problem?


  • Hi,

    I have found the reason for the failing linker call.

    In my environment CC, LD, etc. were declared as read only variables.
    Therefore the cross compile environment in the linux_device_pre.conf cannot be setuped correctly.

    linux_device_pre.conf : QMAKE_LINK = $${QMAKE_CXX}

    This means Qt calls normally the linker with the g++ frontend and not directly ld.

    Now a lot of headers files were not found and I have to add the Qt include directories to the configure call.

    For example why I have to add "-I include/QtCore" to the configure call?
    It is part of the Qt framework.


Log in to reply