Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Very long project build times after including QCustomPlot
Forum Updated to NodeBB v4.3 + New Features

Very long project build times after including QCustomPlot

Scheduled Pinned Locked Moved Unsolved General and Desktop
21 Posts 4 Posters 2.8k 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.
  • L lukutis222

    @jsulm

    That is exactly what I am confused about. I do not understand why is there 2 .pro files and which one do I need to use?

    I only use 1 .pro file for my project.

    L Offline
    L Offline
    lukutis222
    wrote on last edited by lukutis222
    #10

    @jsulm

    I think I am making some progress.

    • 1. I put qcustomplot.cpp and qcustomplot.h to sharedlib folder:

    7c86c1d3-25da-4b5d-b798-ea285362b1a5-image.png

    Inside qcustomplot-sharedlib there is sharedlib-compilation and sharedlib-usage

    738cb2c7-b8c9-4f90-88d9-21c914953090-image.png

    • 2. I have opened sharedlib-compliation.pro as qt project and build it for all configurations. The project built successfully. 3 folders were created inside qcustomplot-sharedlib:

    build-sharedlib-compilation-Desktop_Qt_6_4_0_MinGW_64_bit-Debug
    build-sharedlib-compilation-Desktop_Qt_6_4_0_MinGW_64_bit-Release
    build-sharedlib-compilation-Desktop_Qt_6_4_0_MinGW_64_bit-Profile

    d35b1877-ccf9-475b-832a-0428ea6a97a3-image.png

    • 3. The following step on the instruction says:
      Copy all created library/softlink files from the previous step to the sharedlib-usage directory

    Does that mean that I have to copy all those files and put them in sharedlib-usage directory?

    • 4. After copying all those files and pasting them in sharedlib-usage directory, I try to build sharedlib-usage example

    3f43bab8-e4eb-4331-86c0-3517975e2832-image.png

    but I get the following errors:

    Qt/6.4.0/mingw_64/lib/libQt6Gui.a C:/Qt/6.4.0/mingw_64/lib/libQt6Core.a -lmingw32 C:/Qt/6.4.0/mingw_64/lib/libQt6EntryPoint.a -lshell32  
    C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqcustomplotd2
    collect2.exe: error: ld returned 1 exit status
    mingw32-make[1]: *** [Makefile.Debug:68: debug/sharedlib-usage.exe] Error 1
    mingw32-make[1]: Leaving directory 'C:/Users/petrikas.lu/Desktop/WORK/QT/QCustomPlot-sharedlib/qcustomplot-sharedlib/build-sharedlib-usage-Desktop_Qt_6_4_0_MinGW_64_bit-Debug'
    mingw32-make: *** [Makefile:45: debug] Error 2
    14:45:40: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project sharedlib-usage (kit: Desktop Qt 6.4.0 MinGW 64-bit)
    When executing step "Make"
    14:45:40: Elapsed time: 00:07.
    

    The error message says that it cannot find lqcustomplotd2.

    jsulmJ 1 Reply Last reply
    0
    • L lukutis222

      @jsulm

      I think I am making some progress.

      • 1. I put qcustomplot.cpp and qcustomplot.h to sharedlib folder:

      7c86c1d3-25da-4b5d-b798-ea285362b1a5-image.png

      Inside qcustomplot-sharedlib there is sharedlib-compilation and sharedlib-usage

      738cb2c7-b8c9-4f90-88d9-21c914953090-image.png

      • 2. I have opened sharedlib-compliation.pro as qt project and build it for all configurations. The project built successfully. 3 folders were created inside qcustomplot-sharedlib:

      build-sharedlib-compilation-Desktop_Qt_6_4_0_MinGW_64_bit-Debug
      build-sharedlib-compilation-Desktop_Qt_6_4_0_MinGW_64_bit-Release
      build-sharedlib-compilation-Desktop_Qt_6_4_0_MinGW_64_bit-Profile

      d35b1877-ccf9-475b-832a-0428ea6a97a3-image.png

      • 3. The following step on the instruction says:
        Copy all created library/softlink files from the previous step to the sharedlib-usage directory

      Does that mean that I have to copy all those files and put them in sharedlib-usage directory?

      • 4. After copying all those files and pasting them in sharedlib-usage directory, I try to build sharedlib-usage example

      3f43bab8-e4eb-4331-86c0-3517975e2832-image.png

      but I get the following errors:

      Qt/6.4.0/mingw_64/lib/libQt6Gui.a C:/Qt/6.4.0/mingw_64/lib/libQt6Core.a -lmingw32 C:/Qt/6.4.0/mingw_64/lib/libQt6EntryPoint.a -lshell32  
      C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqcustomplotd2
      collect2.exe: error: ld returned 1 exit status
      mingw32-make[1]: *** [Makefile.Debug:68: debug/sharedlib-usage.exe] Error 1
      mingw32-make[1]: Leaving directory 'C:/Users/petrikas.lu/Desktop/WORK/QT/QCustomPlot-sharedlib/qcustomplot-sharedlib/build-sharedlib-usage-Desktop_Qt_6_4_0_MinGW_64_bit-Debug'
      mingw32-make: *** [Makefile:45: debug] Error 2
      14:45:40: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2.
      Error while building/deploying project sharedlib-usage (kit: Desktop Qt 6.4.0 MinGW 64-bit)
      When executing step "Make"
      14:45:40: Elapsed time: 00:07.
      

      The error message says that it cannot find lqcustomplotd2.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #11

      @lukutis222 said in Very long project build times after including QCustomPlot:

      The error message says that it cannot find lqcustomplotd2.

      Yes, and where exactly is it located?
      You need to specify the location in the example pro file (you can post its content here if you need support).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      L 1 Reply Last reply
      1
      • jsulmJ jsulm

        @lukutis222 said in Very long project build times after including QCustomPlot:

        The error message says that it cannot find lqcustomplotd2.

        Yes, and where exactly is it located?
        You need to specify the location in the example pro file (you can post its content here if you need support).

        L Offline
        L Offline
        lukutis222
        wrote on last edited by lukutis222
        #12

        @jsulm

        I do not know where it is located. It feels like that this file does not exist in my computer. I use software called "everything" to find files. It works much better than windows search.

        faa4f287-94f1-485f-b446-e88abf60f9f9-image.png

        Also, when you say "in the example pro" file. Are you refering to sharelib-usage.pro? Because I am trying to build sharelib-usage.pro and it is as following:

        #
        # Example project that uses QCustomPlot as a shared library
        #
        # The compiled shared library file(s) must be in the project directory.
        # On Unix, set LD_LIBRARY_PATH to "." before launching the compiled application
        # unless the library files are installed in one of the library locations (e.g. /usr/lib)
        #
        # Note that the qcustomplot.h header should not be added to the project file in the
        # HEADERS variable, but only included in your source files with #include.
        #
        
        QT       += core gui
        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
        
        greaterThan(QT_MAJOR_VERSION, 4): CONFIG += c++11
        lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++11
        
        TARGET = sharedlib-usage
        TEMPLATE = app
        
        # Tell the qcustomplot header that it will be used as library:
        DEFINES += QCUSTOMPLOT_USE_LIBRARY
        
        # Link with debug version of qcustomplot if compiling in debug mode, else with release library:
        CONFIG(debug, release|debug) {
          win32:QCPLIB = qcustomplotd2
          else: QCPLIB = qcustomplotd
        } else {
          win32:QCPLIB = qcustomplot2
          else: QCPLIB = qcustomplot
        }
        LIBS += -L./ -l$$QCPLIB
        
        SOURCES += main.cpp
        
        
        jsulmJ 1 Reply Last reply
        0
        • L lukutis222

          @jsulm

          I do not know where it is located. It feels like that this file does not exist in my computer. I use software called "everything" to find files. It works much better than windows search.

          faa4f287-94f1-485f-b446-e88abf60f9f9-image.png

          Also, when you say "in the example pro" file. Are you refering to sharelib-usage.pro? Because I am trying to build sharelib-usage.pro and it is as following:

          #
          # Example project that uses QCustomPlot as a shared library
          #
          # The compiled shared library file(s) must be in the project directory.
          # On Unix, set LD_LIBRARY_PATH to "." before launching the compiled application
          # unless the library files are installed in one of the library locations (e.g. /usr/lib)
          #
          # Note that the qcustomplot.h header should not be added to the project file in the
          # HEADERS variable, but only included in your source files with #include.
          #
          
          QT       += core gui
          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
          
          greaterThan(QT_MAJOR_VERSION, 4): CONFIG += c++11
          lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++11
          
          TARGET = sharedlib-usage
          TEMPLATE = app
          
          # Tell the qcustomplot header that it will be used as library:
          DEFINES += QCUSTOMPLOT_USE_LIBRARY
          
          # Link with debug version of qcustomplot if compiling in debug mode, else with release library:
          CONFIG(debug, release|debug) {
            win32:QCPLIB = qcustomplotd2
            else: QCPLIB = qcustomplotd
          } else {
            win32:QCPLIB = qcustomplot2
            else: QCPLIB = qcustomplot
          }
          LIBS += -L./ -l$$QCPLIB
          
          SOURCES += main.cpp
          
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #13

          @lukutis222 said in Very long project build times after including QCustomPlot:

          I do not know where it is located

          It should be located in the build folders you posted before.
          And the names of libraries on Linux/UNIX systems start with lib not l. So, libqcustomplot*

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          L 1 Reply Last reply
          0
          • jsulmJ jsulm

            @lukutis222 said in Very long project build times after including QCustomPlot:

            I do not know where it is located

            It should be located in the build folders you posted before.
            And the names of libraries on Linux/UNIX systems start with lib not l. So, libqcustomplot*

            L Offline
            L Offline
            lukutis222
            wrote on last edited by lukutis222
            #14

            @jsulm

            Thanks for helping me.

            • 1. Since I am on windows, why does it say that Iqcustomplotd2 is missing instead of libqcustomplot2d?

            • 2. In the build folders that I have posted before inside debug or release folder (I am not sure if there is any difference), I see the following files:

            16ad37fe-be8a-41f3-857c-861db71b148e-image.png

            • 3. I have placed all those build files inside sharedlib-usage folder:
              90621dc9-a312-4385-abc6-38a347e9eefa-image.png

            I assume that everything should be ok here right? I just need to tell my project to look for libqcustomplot instead of iqcustomplot? (After placing those files, the same error persists)

            jsulmJ 1 Reply Last reply
            0
            • L lukutis222

              @jsulm

              Thanks for helping me.

              • 1. Since I am on windows, why does it say that Iqcustomplotd2 is missing instead of libqcustomplot2d?

              • 2. In the build folders that I have posted before inside debug or release folder (I am not sure if there is any difference), I see the following files:

              16ad37fe-be8a-41f3-857c-861db71b148e-image.png

              • 3. I have placed all those build files inside sharedlib-usage folder:
                90621dc9-a312-4385-abc6-38a347e9eefa-image.png

              I assume that everything should be ok here right? I just need to tell my project to look for libqcustomplot instead of iqcustomplot? (After placing those files, the same error persists)

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #15

              @lukutis222 said in Very long project build times after including QCustomPlot:

              Since I am on windows, why does it say that Iqcustomplotd2 is missing instead of libqcustomplot2d?

              It says it can't find -lqcustomplotd2. -l parameter is used to tell the linker to link the lib following -l, so qcustomplotd2 in your case.
              You are using relative path to specify the folder to search for libs (-L./). Please check whether the folder passed to linker is correct (you can post the whole linker call here, above you only posted part of it).

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              L 1 Reply Last reply
              1
              • jsulmJ jsulm

                @lukutis222 said in Very long project build times after including QCustomPlot:

                Since I am on windows, why does it say that Iqcustomplotd2 is missing instead of libqcustomplot2d?

                It says it can't find -lqcustomplotd2. -l parameter is used to tell the linker to link the lib following -l, so qcustomplotd2 in your case.
                You are using relative path to specify the folder to search for libs (-L./). Please check whether the folder passed to linker is correct (you can post the whole linker call here, above you only posted part of it).

                L Offline
                L Offline
                lukutis222
                wrote on last edited by
                #16

                @jsulm

                I still didint manage to find a solution for this..

                I assume you want to see Compile Output:

                09:51:38: Running steps for project sharedlib-usage...
                09:51:38: Configuration unchanged, skipping qmake step.
                09:51:38: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j16
                C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
                mingw32-make[1]: Entering directory 'C:/Users/petrikas.lu/Desktop/WORK/QT/QCustomPlot-sharedlib/qcustomplot-sharedlib/build-sharedlib-usage-Desktop_Qt_6_4_0_MinGW_64_bit-Debug'
                g++ -Wl,-subsystem,windows -mthreads -o debug/sharedlib-usage.exe debug/main.o -L. -lqcustomplotd2 C:/Qt/6.4.0/mingw_64/lib/libQt6PrintSupport.a C:/Qt/6.4.0/mingw_64/lib/libQt6Widgets.a C:/Qt/6.4.0/mingw_64/lib/libQt6Gui.a C:/Qt/6.4.0/mingw_64/lib/libQt6Core.a -lmingw32 C:/Qt/6.4.0/mingw_64/lib/libQt6EntryPoint.a -lshell32  
                C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqcustomplotd2
                collect2.exe: error: ld returned 1 exit status
                mingw32-make[1]: *** [Makefile.Debug:68: debug/sharedlib-usage.exe] Error 1
                mingw32-make[1]: Leaving directory 'C:/Users/petrikas.lu/Desktop/WORK/QT/QCustomPlot-sharedlib/qcustomplot-sharedlib/build-sharedlib-usage-Desktop_Qt_6_4_0_MinGW_64_bit-Debug'
                mingw32-make: *** [Makefile:45: debug] Error 2
                09:51:38: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2.
                Error while building/deploying project sharedlib-usage (kit: Desktop Qt 6.4.0 MinGW 64-bit)
                When executing step "Make"
                09:51:38: Elapsed time: 00:00.
                
                
                jsulmJ JonBJ 2 Replies Last reply
                0
                • L lukutis222

                  @jsulm

                  I still didint manage to find a solution for this..

                  I assume you want to see Compile Output:

                  09:51:38: Running steps for project sharedlib-usage...
                  09:51:38: Configuration unchanged, skipping qmake step.
                  09:51:38: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j16
                  C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
                  mingw32-make[1]: Entering directory 'C:/Users/petrikas.lu/Desktop/WORK/QT/QCustomPlot-sharedlib/qcustomplot-sharedlib/build-sharedlib-usage-Desktop_Qt_6_4_0_MinGW_64_bit-Debug'
                  g++ -Wl,-subsystem,windows -mthreads -o debug/sharedlib-usage.exe debug/main.o -L. -lqcustomplotd2 C:/Qt/6.4.0/mingw_64/lib/libQt6PrintSupport.a C:/Qt/6.4.0/mingw_64/lib/libQt6Widgets.a C:/Qt/6.4.0/mingw_64/lib/libQt6Gui.a C:/Qt/6.4.0/mingw_64/lib/libQt6Core.a -lmingw32 C:/Qt/6.4.0/mingw_64/lib/libQt6EntryPoint.a -lshell32  
                  C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqcustomplotd2
                  collect2.exe: error: ld returned 1 exit status
                  mingw32-make[1]: *** [Makefile.Debug:68: debug/sharedlib-usage.exe] Error 1
                  mingw32-make[1]: Leaving directory 'C:/Users/petrikas.lu/Desktop/WORK/QT/QCustomPlot-sharedlib/qcustomplot-sharedlib/build-sharedlib-usage-Desktop_Qt_6_4_0_MinGW_64_bit-Debug'
                  mingw32-make: *** [Makefile:45: debug] Error 2
                  09:51:38: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2.
                  Error while building/deploying project sharedlib-usage (kit: Desktop Qt 6.4.0 MinGW 64-bit)
                  When executing step "Make"
                  09:51:38: Elapsed time: 00:00.
                  
                  
                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #17

                  @lukutis222 said in Very long project build times after including QCustomPlot:

                  -L. -lqcustomplotd2

                  This is your problem: you put the lib into your project folder but tell linker to search in current folder which is build folder when your app is being built.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  2
                  • L lukutis222

                    @jsulm

                    I still didint manage to find a solution for this..

                    I assume you want to see Compile Output:

                    09:51:38: Running steps for project sharedlib-usage...
                    09:51:38: Configuration unchanged, skipping qmake step.
                    09:51:38: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j16
                    C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
                    mingw32-make[1]: Entering directory 'C:/Users/petrikas.lu/Desktop/WORK/QT/QCustomPlot-sharedlib/qcustomplot-sharedlib/build-sharedlib-usage-Desktop_Qt_6_4_0_MinGW_64_bit-Debug'
                    g++ -Wl,-subsystem,windows -mthreads -o debug/sharedlib-usage.exe debug/main.o -L. -lqcustomplotd2 C:/Qt/6.4.0/mingw_64/lib/libQt6PrintSupport.a C:/Qt/6.4.0/mingw_64/lib/libQt6Widgets.a C:/Qt/6.4.0/mingw_64/lib/libQt6Gui.a C:/Qt/6.4.0/mingw_64/lib/libQt6Core.a -lmingw32 C:/Qt/6.4.0/mingw_64/lib/libQt6EntryPoint.a -lshell32  
                    C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqcustomplotd2
                    collect2.exe: error: ld returned 1 exit status
                    mingw32-make[1]: *** [Makefile.Debug:68: debug/sharedlib-usage.exe] Error 1
                    mingw32-make[1]: Leaving directory 'C:/Users/petrikas.lu/Desktop/WORK/QT/QCustomPlot-sharedlib/qcustomplot-sharedlib/build-sharedlib-usage-Desktop_Qt_6_4_0_MinGW_64_bit-Debug'
                    mingw32-make: *** [Makefile:45: debug] Error 2
                    09:51:38: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2.
                    Error while building/deploying project sharedlib-usage (kit: Desktop Qt 6.4.0 MinGW 64-bit)
                    When executing step "Make"
                    09:51:38: Elapsed time: 00:00.
                    
                    
                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #18

                    @lukutis222
                    For -lqcustomplotd2 to work:

                    1. You should have a file named libqcustomplotd2.a somewhere. I can see two of them in your screenshots? One in ...\build-...-Debug\debug and one copied to sharedlib-usage, right?

                    2. The linker must be able to find that directory via a -Ldirectory-path argument. You seem to have -L.. I do not know what the directory referred to via . ("current directory") is. I suspect it's not right.

                    I see @jsulm has just commented on this. Either move the file to the build folder or change the -L. to refer to the right directory. I am confused by the paths you show in your screenshots. I would try

                    -L..
                    

                    first for your case. However, I don't actually think that is right for you. If that does not work try

                    -L../sharedlib-usage
                    

                    which I think is what you are actually showing you need?

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      lukutis222
                      wrote on last edited by
                      #19

                      @jsulm
                      @JonB

                      Thanks for help.

                      I was following the instructions that came with the library. It says:

                        - Copy all created library/softlink files from the previous step to the sharedlib-usage directory
                      

                      but it does not seem to make any sense.

                      Copying all files to build folder seems to work fine but does not make any sense. If I clean the project the files will be deleted and I will have to manually copy them to build folder again.

                      I dont fully understand what was the library owner reasoning for using:

                      #LIBS += -L./ -l$$QCPLIB
                      
                      JonBJ 1 Reply Last reply
                      0
                      • L lukutis222

                        @jsulm
                        @JonB

                        Thanks for help.

                        I was following the instructions that came with the library. It says:

                          - Copy all created library/softlink files from the previous step to the sharedlib-usage directory
                        

                        but it does not seem to make any sense.

                        Copying all files to build folder seems to work fine but does not make any sense. If I clean the project the files will be deleted and I will have to manually copy them to build folder again.

                        I dont fully understand what was the library owner reasoning for using:

                        #LIBS += -L./ -l$$QCPLIB
                        
                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #20

                        @lukutis222 I wrote in my previous what I suggest you do.

                        L 1 Reply Last reply
                        0
                        • JonBJ JonB

                          @lukutis222 I wrote in my previous what I suggest you do.

                          L Offline
                          L Offline
                          lukutis222
                          wrote on last edited by
                          #21
                          This post is deleted!
                          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