Important: Please read the Qt Code of Conduct -

[Solved] cc1plus: error: unrecognized command line option “-m64″ in Qt4.6.3

  • Hi
    I tried to compile qt-everywhere-opensource-src-4.6.3 for Embedded Linux and after modifying proper qmake.conf and running below command:
    $./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix /usr/local/Qt -qt-mouse-tslib -little-endian -no-webkit -no-qt3support -no-cups -no-largefile -optimized-qmake -no-openssl -nomake tools -qt-sql-sqlite -no-3dnow -system-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-opengl -gtkstyle -no-openvg -no-xshape -no-xsync -no-xrandr -qt-freetype -qt-gfx-linuxfb -qt-kbd-tty -qt-kbd-linuxinput -qt-mouse-tslib -qt-mouse-linuxinput

    I got this error:
    Do you accept the terms of either license? y

    Creating qmake. Please wait…
    arm-none-linux-gnueabi-g++ -c -o project.o -m64 -pipe -DQMAKE_OPENSOURCE_EDITION -O0 -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian -I/usr/local/qt-everywhere-opensource-src-4.6.3/include -I/usr/local/qt-everywhere-opensource-src-4.6.3/include/QtCore -I/usr/local/qt-everywhere-opensource-src-4.6.3/src/corelib/global -I/usr/local/qt-everywhere-opensource-src-4.6.3/src/corelib/xml -I/usr/local/qt-everywhere-opensource-src-4.6.3/tools/shared -DQT_NO_PCRE -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS -I/usr/local/qt-everywhere-opensource-src-4.6.3/mkspecs/linux-g++-64 -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT project.cpp
    cc1plus: error: unrecognized command line option “-m64″
    make: *** [project.o] Error 1
    I have Ubuntu 14.04 64bit operating system. Does that have anything to do with this error?
    Because there are other people who have done this without getting any errors (especially with older versions of Ubuntu I think)

  • Lifetime Qt Champion


    It looks like you are using the cross-compiler to build qmake which is wrong.

    Can you show what you modified ?

  • Thank you for your answer
    I went exactly through the following link :

    That is why I believe that it has worked for other people!

  • Lifetime Qt Champion

    It looks correct but still, there's something that makes the build of qmake use your cross-compiler rather than your system's compiler.

    Did you play with any environment variable ? Modified other files in Qt's tree ?

  • I don't get it. I thought qmake considering the changes that we made in qmake.conf should use cross-compiler instead of system's compiler. By the way what do you mean by system's compiler? DO you mean included gcc in Ubuntu?

    I didn't play with Qt's tree or any other things related to Qt cause I always delete the old files and extract a new Qt4.6.3 when I want to config and make it. But I cant say the same thing about environment variable. Although I don't remember playing with them.
    Where should I look for those changes that you believed I've made in environment variable

    You know what? I will try to install a new Ubuntu in VirtualBox in another computer and do all things again and I will get back to you here.
    Although I should tell you that my current Ubuntu is in VirtualBox too but I don't think that makes a difference.

  • Lifetime Qt Champion

    Yes you need to have at least the build-essentials (or something like that) package installed in Ubuntu.

    At this stage, qmake doesn't exist yet since it's currently building.

  • I think there is a bit of confusion in your intention.
    Please, explain better what you want to achieve.
    Because the link you are posted regards how to compile Qt for this board:

    That board mount a 32bit ARM cpu, and this means that it simply does not support any 64bit operation. That's why you get error for "-m64", because that flags simply should not be there.
    And for compiling Qt for an ARM cpu you MUST use a cross-compiler has you did.
    So, if your intention is to build Qt for an ARM board, then SGaist is wrong !
    And it's correct that you are using cross-compiler ... and the fact that are you using Ubuntu or other linux system does not count.

    In this case, the problem come out because some configuration file or environment variable insert the '-m64' flag that should not be used for cross-compiling on ARM devices that does not support 64bit mode.

  • Thank you
    Yeah I know that it doesn't support 64bit architecture and I'm not gonna do so.
    I simply did what other people have done for their board according to that link and its descriptions and it's pretty simple and a routine job but I don't know why I keep hitting the wall.
    Again I want to compile Qt for this board.
    I don't know where does this ‘-m64’ flag come from.

  • Probably the "-m64" it's added by some default configuration of the Ubuntu.
    You can try to search on the file if it has been setter somewhere.
    If you look at qmake.conf it includes:

    Maybe one of them add "-m64" flags.

    Otherwise, if you don't bother to re-install Ubuntu, you can try to install a 32bit linux and repeat the process.
    Maybe, if the host is 64bit the system for some reason add "-m64" flag.

  • Thank you
    Yeah I kind of figured that out that it's Ubuntu's fault since it seems I'm the only one who has this problem. It's just I'm waiting for a good time to re-install Ubuntu but now that you said 32bit so I'm gonna go with 32bit!
    I'll get back to you
    Thanks again

  • Lifetime Qt Champion

    @Gianluca where am I wrong ? You still need a host compiler to build tools like qmake.

  • Hi guys
    I finally managed to compile Qt4.6.3 . It was all Ubuntu 64 bit fault. I installed a 32 bit version of Ubuntu and it worked pretty much fine. I cant believe this. I spent couple of weeks dealing with this problem :-(
    Anyway thank you guys

  • Lifetime Qt Champion

    Glad you found out, but still it's pretty strange that you couldn't build it properly on a 64 bit. At the same time 4.6.3 is pretty old… If possible, you should consider at least using 4.8.6.

    In the mean time, since you successfully built Qt, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

  • Actually this board only supports Qt up to 4.6.3 and it does not work with newer version of Qt4
    I was aware of the Solved thing. It's just Is there a button or something to mark as Solved
    By the way now I'm having another problem that QtCreator does not recognize qmake completely and I will discuss it in another topic. Thank you

  • Lifetime Qt Champion

    There's no button, you have to edit your original post and modify the title by hand

Log in to reply