Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to force 32bit target compiling & linking on 64bit platform (64bit Ubuntu 10.10 / Qt 4.7.0 / QtCreator 2.0.1)
Forum Updated to NodeBB v4.3 + New Features

How to force 32bit target compiling & linking on 64bit platform (64bit Ubuntu 10.10 / Qt 4.7.0 / QtCreator 2.0.1)

Scheduled Pinned Locked Moved Qt Creator and other tools
28 Posts 4 Posters 49.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    apclinux
    wrote on last edited by
    #10

    Hello again,

    by temporarily redefining (forcing) the QMAKE_LIBDIR_QT variable in in the linux common qmake mkspec file "/usr/share/qt4/mkspecs/common/linux.conf" to point to "/usr/lib32"

    #QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
    QMAKE_LIBDIR_QT = /usr/lib32

    link build step now executes (as expected, if what I'm expecting is right)

    "g++ -m32 -o my_qt_app file_1.o … file_N.o -L/usr/lib32 -lQtGui -lQtCore -lpthread"

    ("-L/usr/lib" not there anymore, that is what I think might be expected)

    so, there are no link warnings (errors) anymore about Qt libs, but there are still the same
    "ELF: ELFCLASS64" warnings when running the application being built... !?

    as soons as the application starts:
    (<unknown>:10019): Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/immodules/im-cedilla.so: mauvaise classe ELF: ELFCLASS64
    (<unknown>:10019): Gtk-WARNING **: Loading IM context type ‘cedilla’ failed
    (<unknown>:10019): Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/immodules/im-cedilla.so: mauvaise classe ELF: ELFCLASS64
    (<unknown>:10019): Gtk-WARNING **: Loading IM context type ‘cedilla’ failed
    (<unknown>:10019): Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/immodules/im-cedilla.so: mauvaise classe ELF: ELFCLASS64
    (<unknown>:10019): Gtk-WARNING **: Loading IM context type ‘cedilla’ failed
    and, also, later, like this:
    /usr/lib/gio/modules/libgvfsdbus.so: mauvaise classe ELF: ELFCLASS64
    Failed to load module: /usr/lib/gio/modules/libgvfsdbus.so

    No more ideas at this point... And quite sure modifying the linux common mkspec definition
    (QMAKE_LIBDIR_QT / QT_INSTALL_LIBS) is not a good idea...

    Alain-Pierre

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #11

      Some GTK issues, probably caused by loading the wrong libraries. There are some bugreports open at launchpad/canonical; have a look here:

      • https://bugs.launchpad.net/ubuntu/+source/ia32-libs/+bug/646954
      • https://bugs.launchpad.net/ubuntu/+source/ia32-libs/+bug/641056
      • http://plosquare.blogspot.com/2008/12/gtk-warning-wrong-elf-class-elfclass64.html

      I don't know how to fix this and if everything is available on your Ubuntu box, maybe you should ask in some Ubuntu forum too.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        apclinux
        wrote on last edited by
        #12

        Thanks a lot Volker for your help & suggestions.
        I finally posted a bug report both by Ubuntu & Qt-Nokia about all that.
        Best regards.
        Alain-Pierre

        1 Reply Last reply
        0
        • A Offline
          A Offline
          apclinux
          wrote on last edited by
          #13

          Hello again, Alain-Pierre is back...

          Tried same things under x86_64 Fedora 14, can't get successfull when compiling my Qt app with forcing 32bit mode with “-spec linux-g++-32” build profile option.
          Buid process stops on compiling error about missing QtCore/qconfig-i386.h

          so, I made a new try opening a new bug report in Qt/Nokia bug tracking system:

          http://bugreports.qt.nokia.com/browse/QTBUG-17747

          Anymore help very appreciated.
          Best regards.

          Alain-Pierre

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #14

            I doubt that Trolltech/Nokia will care of that. It's clearly something you should blame the distro vendors (Ubuntu/Launchpad, RedHat, etc.) for.

            In your case I would manually build my own set of Qt libs for the 32 bit platform.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • A Offline
              A Offline
              apclinux
              wrote on last edited by
              #15

              Thanks again Volker for your suggestion,
              might you have a crystal bowl ?
              Qt team just answered quite same words as you for my QTBUG-17747
              report/request:

              Oswald Buddenhagen added a comment - 24/Feb/11 5:52 PM

              please try a self-compiled, unpatched qt from us. that you are seeing
              different errors on different distributions is the best indication that you are
              seeing (unrelated) packaging-related problems.

              http://bugreports.qt.nokia.com/browse/QTBUG-17747

              Hmmmmm, okay okay...
              It's not good news for me generally speaking...
              So I'm going to forward my request to Fedora team, even if I will try to do
              what you suggested to me...
              What a maze...

              Regards,

              Alain-Pierre

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #16

                Oh, I would be happy if I had one, be assured :-)

                But in this case, the reaction was so clear and foreseeable. I would do (and actually do) nothing else than refer to the guys that caused the mess and recommend compiling a vanilla version.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  apclinux
                  wrote on last edited by
                  #17

                  Ok Volker,
                  but what shall I download exactly (LGPL packages) from Qt web site ?

                  • Qt SDK for Linux/X11 32-bit** (422 MB) ?
                  • Qt SDK for Linux/X11 64-bit** (530 MB) ?
                  • Qt libraries 4.7.1 for Linux/X11(202 MB) ?
                  • Qt libraries 4.7.1 for embedded Linux (202 MB) ?

                  What can be exactly concerned by what I have largely descripted
                  in my preceding posts ?

                  Shall I re-generate Qt Creator ? qmake ? or only Qt libs ?
                  Shall I choose the 3ébit or 64bit package ?

                  As you know, I try to generate x86 32bit targets with my daily working platform
                  being x86 64bit (Ubuntu or Fedora, not the matter), so what to do exactly ?

                  About differences between different linux distros, would it be better/safer
                  to work with a true Debian platform ? Would it have less pbs about my Qt
                  disagreements than Fedora or Ubuntu ?

                  Nice day / evening to you Volker (I'm going back to home now...)

                  :-)

                  Alain-Pierre

                  [EDIT: fixed list items, use '*' instead of '-', Volker]

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #18

                    Ahm, use neither of these :-)

                    Download the sources of the framework only:

                    • go to http://qt.nokia.com/downloads
                    • click on "go LGPL"
                    • on the right side is "Qt: Framework Only"
                    • the links to the sources are at the end of the introductory paragraph

                    Then unpack the archive, and follow the "installation guide":http://doc.qt.nokia.com/4.7/installation.html. No need to recompile creator etc. qmake is built with every Qt installation you have.

                    Once your compiler has finished and you have issued "make install", make the new Qt version visible to Qt creator: Go to the preferences, Qt 4 and hit the "+"-button and enter the full path to the newly built qmake (usually under /usr/local/Trolltech/Qt-4.7.1/bin) and give it a good name ("4.7.1 32bit" comes into mind).

                    Then - important! - go to the project view in Creator and change the version used to the newly added one! If you forget this, your project will still be compiled against the 64 bit system Qt!

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      apclinux
                      wrote on last edited by
                      #19

                      Hello Volker,

                      Fedora team has also closed my "bug report" because in case of Fedora (14), the solution is already existing...

                      As Kevin Kofler said when closing the bug report :

                      .......................................................................
                      CLOSED NOTABUG

                      Kevin Kofler 2011-02-24 13:41:26 EST

                      su -c "yum install qt-devel.i686"
                      .......................................................................

                      :-) it works fine now, installing the qt-devel.i686 package did the job !

                      Then, I 'm wondering now what would be the equivalent package to install, if ever possible/available, to solve the problem same way on Ubuntu (10.10) ?

                      Without lights from Ubuntu team, I'll try what you proposed to me Volker and I'll inform you about working results.

                      Have a nice w-e !

                      Alain-Pierre

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        apclinux
                        wrote on last edited by
                        #20

                        Just (re)built my own Qt lib (and, more complicated, qvfb tool) for my Fedora 14

                        http://developer.qt.nokia.com/forums/viewthread/4115/

                        :-)

                        Alain-Pierre

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          apclinux
                          wrote on last edited by
                          #21

                          Hello again,

                          it seems that the two download links relative to "Qt libraries 4.7.1 for Linux/X11(202 MB)" and "Qt libraries 4.7.1 for embedded Linux (202 MB)"
                          on the official LGPL Qt download pages will download the same "qt-everywhere-opensource-src-4.7.1.tar.gz" compressed archive file :

                          is this ok ?

                          And what to do when configuring the make process ?

                          How to proceed when issuing the "./configure" command if wanting to build a "normal" Qt-X11 lib kit AND a Qt-embedded lib kit ? Is it by adding a "-embedded" option and indicating different target paths for the normal and embedded targets ?

                          As I understand, default target path will be something like "/usr/local/Trolltech/Qt-4.7.1", but how to specify a different path ?

                          Also, for what target may I specify a (the) "-qvfb" option ? Is it for the normal Qt-X11 one or for the embedded one ?

                          All these details are not clear at all in my mind.
                          Thanks for any lights about that, regards.

                          Alain-Pierre

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            goetz
                            wrote on last edited by
                            #22

                            Did you have a look at the output of

                            @
                            ./configure -help
                            @

                            Hint: -prefix is your friend. This way you can install multiple Qt variants of the same version on your system.

                            To compile for specific system/system variant, use -platform and the same argument as you would for qmake -spec.

                            EDIT: The source packages are always the same, it does not matter where you get them.

                            http://www.catb.org/~esr/faqs/smart-questions.html

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              apclinux
                              wrote on last edited by
                              #23

                              Hello again Volker,

                              • so, I try again to generate my own Qt lib as following :

                              ./configure -platform linux-g++-32 -qvfb ; gmake ; gmake install
                              Which edition of Qt do you want to use ?

                              Type 'c' if you want to use the Commercial Edition.
                              Type 'o' if you want to use the Open Source Edition.

                              o

                              This is the Qt for Linux/X11 Open Source Edition.

                              You are licensed to use this software under the terms of
                              the Lesser GNU General Public License (LGPL) versions 2.1.
                              You are also licensed to use this software under the terms of
                              the GNU General Public License (GPL) versions 3.

                              Type '3' to view the GNU General Public License version 3.
                              Type 'L' to view the Lesser GNU General Public License version 2.1.
                              Type 'yes' to accept this license offer.
                              Type 'no' to decline this license offer.

                              Do you accept the terms of either license? yes

                              Creating qmake. Please wait...
                              g++ -c -o project.o -m32 -pipe -DQMAKE_OPENSOURCE_EDITION -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian -I/home/aoip/qt-everywhere-opensource-src-4.7.1/include -I/home/aoip/qt-everywhere-opensource-src-4.7.1/include/QtCore -I/home/aoip/qt-everywhere-opensource-src-4.7.1/src/corelib/global -I/home/aoip/qt-everywhere-opensource-src-4.7.1/src/corelib/xml -I/home/aoip/qt-everywhere-opensource-src-4.7.1/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/home/aoip/qt-everywhere-opensource-src-4.7.1/mkspecs/linux-g++-32 -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT project.cpp
                              g++ -c -o property.o -m32 -pipe -DQMAKE_OPENSOURCE_EDITION -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian -I/home/aoip/qt-everywhere-opensource-src-4.7.1/include -I/home/aoip/qt-everywhere-opensource-src-4.7.1/include/QtCore -I/home/aoip/qt-everywhere-opensource-src-4.7.1/src/corelib/global -I/home/aoip/qt-everywhere-opensource-src-4.7.1/src/corelib/xml -I/home/aoip/qt-everywhere-opensource-src-4.7.1/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/home/aoip/qt-everywhere-opensource-src-4.7.1/mkspecs/linux-g++-32 -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT property.cpp

                              ...
                              ...
                              ...

                              (to be continued)

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                apclinux
                                wrote on last edited by
                                #24
                                • but it is stopping for obscure reason I don't know what to think about :

                                g++ -c -o qxmlutils.o -m32 -pipe -DQMAKE_OPENSOURCE_EDITION -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian -I/home/aoip/qt-everywhere-opensource-src-4.7.1/include -I/home/aoip/qt-everywhere-opensource-src-4.7.1/include/QtCore -I/home/aoip/qt-everywhere-opensource-src-4.7.1/src/corelib/global -I/home/aoip/qt-everywhere-opensource-src-4.7.1/src/corelib/xml -I/home/aoip/qt-everywhere-opensource-src-4.7.1/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/home/aoip/qt-everywhere-opensource-src-4.7.1/mkspecs/linux-g++-32 -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT /home/aoip/qt-everywhere-opensource-src-4.7.1/src/corelib/xml/qxmlutils.cpp
                                g++ -o "/home/aoip/qt-everywhere-opensource-src-4.7.1/bin/qmake" project.o property.o main.o makefile.o unixmake2.o unixmake.o mingw_make.o option.o winmakefile.o projectgenerator.o meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o borland_bmake.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfile.o qfsfileengine_unix.o qfsfileengine_iterator_unix.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o -m32
                                Basic XLib functionality test failed!
                                You might need to modify the include and library search paths by editing
                                QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/aoip/qt-everywhere-opensource-src-4.7.1/mkspecs/linux-g++-32.
                                /home/aoip/qt-everywhere-opensource-src-4.7.1/bin/qmake -spec mkspecs/linux-g++-64 -o Makefile projects.pro
                                cd /src/tools/bootstrap/ && /home/aoip/qt-everywhere-opensource-src-4.7.1/bin/qmake /src/tools/bootstrap/bootstrap.pro -spec /home/aoip/qt-everywhere-opensource-src-4.7.1/mkspecs/linux-g++-64 -o Makefile
                                Cannot find file: /src/tools/bootstrap/bootstrap.pro.
                                gmake: *** [/src/tools/bootstrap/Makefile] Erreur 2
                                cd /src/tools/bootstrap/ && /home/aoip/qt-everywhere-opensource-src-4.7.1/bin/qmake /src/tools/bootstrap/bootstrap.pro -spec /home/aoip/qt-everywhere-opensource-src-4.7.1/mkspecs/linux-g++-64 -o Makefile
                                Cannot find file: /src/tools/bootstrap/bootstrap.pro.
                                gmake: *** [/src/tools/bootstrap/Makefile] Erreur 2
                                [root@vbox-fedora14-64b qt-everywhere-opensource-src-4.7.1]#

                                • What is "/src/tools/bootstrap/bootstrap.pro" relative to ?

                                • What about "Basic XLib functionality test failed!" ?!

                                • Following the "Basic XLib functionality test failed!" message, why the make procedure suddenly switches to 64bit compiling mode ?!

                                :-(

                                I've read the README file as suggested by the "-help" option of the configure script against the "-platform" option, but it is just directing us to a Qt/Nokia link relative to "tier1/2/3" groups of supported platforms, which is not saying anything about what "values" to set for the "-platform" option... Hu ?

                                • So, if I'm understanding your last post, I decided to specify "-platform linux-g++-32" to make the build procedure compiling Qt lib sources as 32bit x86 target ? It seems it was "ok" because gcc using "-m32" flag as a result untill the "XLib" problem... Was it supposed to be ok ?

                                And I still don't know if "-qvfb" is a valid option for the configure script ?

                                And even when I regenerate and relink the "qvfb" tool with my own built Qt lib (64bit by default when not trying to force the -platform option), my generated applications will not connect to the running qvfb... I was supposing that 32bit generated apps cannot connect to a 64bit qvfb, that is the reason I would build my own Qt lib as 32bit x86 target mode, relink my apps with hat own 32bit Qt lib, rebuild/relink the qvfb with that same own 32bit Qt lib, and then, trying to make my 32bit builtQt app run inside qvfb virtual frame buffer.

                                Lesser and lesser understanding, still not found the way-out, like a mouse in a maze...

                                Alain-Pierre

                                1 Reply Last reply
                                0
                                • G Offline
                                  G Offline
                                  goetz
                                  wrote on last edited by
                                  #25

                                  That bootstrap.pro is to .... tada... bootstrap Qt :-) It basically creates some tools that are needed in the further build process.

                                  So, no working XLib ... it's what it states. Seems you do not have a 32bit version of XLib installed. And now the two well known options: Look if your distro has a 32bit version or compile yourself. But I seriously doubt this is the last library that bails out...

                                  Did you consider setting up a virtual machine and install a native 32bit version of your Linux distro? That would save you a big bunch of further hassles...

                                  http://www.catb.org/~esr/faqs/smart-questions.html

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    apclinux
                                    wrote on last edited by
                                    #26

                                    I was in fact in opposite situation: I was working on a true Fedora 8 system running on a 3Ghz Pentium 4 pc and I was logging to that linux system with ssh / Putty and X11 rendering on my own workstation (Dell Vostro PC) which is a Win Seven 64 bits powered by a quadcore cpu (2.8 Ghz Core-i7)... This is a little strange, no ?

                                    All the Qt Creator, qmake and other Qt/Linux tools run on a single cpu and we are using a multicore cpu machine as a X11 rendering terminal...
                                    So, what I was trying was to "duplicate" the Fedora 8 platform as virtual platform (64bit Ubuntu 10.10 & 64bit Fedora 14) under VirtualBox on the multicore pc workstation to benefit of the multicore power and not having to use Putty which often crashes unexpectingly under Win Seven 64bit !? Or, may be, there is a problem between the XMing server and Putty/SSH ?

                                    Before Win Seven 64bit, I was using a desktop pc with 32bit Win XP system powered by an Athlon64-X2 cpu and Putty was never crashing...

                                    IT'S THE REASON why I tried to work with "direct" virtual Linux platforms on my new Win Seven 64 system multicore workstation, and thus, I thought "why not trying modern 64bit Linux platforms like latest Ubuntu and/or Fedora systems with VirtualBox ?

                                    You know what is the result about 32bit vs 64bit compatibility problems I've been encountering doing so...

                                    Thus, effectively, I may try a "normal" 32bit Linux platform virtualized by mean of VirtualBox... May be I could simply mirror our true Fedora 8 server as a virtual image being run under VrtualBox...

                                    What a pity !

                                    Thank you again Volker for your help which was really valuable concerning Qt libs and tools.

                                    :-)

                                    A-P.

                                    1 Reply Last reply
                                    0
                                    • P Offline
                                      P Offline
                                      post4pavan
                                      wrote on last edited by
                                      #27

                                      Hi All,

                                      I am having the same problem. I am working on X86_64, compiling the C++ files for 32-bit ARM.
                                      In fact I am using Qt_Embedded.
                                      @ubuntu:~/qt-target$ make
                                      cd /src/tools/bootstrap/ && /home/post4pavan/qt-target/bin/qmake /src/tools/bootstrap/bootstrap.pro -spec /home/post4pavan/qt-target/mkspecs/qws/linux-mxc-g++ -o Makefile
                                      Cannot find file: /src/tools/bootstrap/bootstrap.pro.
                                      make: *** [/src/tools/bootstrap/Makefile] Error 2@

                                      I have Xlib dev,dbg needed.
                                      Could not find what went wrong.
                                      Please Suggest!

                                      Qt for Embedded! INTERESTING!

                                      1 Reply Last reply
                                      0
                                      • T Offline
                                        T Offline
                                        tobias.hunger
                                        wrote on last edited by
                                        #28

                                        I avoid these types of problems by developing in chroot environments, using the schroot debian package to help with the setup.

                                        Basically I create a separate (32 or 64bit) linux installation on my ubuntu per project I work on. That way I detect dependency changes in projects pretty easily (as each installation only contains the development stuff needed for that project), it allows to test code using different distributions and it greatly simplifies building 32bit software on my 64bit machine. After all is the whole chroot is 32bit then it can not pick up 64bit libraries anywhere;-)

                                        Debbootstrap is a really simple way to set up such chroots that works great for both debian and ubuntu in all kinds of flavors;-)

                                        1 Reply Last reply
                                        0

                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved