Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. qmake.conf: How to append CFLAGS/LFLAGS to the tail of flags
Forum Updated to NodeBB v4.3 + New Features

qmake.conf: How to append CFLAGS/LFLAGS to the tail of flags

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
9 Posts 3 Posters 4.4k Views 2 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.
  • myobyteM Offline
    myobyteM Offline
    myobyte
    wrote on last edited by
    #1

    In qmake.conf, if I add:
    QMAKE_LFLAGS = -L$(MY_SYSROOT)

    The actual link flags will become: (when building Gui)
    g++ -L{MY_SYSROOT} ... -Wl,-soname,libQt5Gui.so.5 -o ... -L{MY_BUILD_DIR}/lib -lQt5Core ...

    SYSROOT is searched before local build directory, which is definitely problematic.
    (Because if Core changed source or config, Qt5Gui may break build unless Qt5 is uninstalled from sysroot.)

    How to append flags to the tail of flags?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Something's not clear from your description, what are you building currently ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      myobyteM 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Something's not clear from your description, what are you building currently ?

        myobyteM Offline
        myobyteM Offline
        myobyte
        wrote on last edited by
        #3

        @SGaist
        Sorry for the slow reply.
        I am building whole qt5 for an embedded linux.
        In qmake.conf, I used QMAKE_LFLAGS to add SYSROOT to link flags.

        The problem is that in generated makefiles' link flags, SYSROOT is searched before local build directory.
        (IOW QMAKE_LFLAGS is injected before other lflags, which is problematic)
        This link order is obviously wrong, and rebuild often breaks due to it.

        Unstalling qt5 from SYSROOT at rebuild is unacceptable, because in our project build system, it is not allowed to touch SYSROOT at build/clean stage.

        1 Reply Last reply
        0
        • Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #4

          @myobyte said:

          QMAKE_LFLAGS = -L$(MY_SYSROOT)

          I guess the key to your problem is using += instead of just = so the new value is APPENDED to the existing value of the variable

          VARIABLE += VALUE_TO_APPEND
          

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            You can pass the sysroot option to configure, doesn't that work for you ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            myobyteM 1 Reply Last reply
            0
            • SGaistS SGaist

              You can pass the sysroot option to configure, doesn't that work for you ?

              myobyteM Offline
              myobyteM Offline
              myobyte
              wrote on last edited by
              #6

              @SGaist
              Thanks, it worked.
              However, a similar problem is still there: how to append a "BuildRoot" aka "TargetFsRoot" to include/link search path, for various non-toolchain libraries?

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Do you mean something like configure -I /path/to/my/includes ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                myobyteM 1 Reply Last reply
                0
                • SGaistS SGaist

                  Do you mean something like configure -I /path/to/my/includes ?

                  myobyteM Offline
                  myobyteM Offline
                  myobyte
                  wrote on last edited by myobyte
                  #8

                  @SGaist
                  If I add -I -L -R to configure, host tools build fails because it is also affected:

                  g++ -Wl,-O1 -Wl,-rpath,arm/target/rootfs/usr/lib -Wl,-rpath,arm/target/rootfs/usr/lib -o ../../../bin/qdoc .obj/... 
                  -Larm/target/rootfs/usr/lib -Lsrc/qtbase/build/lib -lQt5Bootstrap -lpthread
                  

                  Also it looks bad:
                  L_FLAGS appears before -Lsrc/qtbase/build/lib -lQt5Bootstrap -lpthread

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Since you can not modify the sysroot. Why not just use another one when building Qt and put the final result in the original after that ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    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