Peter Marheine has uploaded this change for review.

View Change

dos/meson: add a hint for setting sys_root

I found that cross-compiling with GCC 12.2.0 targeting DJGPP from Linux
on x86_64 that meson used my system include directory
(/usr/include/x86_64-linux-gnu/) and pulled in include files that are
incompatible with DJGPP. Setting sys_root prevents meson from assuming
they're compatible between the build and host systems, fixing those
compile-time errors.

TEST=meson setup --cross-file meson_cross/i586_djgpp_dos.txt; ninja
libflashrom.h no longer causes "features.h: No such file or
directory" errors via /usr/include/x86_64-linux-gnu/sys/types.h

Change-Id: Ib9cf70f6f94782c5303fb232aaf4a46192907f66
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
---
M meson_cross/i586_djgpp_dos.txt
1 file changed, 6 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/12/82212/1
diff --git a/meson_cross/i586_djgpp_dos.txt b/meson_cross/i586_djgpp_dos.txt
index 66d5ed0..3d97aab 100644
--- a/meson_cross/i586_djgpp_dos.txt
+++ b/meson_cross/i586_djgpp_dos.txt
@@ -5,6 +5,11 @@
# Make sure pkg-config can find your self compiles libpci
# or add the path of your libpci.pc as 'pkg_config_libdir'
# under [properies] below.
+#
+# If cross-compiling, you may need to set sys_root in the [properties]
+# section because meson otherwise assumes the same sysroot as the
+# system on which you're building and will get the wrong include files
+# (from /usr/include/x86_64 for example) among other possible issues.

[binaries]
c = 'i586-pc-msdosdjgpp-gcc'
@@ -27,3 +32,4 @@
ich_descriptors_tool = 'disabled'

[properties]
+sys_root = '/usr/local/djgpp'

To view, visit change 82212. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Ib9cf70f6f94782c5303fb232aaf4a46192907f66
Gerrit-Change-Number: 82212
Gerrit-PatchSet: 1
Gerrit-Owner: Peter Marheine <pmarheine@chromium.org>
Gerrit-MessageType: newchange