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 qt-4.8.4 link error.
QtWS25 Last Chance

Building qt-4.8.4 link error.

Scheduled Pinned Locked Moved Installation and Deployment
3 Posts 2 Posters 2.2k Views
  • 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.
  • T Offline
    T Offline
    tpham3783
    wrote on last edited by
    #1

    Hi all,

    I was building qt-4.8.4 from source on a linux-from-scratch distribution and noticed that there were some problems with the build system when configured for linux x86 using g++ 4.5.1 compiler.

    First problem: build system could not link objects because some parameters in LDFLAGS were set to, for example: -Wl,-rpath-link,/some/path -Wl,-rpath,/some/path -Wl,-O1 . These parameters should be set to: -rpath-link /some/path -rpath /some/path -O1. One way that I fixed this was to overwrite the default linker to g++ compiler, since all the linker's parameters were written as if they are for the compiler. Running: "make QMAKE_LINK=g++" allowed me to overwrite the linker, and it worked.

    I also made the following changes to the configure script because before using qmake, the build system still uses ld linker to build basic tools/utils. Here was the patch:
    @
    --- configure.vanilla 2013-04-23 12:25:37.000000000 -0400
    +++ configure 2013-04-23 13:33:35.000000000 -0400
    -216,11 +216,13
    {
    compiler=$1
    shift

    • lflags=-Wl
    • Because qt is broken, toan

    • #lflags=-Wl
      for flag
      do
      safe_flag=shellEscape "$flag"
    •   lflags=$lflags,$safe_flag
      
    •   lflags=$safe_flag
      
    •   #lflags=$lflags,$safe_flag
      
      done
      compilerSupportsFlag $compiler $lflags >/dev/null 2>&1
      }
      @

    I also added the following config parameters to the linker's flag, but I do not remember where. The added linker's flag was:

    -lstdc++ -lc -lLTO -fPIC -shared

    without libstdc++, it wouldn't link. libLTO was included b/c qt needed to link with "__dso_handle". "-fPIC -shared" because we may link to generate a shared library, for example, libbootstrap.so

    To replicate the issue, compilation was configured and built with the following commands

    ./configure -prefix /opt/qt4 -bindir //opt/qt4/bin -libdir //opt/qt4/lib -system-zlib -system-libmng -system-libpng -system-libjpeg -xrender -xmlpatterns -plugin-sql-mysql -no-gif -no-separate-debug-info -fast -opensource

    eval make $makeopt LD=g++ QMAKE_LINK=g++ -j8

    where makeopt = CC="$CC" CPP="$CPP" CXX="$CXX" prefix="/$prefix" docdir="$docdir"

    I hope to share this to get feedback on why qt-builder was done that way. In addition, i do not want another person has to apply similar patches to compile QT-4.8.4

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      Just update your gcc. 4.8.4 need the newer version of compiler.... Can build QT on my LFS without any problem...

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tpham3783
        wrote on last edited by
        #3

        I found the root of the qt link error, that was described above. The error can also be found on <=qt-5.0.2 (last version i tested).

        If one is building QT 4 or 5 and having an environment variable LD=ld or LD=arm-linux-ld, for example, QT build tool then would revert to using the "ld" linker while still using clfags (at link time), instead of using the proper lflags. I think this is a bug in the build system. To circumvent this bug, be sure to set global environment variable LD=g++

        Or else, apply the patch above.

        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