Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building a 32bit application on a 64bit machine.
Qt 6.11 is out! See what's new in the release blog

Building a 32bit application on a 64bit machine.

Scheduled Pinned Locked Moved Installation and Deployment
6 Posts 2 Posters 3.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.
  • W Offline
    W Offline
    weaver4
    wrote on last edited by
    #1

    I'm getting close.

    I'm using mkspec linux-g++-32, and the CFLAGS, CXXFLAGS and LFLAGS all have -m32 in them and all of the object files are compiled into 32 bit.

    But the linker is still using -L/usr/lib/x86_64-linux-gnu and not -L/usr/lib/i386-linux-gnu and I can not seem to find out how to fix it. Here is a copy of the linker line:

    *g++ -m32 -o Test2 main.o -L/usr/lib/x86_64-linux-gnu -L/usr/share/jps-audioproc-third-party/boost/lib -lboost_program_options -lboost_system -lboost_thread -L/usr/lib/i386-linux-gnu -lQtCore -lpthread *

    I have tried to remove the x86_64 directory by: LIBS -= -L/usr/lib/x86_64-linux-gnu but that did not work.

    I tried changing the Projects->Build Settings->Build Environment->LD_LIBRARY_PATH to /usr/lib/i386-linux-gnu. But that did not help.

    The error I get is a sequence of errors in the link process like this one:

    /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.so when searching for -lpthread

    and here is a copy of my .pro file.

    *#-------------------------------------------------

    Project created by QtCreator 2014-10-14T11:06:28

    #-------------------------------------------------

    QT += core

    QT -= gui

    QMAKESPEC=linux-g++-32

    QMAKE_CXXFLAGS += -std=c++0x
    QMAKE_CXXFLAGS += -O0

    INCLUDEPATH += /usr/share/jps-audioproc-third-party/boost/include
    LIBS += -L/usr/share/jps-audioproc-third-party/boost/lib -lboost_program_options -lboost_system -lboost_thread
    LIBS += -L/usr/lib/i386-linux-gnu -lpthread
    LIBS -= -L/usr/lib/x86_64-linux-gnu

    TARGET = Test2
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp*

    1 Reply Last reply
    0
    • T Offline
      T Offline
      t3685
      wrote on last edited by
      #2

      Hi,

      I got around the problem by installing a 32-bit virtual machine on my 64-bit machine. If you find a better way, I'm very interested :).

      1 Reply Last reply
      0
      • W Offline
        W Offline
        weaver4
        wrote on last edited by
        #3

        If I go into the make file and change:
        -L/usr/lib/x86_64-linux-gnu
        to
        -L/usr/lib/i386-linux-gnu
        in the LIBS line it all works!!

        Of course next time qmake runs it is reverted.

        But, I can't find out where qmake gets that variable.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          weaver4
          wrote on last edited by
          #4

          This can't be the right way to fix this, but....
          In Projects->Build Settings->Build Steps between the qmake and make steps I added a new step that does this:

          sed -i 's|-L/usr/lib/x86_64-linux-gnu|-L/usr/lib/i386-linux-gnu|' Makefile

          to change the location of the libraries. And it works now.

          come-on-people...there must be a correct way.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            t3685
            wrote on last edited by
            #5

            May I ask how you got 32bit Qt libraries on your 64bit machine. And have you checke the makespec system?

            1 Reply Last reply
            0
            • W Offline
              W Offline
              weaver4
              wrote on last edited by
              #6

              I installed the 32 bit libraries in Ubuntu by running this:
              @sudo apt-get install ia32-libs@

              And yes I changed the makespec to 32 bit by putting this line in the *.pro file:
              @QMAKESPEC=linux-g++-32@

              But I also changed Projects->Build Settings->Build Steps->qmake->Additional arguments to:
              @ -spec linux-g++-32@

              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