# Errors building QGC with docker

**URL:** <https://discuss.px4.io/t/errors-building-qgc-with-docker/25460>\
**Category:** Development\
**Created:** [December 15, 2021, 2:08pm UTC](https://discuss.px4.io/t/errors-building-qgc-with-docker/25460 "2021-12-15T14:08:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romain\_Chiappinelli](https://discuss.px4.io/user_avatar/discuss.px4.io/romain_chiappinelli/32/6089_2.png) [@Romain\_Chiappinelli](https://discuss.px4.io/u/Romain_Chiappinelli)\
**Post date:** [December 15, 2021, 2:08pm UTC](https://discuss.px4.io/t/errors-building-qgc-with-docker/25460/1 "2021-12-15T14:08:19Z")

</div>

Hi everyone,

I’m very new to QGC and docker. I’m on MacOS 10.15 Catalina and I have a fresh Ubuntu 20.04 running on [Parallels](https://www.parallels.com/eu/pd/general/?gclid=Cj0KCQiAweaNBhDEARIsAJ5hwbfD_jz0YKlYu34YxUREUC2SumPWjHM4Jq_c95QiA5vjyJ-JWjXwySMaAuomEALw_wcB) virtual machine.

It seems easier to compile QGC on Ubuntu 20.04 using docker [container](https://dev.qgroundcontrol.com/master/en/getting_started/container.html), so I chose this route. I’m able to build the container and then build QGC successfully (with sudo) following QGC build documentation.

I tried to run it with `./build/staging/qgroundcontrol-start.sh` and I get libSDL2 no such file or directory

`./build/staging/QGroundControl: error while loading shared libraries: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory`

Any idea?  
Thanks

---

<div class="post-metadata">

**Author:** ![Romain\_Chiappinelli](https://discuss.px4.io/user_avatar/discuss.px4.io/romain_chiappinelli/32/6089_2.png) [@Romain\_Chiappinelli](https://discuss.px4.io/u/Romain_Chiappinelli)\
**Post date:** [December 15, 2021, 2:26pm UTC](https://discuss.px4.io/t/errors-building-qgc-with-docker/25460/2 "2021-12-15T14:26:17Z")

</div>

So, I installed `sudo aptitude install libsdl2-2.0-0` (aptitude is like apt-get, a bit smarter I find)

Now, I get another error

```auto
./build/staging/qgroundcontrol-start.sh 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Aborted (core dumped)

```

---

<div class="post-metadata">

**Author:** ![Romain\_Chiappinelli](https://discuss.px4.io/user_avatar/discuss.px4.io/romain_chiappinelli/32/6089_2.png) [@Romain\_Chiappinelli](https://discuss.px4.io/u/Romain_Chiappinelli)\
**Post date:** [December 15, 2021, 2:43pm UTC](https://discuss.px4.io/t/errors-building-qgc-with-docker/25460/3 "2021-12-15T14:43:34Z")

</div>

So here is the solution from this post  
`export QT_DEBUG_PLUGINS=1` to see what’s happening

Then running QGC the terminal gave me many info, and the relevant was

```auto
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/romain/qgroundcontrol/build/staging/platforms" ...
Cannot load library /home/romain/qgroundcontrol/build/staging/Qt/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/romain/qgroundcontrol/build/staging/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /home/romain/qgroundcontrol/build/staging/Qt/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)"

```

So I installed `sudo aptitude install libxcb-xinerama0` and then rerun and it worked!

---

<div class="post-metadata">

**Author:** ![umexsa](https://discuss.px4.io/user_avatar/discuss.px4.io/umexsa/32/14233_2.png) [@umexsa](https://discuss.px4.io/u/umexsa)\
**Post date:** [October 19, 2022, 11:34pm UTC](https://discuss.px4.io/t/errors-building-qgc-with-docker/25460/4 "2022-10-19T23:34:41Z")

</div>

Adding a new issue to this thread… to keep them together. I am trying to build the latest QGC baseline in a docker container and get the following compile errors.

> ./usr/lib/x86\_64-linux-gnu/libairmap-cpp.so.2.0.0  
> compiling /project/source/src/QtLocationPlugin/QGeoCodeReplyQGC.cpp  
> In file included from /project/source/libs/libevents/libevents/libs/cpp/parse/health\_and\_arming\_checks.h:8,  
> from /project/source/src/Vehicle/HealthAndArmingCheckReport.h:15,  
> from /project/source/src/Vehicle/Vehicle.h:49,  
> from /project/source/src/Joystick/Joystick.h:20,  
> from /project/source/src/Settings/SettingsGroup.h:14,  
> from /project/source/src/Settings/AppSettings.h:16,  
> from /project/source/src/QtLocationPlugin/QGCMapUrlEngine.cpp:22:  
> /project/source/libs/libevents/libevents/libs/cpp/parse/parser.h:13:10: fatal error: nlohmann\_json/include/nlohmann/json\_fwd.hpp: No such file or directory  
> 13 | #include “nlohmann\_json/include/nlohmann/json\_fwd.hpp”  
> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
> compilation terminated.  
> make: \*\*\* [Makefile:136365: QGCMapUrlEngine.o] Error 1  
> make: \*\*\* Waiting for unfinished jobs…  
> In file included from /project/source/libs/libevents/libevents/libs/cpp/parse/health\_and\_arming\_checks.h:8,  
> from /project/source/src/Vehicle/HealthAndArmingCheckReport.h:15,  
> from /project/source/src/Vehicle/Vehicle.h:49,  
> from /project/source/src/Joystick/Joystick.h:20,  
> from /project/source/src/Settings/SettingsGroup.h:14,  
> from /project/source/src/Settings/FlightMapSettings.h:12,  
> from /project/source/src/QGCApplication.h:26,  
> from /project/source/src/QtLocationPlugin/QGCMapEngine.cpp:18:  
> /project/source/libs/libevents/libevents/libs/cpp/parse/parser.h:13:10: fatal error: nlohmann\_json/include/nlohmann/json\_fwd.hpp: No such file or directory  
> 13 | #include “nlohmann\_json/include/nlohmann/json\_fwd.hpp”  
> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
> compilation terminated.  
> make: \*\*\* [Makefile:135381: QGCMapEngine.o] Error 1

I looked at the docker build script and noticed that the nlohmann-json3-dev was not included. I added it to the apt install part of the build script and rebuilt the image but I still get the same compile error. Not sure how to proceed at this point. Any help would be most appreciated.

---

<div class="post-metadata">

**Author:** ![codart](https://discuss.px4.io/letter_avatar_proxy/v4/letter/c/779978/32.png) [@codart](https://discuss.px4.io/u/codart)\
**Post date:** [November 7, 2022, 12:57pm UTC](https://discuss.px4.io/t/errors-building-qgc-with-docker/25460/5 "2022-11-07T12:57:20Z")

</div>

Hi @umexsa, did you find a solution to this? I am also having the same issue

---

<div class="post-metadata">

**Author:** ![umexsa](https://discuss.px4.io/user_avatar/discuss.px4.io/umexsa/32/14233_2.png) [@umexsa](https://discuss.px4.io/u/umexsa)\
**Post date:** [November 8, 2022, 7:27pm UTC](https://discuss.px4.io/t/errors-building-qgc-with-docker/25460/6 "2022-11-08T19:27:25Z")

</div>

Hi @codart, no solution as of yet. I was hoping that either somebody would push a new baseline or offer a suggestion. I tried to add the install the nlohmann library to the container build script, but no joy. I also tried to build from an older baseline, but got other errors during the link phase. I am going to try it again on another machine (native ubuntu) rather than VM and see if that works any better.

---

<div class="post-metadata">

**Author:** ![umexsa](https://discuss.px4.io/user_avatar/discuss.px4.io/umexsa/32/14233_2.png) [@umexsa](https://discuss.px4.io/u/umexsa)\
**Post date:** [November 23, 2022, 1:10am UTC](https://discuss.px4.io/t/errors-building-qgc-with-docker/25460/7 "2022-11-23T01:10:41Z")

</div>

Hi @codart, just checking to see if you made any progress. I am able to build the lasted (main) branch of QGC in docker on x86 Linux. I have an x86 machine running Ubuntu 20.04 and the QGC build works great in the Docker container using the following build/run commands:

```auto
docker build --file ./deploy/docker/Dockerfile-build-linux -t qgc-linux-docker .
docker run -rm -v ${PWD}:/project/source -v ${PWD}/build:/project/build qgc-linux-docker

```

The problem I am having is that it won’t build on Mac M1 and I still get the following errors:

```auto
./usr/lib/x86_64-linux-gnu/libairmap-cpp.so.2.0.1
compiling /project/source/src/QtLocationPlugin/QGeoCodeReplyQGC.cpp
In file included from /project/source/libs/libevents/libevents/libs/cpp/parse/health_and_arming_checks.h:8,
                 from /project/source/src/Vehicle/HealthAndArmingCheckReport.h:15,
                 from /project/source/src/Vehicle/Vehicle.h:49,
                 from /project/source/src/Joystick/Joystick.h:20,
                 from /project/source/src/Settings/SettingsGroup.h:14,
                 from /project/source/src/Settings/AppSettings.h:16,
                 from /project/source/src/QtLocationPlugin/QGCMapUrlEngine.cpp:22:
/project/source/libs/libevents/libevents/libs/cpp/parse/parser.h:13:10: fatal error: nlohmann_json/include/nlohmann/json_fwd.hpp: No such file or directory
   13 | #include "nlohmann_json/include/nlohmann/json_fwd.hpp"
      | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:136368: QGCMapUrlEngine.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from /project/source/libs/libevents/libevents/libs/cpp/parse/health_and_arming_checks.h:8,
                 from /project/source/src/Vehicle/HealthAndArmingCheckReport.h:15,
                 from /project/source/src/Vehicle/Vehicle.h:49,
                 from /project/source/src/Joystick/Joystick.h:20,
                 from /project/source/src/Settings/SettingsGroup.h:14,
                 from /project/source/src/Settings/FlightMapSettings.h:12,
                 from /project/source/src/QGCApplication.h:26,
                 from /project/source/src/QtLocationPlugin/QGCMapEngine.cpp:18:
/project/source/libs/libevents/libevents/libs/cpp/parse/parser.h:13:10: fatal error: nlohmann_json/include/nlohmann/json_fwd.hpp: No such file or directory
   13 | #include "nlohmann_json/include/nlohmann/json_fwd.hpp"
      | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:135384: QGCMapEngine.o] Error 1

```

The above error is generated even with using the following recommend build/run commands which add the argument `--platform linux/x86_64`

```auto
||docker build --platform linux/x86_64 --file ./deploy/docker/Dockerfile-build-linux -t qgc-linux-docker .|
|---|---|
|||
docker run --platform linux/x86_64 --rm -v ${PWD}:/project/source -v ${PWD}/build:/project/build qgc-linux-docker

```

It is clearly a missing library but I can’t seem to figure out what is missing and how to add it to the docker build script. I am thinking it’s possible that the nlohmann\_json stuff referenced may not have an ARM version or it’s pulling the wrong version when it sets up the container.

---

<div class="post-metadata">

**Author:** ![A-A-Ron](https://discuss.px4.io/letter_avatar_proxy/v4/letter/a/d78d45/32.png) [@A-A-Ron](https://discuss.px4.io/u/A-A-Ron)\
**Post date:** [January 31, 2023, 6:17am UTC](https://discuss.px4.io/t/errors-building-qgc-with-docker/25460/8 "2023-01-31T06:17:47Z")

</div>

I had the same issue. The solution for me was to make sure that I had added the git submodule to the local repository:

```
cd libs/libevents/libevents/
git submodule update --init
git submodule update --recursive

```

then I removed the exisitng docker image, built it again using the commands here ([Build using Containers · QGroundControl Developer Guide](https://dev.qgroundcontrol.com/master/en/getting_started/container.html)) , and ran the container again using the commands from the same resource.

I am very new to the concept of submodules, so it may be possible to just recursively add all of them at the very beginning from the root of the source tree. I hope that helps

A-A-Ron
