By default, if you install libdwarf-dev/libdwarf-devel package from the most of Linux distributions, headers land in /usr/include/libdwarf.
Flatpak's configure script assumes that the header is in $(includedir)/include/libdwarf, which by default is /usr/local/include/libdwarf. That's why this error occurs:
checking for libdwarf/dwarf.h... yes
configure: error: dwarf.h is required but was not found; locate it using --with-dwarf-header=/path/containing/header
The path to the libdwarf header can be provided manually by --with-dwarf-header-option, but what about jhbuild? When you use gnome-world moduleset and do jhbuild build flatpak, then the error above occurs and the only thing which can be done to fix this is changing the moduleset contents, like:
jhbuild build flatpak
diff --git a/modulesets/gnome-world.modules b/modulesets/gnome-world.modules
index 7305ea3..073695a 100644
@@ -3245,7 +3245,7 @@
- <autotools id="flatpak" autogenargs="--disable-sudo --disable-system-helper">
+ <autotools id="flatpak" autogenargs="--disable-sudo --disable-system-helper --with-dwarf-header=/usr/include/libdwarf">
I think that the change above is not good to be proposed for jhbuild's upstream and that it would be better to fix looking for libdwarf here, in flatpak. Unfortunately, libdwarf/dwarf doesn't support pkg-config. I don't know any better way that just add -I/usr/include/libdwarf to CPPFLAGS.
If anyone has any better suggestions, I would appreciate them.
configure: Look for the libdwarf headers also in /usr/include/libdwarf
Before this change, configure script looked for them only in
$includedir, which doesn't work well with jhbuild.