Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Using CMake (was "fake Qt installation")
Forum Updated to NodeBB v4.3 + New Features

Using CMake (was "fake Qt installation")

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
23 Posts 4 Posters 3.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.
  • mzimmersM mzimmers

    OK, I installed a newer version through the maintenance tool. Now I get this error:

    C:\Qt\Tools\CMake_32\share\cmake-3.17\Modules\CMakeTestCCompiler.cmake:60: error: The C compiler "C:/esp32-toolchain/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Users/mzimmers/AppData/Local/Temp/QtCreator-gFJIIs/qtc-cmake-PihZJImV/CMakeFiles/CMakeTmp Run Build Command(s):jom /nologo cmTC_69f0c\fast && jom: parallel job execution disabled for Makefile C:\Qt\Tools\QtCreator\bin\jom.exe  -f CMakeFiles\cmTC_69f0c.dir\build.make /nologo -L CMakeFiles\cmTC_69f0c.dir\build Building C object CMakeFiles/cmTC_69f0c.dir/testCCompiler.c.obj C:\esp32-toolchain\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe    -o CMakeFiles\cmTC_69f0c.dir\testCCompiler.c.obj   -c C:\Users\mzimmers\AppData\Local\Temp\QtCreator-gFJIIs\qtc-cmake-PihZJImV\CMakeFiles\CMakeTmp\testCCompiler.c Linking C executable cmTC_69f0c.exe C:\Qt\Tools\CMake_32\bin\cmake.exe -E rm -f CMakeFiles\cmTC_69f0c.dir/objects.a C:\Qt\Tools\mingw810_32\bin\ar.exe cr CMakeFiles\cmTC_69f0c.dir/objects.a @CMakeFiles\cmTC_69f0c.dir\objects1.rsp C:\esp32-toolchain\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe      -Wl,--whole-archive CMakeFiles\cmTC_69f0c.dir/objects.a -Wl,--no-whole-archive  -o cmTC_69f0c.exe -Wl,--out-implib,libcmTC_69f0c.dll.a -Wl,--major-image-version,0,--minor-image-version,0 c:/esp32-toolchain/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: unrecognized option '--major-image-version' c:/esp32-toolchain/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: use the --help option for usage information collect2.exe: error: ld returned 1 exit status jom: C:\Users\mzimmers\AppData\Local\Temp\QtCreator-gFJIIs\qtc-cmake-PihZJImV\CMakeFiles\CMakeTmp\CMakeFiles\cmTC_69f0c.dir\build.make [cmTC_69f0c.exe] Error 1 jom: C:\Users\mzimmers\AppData\Local\Temp\QtCreator-gFJIIs\qtc-cmake-PihZJImV\CMakeFiles\CMakeTmp\Makefile [cmTC_69f0c\fast] Error 2
    

    I have NO idea what I'm even looking at here. Can you decode this?

    Thanks...

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

    @mzimmers It tells you that xtensa-esp32-elf-gcc.exe compiler can't compile a simple program. Is this the compiler you want to use?

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

    mzimmersM 1 Reply Last reply
    0
    • jsulmJ jsulm

      @mzimmers It tells you that xtensa-esp32-elf-gcc.exe compiler can't compile a simple program. Is this the compiler you want to use?

      mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #7

      @jsulm yes it is; that's in the toolchain for the ESP-IDF.

      jsulmJ 1 Reply Last reply
      0
      • mzimmersM mzimmers

        @jsulm yes it is; that's in the toolchain for the ESP-IDF.

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

        @mzimmers Actually it is not compiler failing, but linker: xtensa-esp32-elf/bin/ld.exe: unrecognized option '--major-image-version'

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

        mzimmersM 1 Reply Last reply
        0
        • jsulmJ jsulm

          @mzimmers Actually it is not compiler failing, but linker: xtensa-esp32-elf/bin/ld.exe: unrecognized option '--major-image-version'

          mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #9

          @jsulm I see. So, whereabouts should I look for that option? I don't see it in any of my Creator options.

          jsulmJ 1 Reply Last reply
          0
          • mzimmersM mzimmers

            @jsulm I see. So, whereabouts should I look for that option? I don't see it in any of my Creator options.

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

            @mzimmers I don't know.
            What is actually the compiler version?

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

            mzimmersM 1 Reply Last reply
            0
            • jsulmJ jsulm

              @mzimmers I don't know.
              What is actually the compiler version?

              mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #11

              @jsulm presumably 8.2.0:
              toolchain.PNG

              1 Reply Last reply
              0
              • mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by
                #12

                I found this which seems to do a pretty good job of describing how to translate a qmake file into a CMake file. But what it doesn't say is how to "tell" Creator that a particular project to use CMake instead of qmake. How do I do that?

                Thanks...

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #13

                  You need to close your (qmake) project and then open your new CMakeLists.txt in Qt Creator.

                  (Z(:^

                  1 Reply Last reply
                  1
                  • mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by
                    #14

                    Thanks, sierdzio. I also resolved the problem with that TARGET_VERSION_MAJOR -- it turns out that it's just a symbol that the ESP32 toolchain expects to have. I just defined them in my CMakeLists.txt file:

                    SET(TARGET_VERSION_MAJOR 0)
                    SET(TARGET_VERSION_MINOR 0)
                    

                    And that eliminated that error.

                    So now, how do I inform CMake that my sources are in a directory main under the root-level directory?

                    1 Reply Last reply
                    0
                    • sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #15

                      https://doc.qt.io/qt-5/cmake-get-started.html

                      You specify the sources in add_executable call (if you are building an executable).

                      (Z(:^

                      mzimmersM 1 Reply Last reply
                      1
                      • sierdzioS sierdzio

                        https://doc.qt.io/qt-5/cmake-get-started.html

                        You specify the sources in add_executable call (if you are building an executable).

                        mzimmersM Offline
                        mzimmersM Offline
                        mzimmers
                        wrote on last edited by
                        #16

                        @sierdzio thank you for the link. I understand that there needs to be an entry for every source file somewhere. The CMakeLists.txt file in the main directory has that already. So, what is the correct entry in the CMakeLists.txt file for the top-level (above main/) to tell the build to look in main for these sources? Surely I don't need a SET_SOURCES to re-list those files? So, what's the second argument to add_executable()?

                        Thank you.

                        sierdzioS 1 Reply Last reply
                        0
                        • mzimmersM mzimmers

                          @sierdzio thank you for the link. I understand that there needs to be an entry for every source file somewhere. The CMakeLists.txt file in the main directory has that already. So, what is the correct entry in the CMakeLists.txt file for the top-level (above main/) to tell the build to look in main for these sources? Surely I don't need a SET_SOURCES to re-list those files? So, what's the second argument to add_executable()?

                          Thank you.

                          sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #17

                          @mzimmers said in Using CMake (was "fake Qt installation"):

                          @sierdzio thank you for the link. I understand that there needs to be an entry for every source file somewhere. The CMakeLists.txt file in the main directory has that already. So, what is the correct entry in the CMakeLists.txt file for the top-level (above main/) to tell the build to look in main for these sources?

                          include or add_subdirectory, depending on your needs.

                          Surely I don't need a SET_SOURCES to re-list those files? So, what's the second argument to add_executable()?

                          First argument is the executable name. All subsequent arguments are files which cmake should consider during build.

                          (Z(:^

                          1 Reply Last reply
                          1
                          • K Offline
                            K Offline
                            kuzulis
                            Qt Champions 2020
                            wrote on last edited by kuzulis
                            #18

                            Try QBS instead of CMake and do not suffer (if no any special requirements). In this case you don't need in this hard manipulations (with CMake you need in a custom toolchain file, in a separate Make or Ninja utilities and so on)...

                            PS: F.e. I use QBS with ESP8266 && non-os-sdk and all fine. :)

                            jsulmJ mzimmersM 2 Replies Last reply
                            0
                            • K kuzulis

                              Try QBS instead of CMake and do not suffer (if no any special requirements). In this case you don't need in this hard manipulations (with CMake you need in a custom toolchain file, in a separate Make or Ninja utilities and so on)...

                              PS: F.e. I use QBS with ESP8266 && non-os-sdk and all fine. :)

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

                              @kuzulis Isn't QBS dying and CMake will be default in Qt6?

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

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                kuzulis
                                Qt Champions 2020
                                wrote on last edited by kuzulis
                                #20

                                QBS is still not dead, it is now being actively developed by the open source community and has a many changes.

                                For QBS, it’s not a problem that CMake is the default Qt build system, it still supports in QtCreator. QBS is not only for Qt, but for everything else, especially for a bare metal programming (especially it is a best choose for a DIY projects, because it support a lot of architectures and toolchains).

                                jsulmJ 1 Reply Last reply
                                2
                                • K kuzulis

                                  QBS is still not dead, it is now being actively developed by the open source community and has a many changes.

                                  For QBS, it’s not a problem that CMake is the default Qt build system, it still supports in QtCreator. QBS is not only for Qt, but for everything else, especially for a bare metal programming (especially it is a best choose for a DIY projects, because it support a lot of architectures and toolchains).

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

                                  @kuzulis OK, didn't know QBS is actively developed

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

                                  1 Reply Last reply
                                  0
                                  • K Offline
                                    K Offline
                                    kuzulis
                                    Qt Champions 2020
                                    wrote on last edited by
                                    #22

                                    @jsulm ,

                                    Surprize:

                                    • https://codereview.qt-project.org/q/project:qbs%252Fqbs+status:merged
                                    • https://codereview.qt-project.org/q/project:qbs%252Fqbs+status:open

                                    :))

                                    1 Reply Last reply
                                    0
                                    • K kuzulis

                                      Try QBS instead of CMake and do not suffer (if no any special requirements). In this case you don't need in this hard manipulations (with CMake you need in a custom toolchain file, in a separate Make or Ninja utilities and so on)...

                                      PS: F.e. I use QBS with ESP8266 && non-os-sdk and all fine. :)

                                      mzimmersM Offline
                                      mzimmersM Offline
                                      mzimmers
                                      wrote on last edited by
                                      #23

                                      @kuzulis thank you for the suggestion. The application I've written makes full use of the ESP IDF, which I believe is exclusively CMake. I don't think converting the entire build system to QBS is the right way to go. I'll continue to plod ahead with the CMake effort, since it appears to be the wave of the future. I do appreciate the suggestion, though.

                                      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