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) <noreply@anthropic.com>
This commit is contained in:
Patrick Schurig 2026-08-02 11:01:19 +02:00
parent 30b58dbf1e
commit 5db002f53b

View File

@ -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