Can't find parser.h

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

#!/bin/sh
Qt5_DIR=~/Qt/5.12.6/gcc_64/lib/cmake/Qt5
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
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=~ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ~/src/$1
cd ../grel
cmake -GNinja -DCMAKE_INSTALL_PREFIX=~ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ~/src/$1
cd ../gins
cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ~/src/$1
cd ../gafl
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=~ -DCMAKE_C_COMPILER=afl-gcc -DCMAKE_CXX_COMPILER=afl-g++ -DNO_INSTALL=1 ~/src/$1
cd ../cdbg
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=~ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ~/src/$1
cd ../crel
cmake -GNinja -DCMAKE_INSTALL_PREFIX=~ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ~/src/$1
cd ../cins
cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ~/src/$1
cd ../cafl
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=~ -DCMAKE_C_COMPILER=afl-clang -DCMAKE_CXX_COMPILER=afl-clang++ -DNO_INSTALL=1 ~/src/$1

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/Vehicle.cc:52:
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 https://github.com/mavlink/qgroundcontrol.git
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.