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. QtCreator Docker plugin

QtCreator Docker plugin

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
qtcreator 5.0dockerplugin
10 Posts 5 Posters 3.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.
  • M Offline
    M Offline
    Maaike
    wrote on 18 Nov 2021, 10:50 last edited by
    #1

    I read the changelog of QtCreator 5 and the docker plugin. I am very happy you are working on this!

    However, I can't get it to work.

    I am adding a new device docker image. Then you can click on 'Auto-detect Kit Items', but nothing is detected. I am 100% sure GCC is installed in the container (in /usr/bin/, it is an ubuntu container with some development tools installed), as well as cmake and gdb, but it is not found. Also, when clicking on 'List auto-Detected Kit Items', no items are listed. I can see the docker image is running, so that part works.
    The 'Open Shell in Container' button is also not doing anything.

    So, when going back to 'kits', all compilers are on my host system and no compiler from within the docker container is listed. Same for the debugger.

    So how can I get this to work?

    (I currently have qtcreator installed inside the container and running it from the container with the X output to my host, but I prefer to run qtcreator on my host and just build and debug inside the container).

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Maaike
      wrote on 25 Nov 2021, 16:25 last edited by
      #2

      Unfortunately no one has an idea how to use this plugin?
      I hope there will be a manual soon. I would really like to try it.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        beeka
        wrote on 12 Dec 2021, 23:00 last edited by
        #3

        I've been trying to figure it out as well... no idea why there is a complete lack of hints anywhere. What I have figured out so far:

        • Enable the plugin in Qt Creator
        • Use docker pull to fetch a container image with your desired environment
        • In the qt creator options dialog you can select the "Devices" side bar and "Add..." a "Docker Device" and "Start Wizard" - this will then list the images, one of which can be selected
        • Back on the Devices tab in Options you can insert paths to mount (needed to avoid "The Docker device has not setup shared directories. This will not work for building." when setting up the kit. I think this needs to add the path that the current project needs for building (e.g. /home/bob, if your project is in /home/bob/my-docker-project and a shadow build dir is
          /home/bob/build-my-docker-project-docker-image)
        • Click on the "Auto-detect Kit Items" button, which will run the image and query the tools available and generate a kit like "Docker Image 'user/image' (84749dfde023)". You should check the kit to confirm the settings it found: e.g. to tell it which C and C++ compiler to use.
        • With the kit setup, you can now select the it as a build config in the Projects side bar.

        The announcement says this only works with CMake projects, so I expect CMake to be required in the image. I expect the image also requires a C++ compiler and something like ninja.

        Having said all that, I still can't get it building in the container... build generates an exe but it appears to be built using the host GCC (from greping the "strings" output for "GCC: (") rather than the older one on the image. I tried the "Open Shell in Container" option in the device tab which "docker ps" shows has started an instance but Qt Creator shows "Error starting remote shell" in the "General Messages". Running the executable does seem to use the container, as it complains about "GLIBC_2.34 not found", which isn't there when running it locally.

        I sometimes get error messages like: Local read access to Docker container <long hex number> unavailable through directory "<no value>". Which seems to be a result of the IDE inspecting the container instance it created and looking for the MergedDir in the GraphDriver... this is beyond my simple docker knowledge but google suggests this is an attribute of the overlayfs in docker, whilst "docker info" indicates that my setup is using btrfs, but I've no idea how to switch it to overlay2 (or whatever it is expecting).

        Would be nice if there is some info, even informal (a qtcreator bug / ticket?) as it feels like I am close, but missing some key step / requirement.

        Steve.

        M 1 Reply Last reply 14 Dec 2021, 09:25
        0
        • B beeka
          12 Dec 2021, 23:00

          I've been trying to figure it out as well... no idea why there is a complete lack of hints anywhere. What I have figured out so far:

          • Enable the plugin in Qt Creator
          • Use docker pull to fetch a container image with your desired environment
          • In the qt creator options dialog you can select the "Devices" side bar and "Add..." a "Docker Device" and "Start Wizard" - this will then list the images, one of which can be selected
          • Back on the Devices tab in Options you can insert paths to mount (needed to avoid "The Docker device has not setup shared directories. This will not work for building." when setting up the kit. I think this needs to add the path that the current project needs for building (e.g. /home/bob, if your project is in /home/bob/my-docker-project and a shadow build dir is
            /home/bob/build-my-docker-project-docker-image)
          • Click on the "Auto-detect Kit Items" button, which will run the image and query the tools available and generate a kit like "Docker Image 'user/image' (84749dfde023)". You should check the kit to confirm the settings it found: e.g. to tell it which C and C++ compiler to use.
          • With the kit setup, you can now select the it as a build config in the Projects side bar.

          The announcement says this only works with CMake projects, so I expect CMake to be required in the image. I expect the image also requires a C++ compiler and something like ninja.

          Having said all that, I still can't get it building in the container... build generates an exe but it appears to be built using the host GCC (from greping the "strings" output for "GCC: (") rather than the older one on the image. I tried the "Open Shell in Container" option in the device tab which "docker ps" shows has started an instance but Qt Creator shows "Error starting remote shell" in the "General Messages". Running the executable does seem to use the container, as it complains about "GLIBC_2.34 not found", which isn't there when running it locally.

          I sometimes get error messages like: Local read access to Docker container <long hex number> unavailable through directory "<no value>". Which seems to be a result of the IDE inspecting the container instance it created and looking for the MergedDir in the GraphDriver... this is beyond my simple docker knowledge but google suggests this is an attribute of the overlayfs in docker, whilst "docker info" indicates that my setup is using btrfs, but I've no idea how to switch it to overlay2 (or whatever it is expecting).

          Would be nice if there is some info, even informal (a qtcreator bug / ticket?) as it feels like I am close, but missing some key step / requirement.

          Steve.

          M Offline
          M Offline
          Maaike
          wrote on 14 Dec 2021, 09:25 last edited by
          #4

          @beeka Thank you for your explanation. I am doing the same steps, but when doing 'Auto-detect Kit Items', nothing is detected. I am already building in the container, so it has cmake, gcc and all other build tools that are needed.

          I can indeed see a container is started, but I can not do anything with it. Exactly like you say.

          I already tried the newest version of QtCreator, but that has the same problems.

          B 1 Reply Last reply 14 Dec 2021, 13:40
          0
          • M Maaike
            14 Dec 2021, 09:25

            @beeka Thank you for your explanation. I am doing the same steps, but when doing 'Auto-detect Kit Items', nothing is detected. I am already building in the container, so it has cmake, gcc and all other build tools that are needed.

            I can indeed see a container is started, but I can not do anything with it. Exactly like you say.

            I already tried the newest version of QtCreator, but that has the same problems.

            B Offline
            B Offline
            beeka
            wrote on 14 Dec 2021, 13:40 last edited by
            #5

            @Maaike You can create your own kit, setting the docker device as the build + run target... so the auto-detect is only a nice-to-have (although you would expect it to work). However for me the build doesn't use the container.

            It is frustrating, as this is a feature I have been wanting for a while. As it is, I don't know if I am running into bugs that should be reported or something not yet supported.

            Steve.

            PS: After writing my previous post, I noticed that the CMake output shows it has detected GCC 11, rather than the older version in the container, so I can tell it isn't working without grepping the binary.

            M 1 Reply Last reply 17 Dec 2021, 08:48
            0
            • B beeka
              14 Dec 2021, 13:40

              @Maaike You can create your own kit, setting the docker device as the build + run target... so the auto-detect is only a nice-to-have (although you would expect it to work). However for me the build doesn't use the container.

              It is frustrating, as this is a feature I have been wanting for a while. As it is, I don't know if I am running into bugs that should be reported or something not yet supported.

              Steve.

              PS: After writing my previous post, I noticed that the CMake output shows it has detected GCC 11, rather than the older version in the container, so I can tell it isn't working without grepping the binary.

              M Offline
              M Offline
              Maaike
              wrote on 17 Dec 2021, 08:48 last edited by
              #6

              @beeka But with setting the kit, you have to select a gcc isn't it? I did not find a way yet to point that to the gcc inside the container (same story for cmake).

              1 Reply Last reply
              0
              • E Offline
                E Offline
                enricopapi
                wrote on 22 Jul 2022, 09:22 last edited by
                #7

                thank you for the explanation above.
                After I close QtCreator and re-open it the configured docker kits often disappear even in Docker daemon is running.

                I wonder how docker plugin detects the compilers and the Qt version inside the container? Do you know which commands it runs or the sources?

                thank you

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Maaike
                  wrote on 20 Sept 2022, 13:07 last edited by
                  #8

                  @enricopapi said in QtCreator Docker plugin:

                  After I close QtCreator and re-open it the configured docker kits often disappear even in Docker daemon is running.

                  It is actually working for me.

                  Well at all qtcreator developers working on this: I have to say it finally works with qtcreator 8! I am so happy, thanks a lot for making this work!
                  QtCreator did crash once while detecting all the files, but after restarting, it works like a charm.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    marc_123
                    wrote on 17 Dec 2022, 17:13 last edited by
                    #9

                    can you tell us which image you are using? any dockerfile content to read?

                    1 Reply Last reply
                    0
                    • andrA Offline
                      andrA Offline
                      andr
                      wrote on 22 Dec 2022, 13:59 last edited by
                      #10

                      There are some Docker files in Creator's own repo: https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/tests/manual/docker

                      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