From 5db002f53bd53ed26ef8283ea22b1f1ec932a5ff Mon Sep 17 00:00:00 2001 From: Patrick Schurig Date: Sun, 2 Aug 2026 11:01:19 +0200 Subject: [PATCH] build: add QMAKE_RPATHDIR for the sysroot cross-build Building against a local sysroot rather than an installed libnymea-sunspec-dev left the resulting binaries unable to find libnymea-sunspec1 at run time: the sysroot is not in the dynamic linker's cache, so -L alone is not enough and every test had to be launched through LD_LIBRARY_PATH. Only the NYMEA_SUNSPEC_PATH branch is touched. The package build resolves the library through pkg-config and gets no rpath, as before. Verified both ways: with NYMEA_SUNSPEC_PATH the binary carries a RUNPATH to the sysroot, resolves libnymea-sunspec1 there and runs its 44 tests with LD_LIBRARY_PATH unset; without it, no sunspec rpath is generated at all. Co-Authored-By: Claude Opus 5 (1M context) --- sunspec.pri | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sunspec.pri b/sunspec.pri index d10c263..4b15622 100644 --- a/sunspec.pri +++ b/sunspec.pri @@ -21,8 +21,13 @@ isEmpty(NYMEA_SUNSPEC_PATH) { SUNSPEC_INCLUDEDIR = $$[QT_INSTALL_PREFIX]/include/nymea-sunspec } else { SUNSPEC_INCLUDEDIR = $$NYMEA_SUNSPEC_PATH/usr/include/nymea-sunspec + SUNSPEC_LIBDIR = $$NYMEA_SUNSPEC_PATH/usr/lib/$$QMAKE_HOST.arch-linux-gnu INCLUDEPATH += $$SUNSPEC_INCLUDEDIR - LIBS += -L$$NYMEA_SUNSPEC_PATH/usr/lib/$$QMAKE_HOST.arch-linux-gnu -lnymea-sunspec1 + LIBS += -L$$SUNSPEC_LIBDIR -lnymea-sunspec1 + # Build de developpement contre un sysroot : la bibliotheque n'est pas dans + # le cache de l'editeur de liens dynamique, il faut donc l'embarquer. Ce + # rpath n'existe pas dans le build paquet, qui passe par pkg-config. + QMAKE_RPATHDIR += $$SUNSPEC_LIBDIR } SUNSPEC_MODELS_WORKAROUND = $$SUNSPEC_INCLUDEDIR/home/jenkins/nymea-plugins-modbus/libnymea-sunspec