diff --git a/HISTORY.rst b/HISTORY.rst index df159f44..5163a245 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -22,6 +22,7 @@ test-driven methodologies, and modern toolchains for unrivaled success. ~~~~~~~~~~~~~~~~~~~ * Resolved an issue where the ``compiledb`` target failed to properly escape compiler executable paths containing spaces (`issue #4998 `_) +* Resolved an issue with incorrect path resolution when linking static libraries via the `build_flags `__ option (`issue #5004 `_) 6.1.16 (2024-09-26) ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piobuild.py b/platformio/builder/tools/piobuild.py index 840c6f90..e1a310bd 100644 --- a/platformio/builder/tools/piobuild.py +++ b/platformio/builder/tools/piobuild.py @@ -219,6 +219,11 @@ def ParseFlagsExtended(env, flags): # pylint: disable=too-many-branches if os.path.isdir(p): result[k][i] = os.path.abspath(p) + # fix relative LIBs + for i, l in enumerate(result.get("LIBS", [])): + if isinstance(l, FS.File): + result["LIBS"][i] = os.path.abspath(l.get_path()) + # fix relative path for "-include" for i, f in enumerate(result.get("CCFLAGS", [])): if isinstance(f, tuple) and f[0] == "-include":