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. How to change LFLAGS of result Makefile ? (can't find libs with non-standard prefix)
Forum Updated to NodeBB v4.3 + New Features

How to change LFLAGS of result Makefile ? (can't find libs with non-standard prefix)

Scheduled Pinned Locked Moved Solved Installation and Deployment
11 Posts 3 Posters 2.7k 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.
  • R r3d9u11

    Hi. I've got a trouble: compiler can't find needed shared libs, which placed to the non-standard folder. Event LD_LIBRARY_PATH defined and added -L instrunction. By default it looks folder /usr/lib, but needed libs are placed to /usr/lib/arm-linux-gnueabihf.
    Here is my variables:

    export PATH="$SDK_PATH_NATIVE/bin:$PATH"
    
    export PKG_CONFIG_SYSROOT_DIR=/
    export PKG_CONFIG_LIBDIR="$SDK_PATH_TARGET/usr/lib/pkgconfig"
    
    export CFLAGS=" --sysroot=$SDK_PATH_TARGET"
    export CPPFLAGS=$CFLAGS
    export CXXFLAGS=$CPPFLAGS
    export LDFLAGS=" --sysroot=$SDK_PATH_TARGET -L/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf"
    
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf
    

    Qt config:

        -opensource -confirm-license        \
        -developer-build                    \
        -device imx6                        \
        -device-option CROSS_COMPILE="$TOOLCHAIN_PREFIX" \
        -sysroot "$SDK_PATH_TARGET"         \
        -prefix "$QTDIR"                    \
        -nomake tools                       \
        -nomake tests                       \
        -nomake examples                    \
        -no-use-gold-linker                 \
        -recheck                            \
        -verbose                            \
        -L /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf \
        -rpath                              \
        -qt-zlib                            \
        -opengl es2
    

    config.log:

    ...
    > arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs --sysroot=/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs -o opengl_es2 main.o   -L/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf -L//home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf -lGLESv2   
    > /home/imx6/Desktop/TN_UBUNTU_MOD/cache/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libXdamage.so.1, needed by /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/libGAL.so, not found (try using -rpath or -rpath-link)
    > /home/imx6/Desktop/TN_UBUNTU_MOD/cache/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libXfixes.so.3, needed by /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/libGAL.so, not found (try using -rpath or -rpath-link)
    > /home/imx6/Desktop/TN_UBUNTU_MOD/cache/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libXext.so.6, needed by /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/libGAL.so, not found (try using -rpath or -rpath-link)
    > /home/imx6/Desktop/TN_UBUNTU_MOD/cache/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libX11.so.6,
    ...
    

    but, for example, libXdamage.so.1 is exists:

    $ ls //home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf | grep libXdamage
    libXdamage.a
    libXdamage.so
    libXdamage.so.1
    libXdamage.so.1.1.0
    

    What I'm doing wrong?
    Thanks!

    K Offline
    K Offline
    koahnig
    wrote on last edited by
    #2

    @r3d9u11

    AFAIK the -L option cannot be used there.

    Checkout the recommendation in the warning
    @r3d9u11 said in Can't find libs with non-standard prefix:

    rootfs/usr/lib/libGAL.so, not found (try using -rpath or -rpath-link)

    and try using -rpath and -rpath-link (see syntax here ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html )

    Vote the answer(s) that helped you to solve your issue(s)

    R 1 Reply Last reply
    3
    • K koahnig

      @r3d9u11

      AFAIK the -L option cannot be used there.

      Checkout the recommendation in the warning
      @r3d9u11 said in Can't find libs with non-standard prefix:

      rootfs/usr/lib/libGAL.so, not found (try using -rpath or -rpath-link)

      and try using -rpath and -rpath-link (see syntax here ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html )

      R Offline
      R Offline
      r3d9u11
      wrote on last edited by
      #3

      @koahnig Thanks for answer! I removed LD_LIBRARY_PATH and changed LDFLAGS to:

      export LDFLAGS=" --sysroot=$SDK_PATH_TARGET -Wl,-rpath-link,/lib/arm-linux-gnueabihf -Wl,-rpath-link,/usr/lib/arm-linux-gnueabihf"
      

      but Qt doesn't pass this value to gcc:

      > arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs --sysroot=/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs -o opengl_es2 main.o   -lGLESv2 -lEGL -lGAL   
      > /home/imx6/Desktop/TN_UBUNTU_MOD/cache/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: librt.so.1, needed by /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf/libGLESv2.so, not found (try using -rpath or -rpath-link)
      

      where I should to define rpath?

      1 Reply Last reply
      0
      • R r3d9u11

        Hi. I've got a trouble: compiler can't find needed shared libs, which placed to the non-standard folder. Event LD_LIBRARY_PATH defined and added -L instrunction. By default it looks folder /usr/lib, but needed libs are placed to /usr/lib/arm-linux-gnueabihf.
        Here is my variables:

        export PATH="$SDK_PATH_NATIVE/bin:$PATH"
        
        export PKG_CONFIG_SYSROOT_DIR=/
        export PKG_CONFIG_LIBDIR="$SDK_PATH_TARGET/usr/lib/pkgconfig"
        
        export CFLAGS=" --sysroot=$SDK_PATH_TARGET"
        export CPPFLAGS=$CFLAGS
        export CXXFLAGS=$CPPFLAGS
        export LDFLAGS=" --sysroot=$SDK_PATH_TARGET -L/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf"
        
        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf
        

        Qt config:

            -opensource -confirm-license        \
            -developer-build                    \
            -device imx6                        \
            -device-option CROSS_COMPILE="$TOOLCHAIN_PREFIX" \
            -sysroot "$SDK_PATH_TARGET"         \
            -prefix "$QTDIR"                    \
            -nomake tools                       \
            -nomake tests                       \
            -nomake examples                    \
            -no-use-gold-linker                 \
            -recheck                            \
            -verbose                            \
            -L /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf \
            -rpath                              \
            -qt-zlib                            \
            -opengl es2
        

        config.log:

        ...
        > arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs --sysroot=/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs -o opengl_es2 main.o   -L/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf -L//home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf -lGLESv2   
        > /home/imx6/Desktop/TN_UBUNTU_MOD/cache/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libXdamage.so.1, needed by /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/libGAL.so, not found (try using -rpath or -rpath-link)
        > /home/imx6/Desktop/TN_UBUNTU_MOD/cache/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libXfixes.so.3, needed by /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/libGAL.so, not found (try using -rpath or -rpath-link)
        > /home/imx6/Desktop/TN_UBUNTU_MOD/cache/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libXext.so.6, needed by /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/libGAL.so, not found (try using -rpath or -rpath-link)
        > /home/imx6/Desktop/TN_UBUNTU_MOD/cache/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libX11.so.6,
        ...
        

        but, for example, libXdamage.so.1 is exists:

        $ ls //home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf | grep libXdamage
        libXdamage.a
        libXdamage.so
        libXdamage.so.1
        libXdamage.so.1.1.0
        

        What I'm doing wrong?
        Thanks!

        K Offline
        K Offline
        koahnig
        wrote on last edited by
        #4

        Possibly in your congif line:

        @r3d9u11 said in Can't find libs with non-standard prefix:

        Qt config:
        -opensource -confirm-license
        -developer-build
        -device imx6
        -device-option CROSS_COMPILE="$TOOLCHAIN_PREFIX"
        -sysroot "$SDK_PATH_TARGET"
        -prefix "$QTDIR"
        -nomake tools
        -nomake tests
        -nomake examples
        -no-use-gold-linker
        -recheck
        -verbose
        -L /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf
        -rpath
        -qt-zlib
        -opengl es2

        change to

             -opensource -confirm-license        \
             -developer-build                    \
             -device imx6                        \
             -device-option CROSS_COMPILE="$TOOLCHAIN_PREFIX" \
             -sysroot "$SDK_PATH_TARGET"         \
             -prefix "$QTDIR"                    \
             -nomake tools                       \
             -nomake tests                       \
             -nomake examples                    \
             -no-use-gold-linker                 \
             -recheck                            \
             -verbose                            \
             -rpath  /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf \
             -qt-zlib                            \
             -opengl es2
        

        or eventually change -rpath to -rpath-link

        NOTE: I am on really thin ice here, since I am not sure, if it may work at all.

        Vote the answer(s) that helped you to solve your issue(s)

        R 1 Reply Last reply
        1
        • K koahnig

          Possibly in your congif line:

          @r3d9u11 said in Can't find libs with non-standard prefix:

          Qt config:
          -opensource -confirm-license
          -developer-build
          -device imx6
          -device-option CROSS_COMPILE="$TOOLCHAIN_PREFIX"
          -sysroot "$SDK_PATH_TARGET"
          -prefix "$QTDIR"
          -nomake tools
          -nomake tests
          -nomake examples
          -no-use-gold-linker
          -recheck
          -verbose
          -L /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf
          -rpath
          -qt-zlib
          -opengl es2

          change to

               -opensource -confirm-license        \
               -developer-build                    \
               -device imx6                        \
               -device-option CROSS_COMPILE="$TOOLCHAIN_PREFIX" \
               -sysroot "$SDK_PATH_TARGET"         \
               -prefix "$QTDIR"                    \
               -nomake tools                       \
               -nomake tests                       \
               -nomake examples                    \
               -no-use-gold-linker                 \
               -recheck                            \
               -verbose                            \
               -rpath  /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf \
               -qt-zlib                            \
               -opengl es2
          

          or eventually change -rpath to -rpath-link

          NOTE: I am on really thin ice here, since I am not sure, if it may work at all.

          R Offline
          R Offline
          r3d9u11
          wrote on last edited by r3d9u11
          #5

          @koahnig I tried rpath and rpath-link, nothing changes (because Qt doesn't pass LDFLAGS to GCC, as it shows in config.log).
          -rpath as a Qt's parameter doesn't accept any values (it is just a key, and uses for another goals, as I think):

          ...
          o qfilesystemiterator_unix.o qfsfileengine_unix.o qlocale_unix.o  qlibraryinfo.o   -Wl,--gc-sections
          Info: creating cache file /home/imx6/Desktop/TN_UBUNTU_MOD/cache/qtbase/.qmake.cache
          ERROR: Invalid command line parameter '/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf'.
          
          1 Reply Last reply
          0
          • R Offline
            R Offline
            r3d9u11
            wrote on last edited by
            #6

            This is the part of qtbase/config.tests/opengl_es2/Makefile:

            ...
            LFLAGS        = -mfloat-abi=hard --sysroot=/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs --sysroot=/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs
            LIBS          = $(SUBLIBS) /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf/libGLESv2.so /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf/libEGL.so /home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/libGAL.so
            ...
            

            I tried to define variable QMAKE_LFLAGS before configuring:

            export QMAKE_LFLAGS=" -Wl,-rpath,/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf"
            

            but nothing changes, this parameters wasn't added to variable LDFLAGS of Makefile.

            So, how does qmake produce Makefile, which environment variables are involved in that process?

            1 Reply Last reply
            0
            • R Offline
              R Offline
              r3d9u11
              wrote on last edited by r3d9u11
              #7

              Ok, I added two lines to ....../linux-imx6-g++/qmake.conf:

              QMAKE_LFLAGS           += -Wl,-rpath-link,/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/lib/arm-linux-gnueabihf
              QMAKE_LFLAGS           += -Wl,-rpath-link,/home/imx6/Desktop/TN_UBUNTU_MOD/tmpmnt/rootfs/usr/lib/arm-linux-gnueabihf
              

              and it all needed libs were found.

              but the head question is still opened: how can I to define all lib srcs (for example via linker flags) without modifications of the qmake.conf?

              Any ideas? Thanks!

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

                You can use QMAKE_RPATHDIR to change the rpaths used by your application.

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

                R 1 Reply Last reply
                2
                • SGaistS SGaist

                  You can use QMAKE_RPATHDIR to change the rpaths used by your application.

                  R Offline
                  R Offline
                  r3d9u11
                  wrote on last edited by
                  #9

                  @SGaist Where this variable should be defined?

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

                    In your .pro file.

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

                    R 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      In your .pro file.

                      R Offline
                      R Offline
                      r3d9u11
                      wrote on last edited by r3d9u11
                      #11

                      @SGaist I haven't any .pro file, I'm looking for way without any modifications of original ".qmake" file. Unfortunally there is no such way, as I think.

                      Howewer, thanks for hint!
                      Finally I did a workaround in my script:

                      if [ ! -f "qtbase/mkspecs/devices/linux-imx6-g++/imx6-qmake.conf" ]; then
                          mv "qtbase/mkspecs/devices/linux-imx6-g++/qmake.conf" "qtbase/mkspecs/devices/linux-imx6-g++/imx6-qmake.conf"
                          echo "include(./imx6-qmake.conf)" > "qtbase/mkspecs/devices/linux-imx6-g++/qmake.conf"
                          echo "QMAKE_RPATHDIR += $SDK_PATH_TARGET/lib/arm-linux-gnueabihf" >> "qtbase/mkspecs/devices/linux-imx6-g++/qmake.conf"
                          echo "QMAKE_RPATHDIR += $SDK_PATH_TARGET/usr/lib/arm-linux-gnueabihf" >> "qtbase/mkspecs/devices/linux-imx6-g++/qmake.conf"
                      fi
                      

                      or:

                      if [ ! -f "qtbase/mkspecs/devices/linux-imx6-g++/imx6-qmake.conf" ]; then
                          mv "qtbase/mkspecs/devices/linux-imx6-g++/qmake.conf" "qtbase/mkspecs/devices/linux-imx6-g++/imx6-qmake.conf"
                          echo "include(./imx6-qmake.conf)" > "qtbase/mkspecs/devices/linux-imx6-g++/qmake.conf"
                          echo "QMAKE_LFLAGS += -Wl,-rpath-link,$SDK_PATH_TARGET/lib/arm-linux-gnueabihf" >> "qtbase/mkspecs/devices/linux-imx6-g++/qmake.conf"
                          echo "QMAKE_LFLAGS += -Wl,-rpath-link,$SDK_PATH_TARGET/usr/lib/arm-linux-gnueabihf" >> "qtbase/mkspecs/devices/linux-imx6-g++/qmake.conf"
                      fi
                      
                      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