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. QT Creator: build vs qmake
QtWS25 Last Chance

QT Creator: build vs qmake

Scheduled Pinned Locked Moved Solved General and Desktop
creatorqmakebuild
20 Posts 6 Posters 9.7k 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.
  • Y yur70
    15 Apr 2016, 07:59

    @jsulm said:

    As @kshegunov already asked: are you sure you're using the same qmake in QtCreator?
    Where and how do you set ROOTSYS environment variable?
    You can set this variable in QtCreator in project settings under "Build Environment".
    And in the compiler output you can check whether al paths are really passed to the compiler.

    It doesn't matter if qmake is the same or not. With qmake it always works: I can run qmake from the command line, and also use "Run qmake" from qtcreator (by right clicking on the project). So qmake (or "Run qmake") - works, build - doesn't work.

    J Offline
    J Offline
    jsulm
    Lifetime Qt Champion
    wrote on 15 Apr 2016, 08:02 last edited by
    #11

    @yur70 What about my other question regarding ROOTSYS?
    I think, in QtCreator Projects/Build Environment it is not set, so this

    INCLUDEPATH += $(ROOTSYS)/include
    

    expands to /include, so TCanvas.h is not found (I assume it is part of ROOT, right?).
    You can easily check that looking at the compiler output (you can see there which pats are passed to the compiler, look for -I...).

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

    K 1 Reply Last reply 15 Apr 2016, 08:23
    0
    • J JohanSolo
      15 Apr 2016, 07:44

      @kshegunov said:

      What is ROOTSYS and why do you need to use it, is it set correctly?

      ROOT is a very powerfull statistical data analysis framework, initially developped for Particle Physics (ROOT website). The traditional way to use ROOT once compiled is to define the ROOTSYS environment variable and not add the binaries in the path (why, I don't know...).

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 15 Apr 2016, 08:05 last edited by
      #12

      @JohanSolo
      Being a nuclear physicist myself I know what ROOT is, what I didn't know is how it's set up, as I haven't used it. Since ROOTSYS is simply a variable I didn't deduce that it's one defined for/used by CERN's ROOT. Thanks for the explanation though!

      @yur70

      With qmake it always works: I can run qmake from the command line, and also use "Run qmake" from qtcreator (by right clicking on the project). So qmake (or "Run qmake") - works, build - doesn't work.

      qmake is an intermediate step before building. It takes a .pro (project) file and generates an ordinary Makefile from that. What it doesn't do is check the flags you pass to the compiler/linker or paths. That's why the question "Are all paths correct during the build step?" is relevant. So, could you please post the whole build line with all the compiler switches, and not only the error you get?

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0
      • Y yur70
        15 Apr 2016, 07:47

        @KiwiJeff The point is: all paths are correct, it all works with qmake. Why doesn't it work with "build"?

        K Offline
        K Offline
        KiwiJeff
        wrote on 15 Apr 2016, 08:19 last edited by
        #13

        @yur70 Because qmake only does a syntax check and generates a Makefile and Moc files (and probably some other tasks unrelated to your paths). It is the build steps that requires the include paths to be correct. That is why I suggested looking at the compile output and verifying the paths there.

        1 Reply Last reply
        0
        • J jsulm
          15 Apr 2016, 08:02

          @yur70 What about my other question regarding ROOTSYS?
          I think, in QtCreator Projects/Build Environment it is not set, so this

          INCLUDEPATH += $(ROOTSYS)/include
          

          expands to /include, so TCanvas.h is not found (I assume it is part of ROOT, right?).
          You can easily check that looking at the compiler output (you can see there which pats are passed to the compiler, look for -I...).

          K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 15 Apr 2016, 08:23 last edited by kshegunov
          #14

          @jsulm

          I think, in QtCreator Projects/Build Environment it is not set, so this
          INCLUDEPATH += $(ROOTSYS)/include
          expands to /include

          The expansion happens in the Makefile's processing, if such is required when qmake is run the double dollar variable reference is required, i.e.: INCLUDEPATH += $$(ROOTSYS)/include

          (Posting this only for completeness)

          Read and abide by the Qt Code of Conduct

          J 1 Reply Last reply 15 Apr 2016, 08:26
          0
          • K kshegunov
            15 Apr 2016, 08:23

            @jsulm

            I think, in QtCreator Projects/Build Environment it is not set, so this
            INCLUDEPATH += $(ROOTSYS)/include
            expands to /include

            The expansion happens in the Makefile's processing, if such is required when qmake is run the double dollar variable reference is required, i.e.: INCLUDEPATH += $$(ROOTSYS)/include

            (Posting this only for completeness)

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 15 Apr 2016, 08:26 last edited by
            #15

            @kshegunov Wherever the expansion happens if ROOTSYS is not set the resulting path will be invalid.
            We really need the complete build log to check this.

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

            K 1 Reply Last reply 15 Apr 2016, 08:36
            0
            • J jsulm
              15 Apr 2016, 08:26

              @kshegunov Wherever the expansion happens if ROOTSYS is not set the resulting path will be invalid.
              We really need the complete build log to check this.

              K Offline
              K Offline
              kshegunov
              Moderators
              wrote on 15 Apr 2016, 08:36 last edited by
              #16

              @jsulm said:

              Wherever the expansion happens if ROOTSYS is not set the resulting path will be invalid.
              We really need the complete build log to check this.

              I certainly don't argue against that! :)

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              0
              • Y Offline
                Y Offline
                yur70
                wrote on 15 Apr 2016, 09:19 last edited by
                #17

                Thanks for your help, guys. The problem seems to be indeed in the environment variable. I set ROOTSYS in the Projects/Build Environment, now it finds the headers, but I get the following error:

                :-1: warning: libMathCore.so, needed by /cern/root/lib/libHist.so, not found (try using -rpath or -rpath-link)
                

                .. and then a lot of errors with undefined reference.

                Where and how should I insert "-rpath"?

                K J 2 Replies Last reply 15 Apr 2016, 09:24
                0
                • Y yur70
                  15 Apr 2016, 09:19

                  Thanks for your help, guys. The problem seems to be indeed in the environment variable. I set ROOTSYS in the Projects/Build Environment, now it finds the headers, but I get the following error:

                  :-1: warning: libMathCore.so, needed by /cern/root/lib/libHist.so, not found (try using -rpath or -rpath-link)
                  

                  .. and then a lot of errors with undefined reference.

                  Where and how should I insert "-rpath"?

                  K Offline
                  K Offline
                  kshegunov
                  Moderators
                  wrote on 15 Apr 2016, 09:24 last edited by kshegunov
                  #18

                  @yur70

                  Where and how should I insert "-rpath"?

                  For development you shouldn't. Make sure you have the required binary in the linker search path. You need to have libMathCore.so in the $(ROOTSYS)/lib directory. If you need to add additional path for the linker add another -L switch to the LIBS variable in your project file:

                  LIBS += -L/another/path/to/search/for/so/files
                  

                  If you're not building the libHist.so yourself, then provide additional linker paths by appending LD_LIBRARY_PATH (again, this is for development).

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  0
                  • Y yur70
                    15 Apr 2016, 09:19

                    Thanks for your help, guys. The problem seems to be indeed in the environment variable. I set ROOTSYS in the Projects/Build Environment, now it finds the headers, but I get the following error:

                    :-1: warning: libMathCore.so, needed by /cern/root/lib/libHist.so, not found (try using -rpath or -rpath-link)
                    

                    .. and then a lot of errors with undefined reference.

                    Where and how should I insert "-rpath"?

                    J Offline
                    J Offline
                    JohanSolo
                    wrote on 15 Apr 2016, 09:41 last edited by JohanSolo
                    #19

                    @yur70 said:

                    :-1: warning: libMathCore.so, needed by /cern/root/lib/libHist.so, not found (try using -rpath or -rpath-link)
                    

                    The libMathCore.so should be in your /cern/root/lib/ directory as well (it's a ROOT lib as well). You should check your ROOT installation. I guess you compiled it yourself (otherwise no need for ROOTSYS to be defined).

                    `They did not know it was impossible, so they did it.'
                    -- Mark Twain

                    1 Reply Last reply
                    0
                    • Y Offline
                      Y Offline
                      yur70
                      wrote on 15 Apr 2016, 09:59 last edited by
                      #20

                      Finally, I found the reason. I had to add -Wl,-rpath,$(ROOTSYS)/lib to the end of the LIBS definition. So the solution is the following:

                      1. Add ROOTSYS to the Projects/Build Environment
                      2. Add -Wl,-rpath,$(ROOTSYS)/lib to the libs.

                      The .pro file looks like this:

                      TEMPLATE = app
                      
                      win32 {
                         QMAKE_CXXFLAGS += -FIw32pragma.h  
                      }
                      CONFIG += qt warn_on thread
                      
                      INCLUDEPATH += $(ROOTSYS)/include
                      win32:LIBS += -L$(ROOTSYS)/lib -llibCore -llibCint -llibRIO -llibNet \
                              -llibHist -llibGraf -llibGraf3d -llibGpad -llibTree \
                              -llibRint -llibPostscript -llibMatrix -llibPhysics \
                              -llibGui -llibRGL 
                      else:LIBS += -L$(ROOTSYS)/lib -lCore -lCint -lRIO -lNet \
                              -lHist -lGraf -lGraf3d -lGpad -lTree \
                              -lRint -lPostscript -lMatrix -lPhysics \
                              -lGui -lRGL -Wl,-rpath,$(ROOTSYS)/lib
                      
                      HEADERS += canvas.h
                      SOURCES += canvas.cxx main.cxx
                      
                      
                      1 Reply Last reply
                      0

                      20/20

                      15 Apr 2016, 09:59

                      • Login

                      • Login or register to search.
                      20 out of 20
                      • First post
                        20/20
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved