From 538043b7f2527756c32fd095e012ba831a99c183 Mon Sep 17 00:00:00 2001 From: Timothy Hofland Date: Sun, 15 Mar 2026 21:47:30 +0100 Subject: [PATCH] build: explicitly inject OF include paths to fix cross-compile find() failures --- scripts/build.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/build.sh b/scripts/build.sh index 58d7675..95d18e0 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -205,6 +205,28 @@ unset PKG_CONFIG_LIBDIR ARM64_PKG_CONFIG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig" +# OF's config.shared.mk uses $(shell find ...) to discover OF source subdirectory +# include paths and thirdparty lib headers. This can return empty in Docker +# cross-compile environments, causing "ofConstants.h: No such file or directory". +# Work around it by computing the include paths here and injecting them via +# PLATFORM_CFLAGS (which appears in the project compile command regardless). +OF_EXTRA_INCLUDES="-I$OF_DIR/libs/openFrameworks" +# OF source subdirectories (app, utils, math, gl, graphics, events, etc.) +for d in "$OF_DIR/libs/openFrameworks"/*/; do + [ -d "$d" ] && OF_EXTRA_INCLUDES="$OF_EXTRA_INCLUDES -I${d%/}" +done +# Thirdparty header-only libs bundled with OF (glm, json, kiss, tess2, utf8, ...) +for lib in "$OF_DIR/libs"/*/; do + libname=$(basename "$lib") + [ "$libname" = "openFrameworks" ] && continue + [ "$libname" = "openFrameworksCompiled" ] && continue + incdir="${lib}include" + [ -d "$incdir" ] || continue + while IFS= read -r subdir; do + OF_EXTRA_INCLUDES="$OF_EXTRA_INCLUDES -I$subdir" + done < <(find "$incdir" -type d) +done + make clean 2>/dev/null || true make -j1 \ PKG_CONFIG="$PKGCFG_WRAPPER" \ @@ -216,7 +238,7 @@ make -j1 \ CXX=aarch64-linux-gnu-g++ \ AR=aarch64-linux-gnu-ar \ LD=aarch64-linux-gnu-ld \ - PLATFORM_CFLAGS="$GLOBAL_FLAGS -I$ADDON_DIR/src" \ + PLATFORM_CFLAGS="$GLOBAL_FLAGS $OF_EXTRA_INCLUDES -I$ADDON_DIR/src" \ USER_CFLAGS="$GLOBAL_FLAGS" \ USER_CPPFLAGS="-std=c++11" \ OF_PROJECT_OPTIMIZATION_FLAGS="-O0"