Can't find parser.h

I’m trying to build QGroundControl using CMake. My build script is as follows:

mkdir -p ~/build/$1
cd ~/build/$1
mkdir -p gdbg
mkdir -p grel
mkdir -p gins
mkdir -p gafl
mkdir -p cdbg
mkdir -p crel
mkdir -p cins
mkdir -p cafl
cd gdbg
cd ../grel
cd ../gins
cd ../gafl
cd ../cdbg
cd ../crel
cd ../cins
cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ~/src/$1
cd ../cafl

The only difference from my usual build script, which I use for my C++ projects, is setting the Qt5_DIR variable.
When I run ninja, I get this error:

In file included from /home/phma/src/qgroundcontrol/src/Vehicle/
In file included from /home/phma/src/qgroundcontrol/src/Vehicle/EventHandler.h:18:
/home/phma/src/qgroundcontrol/src/Vehicle/HealthAndArmingChecks.h:16:10: fatal error: 'libevents/libs/cpp/parse/parser.h' file not found
#include <libevents/libs/cpp/parse/parser.h>

I searched the Internet for an Ubuntu package providing this file and found none. So I ran locate and found that it’s at /home/phma/src/qgroundcontrol/libs/libevents/libevents/libs/cpp/parse/parser.h.
This is the first time I’ve even heard of submodules in Git. Since the filename is in brokets, I’m guessing that it’s in a submodule which has to be installed before I can compile the main program. How do I do this?

This is explained in QGC developer guide
You need to do the following:

git clone --recursive -j8
git submodule update --recursive

and then start your build.

I did clone recursively. The problem turns out to be:

  1. include_directories did not include libs/libevents. I added it, which fixed the missing include file, but then I got a link error, because
  2. libs/libevents/CMakeLists.txt does not exist. There is a CMakeLists.txt file deeper in; I’ll add_subdirectory it and see what happens.

I did that and got another error, which appears to be in a Python script. I’ll start a new thread for it.

I had a lot of trouble building and what worked best for me was qmake and strictly following the dev guide posted above. would recommend ubuntu if possible to spin up a vm - it was too much pain to go through on updated macos.

The problem with finding parser.h has been fixed by commit a04f85bbc92531053c3d943376b51836a9980917. I don’t know qmake and couldn’t get it to work either.