From 3b47af55f8df1e4d28fb8dca4c8342a60d64ac2f Mon Sep 17 00:00:00 2001 From: Brad House Date: Sun, 31 May 2026 13:32:32 +0000 Subject: [PATCH 1/3] azure-pipelines: migrate libyang1 deb install to libyang3 sonic-buildimage no longer builds the libyang1 debs (libyang_1.0.73, libyang-cpp, python3-yang); the common_libs pipeline now produces only libyang3. Update the common-lib artifact download patterns to fetch the libyang3 deb instead of the removed libyang_*.deb, using a versionless glob. The install step uses a generic find for *.deb and needs no change. Part of sonic-net/sonic-buildimage#22385. Signed-off-by: Brad House --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 276ad28..c1e5bc0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -88,7 +88,7 @@ jobs: path: $(Build.ArtifactStagingDirectory)/download artifact: common-lib patterns: | - target/debs/bookworm/libyang_*.deb + target/debs/bookworm/libyang3_*.deb displayName: "Download libyang from common lib" - script: | set -ex @@ -184,7 +184,7 @@ jobs: path: $(Build.ArtifactStagingDirectory)/download artifact: common-lib.arm64 patterns: | - target/debs/bookworm/libyang_*.deb + target/debs/bookworm/libyang3_*.deb displayName: "Download libyang from common lib" - script: | set -ex @@ -275,7 +275,7 @@ jobs: path: $(Build.ArtifactStagingDirectory)/download artifact: common-lib.armhf patterns: | - target/debs/bookworm/libyang_*.deb + target/debs/bookworm/libyang3_*.deb displayName: "Download libyang from common lib" - script: | set -ex From 0061c11992e951b919044615967604e4d4036405 Mon Sep 17 00:00:00 2001 From: Brad House Date: Mon, 15 Jun 2026 13:39:17 +0000 Subject: [PATCH 2/3] ci(codeql): link against libyang3 instead of distro libyang1 The CodeQL job runs on ubuntu-22.04 where apt 'libyang-dev' is libyang1 (1.0.225), but the libswsscommon.so it downloads is built against libyang3, so the link fails with 'libyang.so.3 ... not found' / undefined references to ly_ctx_new, lyd_value_get_canonical, etc., and CodeQL reports a configuration error (no code compiled). Drop the apt libyang-dev and stage the libyang3 debs into the same prefix as swss-common. The artifacts REST API needs an exact filename (no globs), so fetch the bookworm debs zip and extract just the libyang3 debs with a glob to stay version-independent across libyang3 bumps. Signed-off-by: Brad House --- .github/workflows/codeql-analysis.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bff1255..9767019 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -50,7 +50,6 @@ jobs: libnl-genl-3-dev \ libnl-route-3-dev \ libnl-nf-3-dev \ - libyang-dev \ libzmq3-dev \ libzmq5 \ swig3.0 \ @@ -131,7 +130,18 @@ jobs: exit 0 fi - rm -rf /tmp/swss-common /tmp/swss-common.zip + # libswsscommon is built against libyang3 (libyang.so.3); the distro + # apt libyang on this runner is libyang1, so the link would fail with + # "libyang.so.3 ... not found". Stage the libyang3 debs into the same + # prefix as swss-common. The sonic-build artifacts REST API requires an + # exact filename (wildcards do not resolve), so fetch the bookworm debs + # directory as a zip and extract just the libyang3 debs with a glob to + # stay version-independent across libyang3 bumps. + curl -sL -o /tmp/bookworm-debs.zip "https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=master&platform=vs&target=target/debs/bookworm&format=zip" + unzip -j -o /tmp/bookworm-debs.zip '*/libyang3_*.deb' '*/libyang-dev_*.deb' -d /tmp/libyang + for d in /tmp/libyang/*.deb; do dpkg-deb -x "$d" $(dirname $GITHUB_WORKSPACE); done + + rm -rf /tmp/swss-common /tmp/swss-common.zip /tmp/libyang /tmp/bookworm-debs.zip echo "installed=true" >> "$GITHUB_OUTPUT" env: SWSSCOMMON_VER: "1.0.0" From e6734af4c582dcc1976ed0a271c9877eabccc7b3 Mon Sep 17 00:00:00 2001 From: Brad House Date: Mon, 15 Jun 2026 13:51:15 +0000 Subject: [PATCH 3/3] ci(codeql): set LD_LIBRARY_PATH so ld resolves indirect libyang.so.3 Staging libyang3 into the prefix was not enough: libyang.so.3 is an indirect dependency (needed by libswsscommon.so, not linkmgrd directly), and ld does not search -L paths for indirect deps -- only -rpath-link and LD_LIBRARY_PATH. Export LD_LIBRARY_PATH pointing at the staged libyang3 so the link resolves ly_ctx_new, lyd_value_get_canonical, etc. Signed-off-by: Brad House --- .github/workflows/codeql-analysis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9767019..e7913b1 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -153,6 +153,10 @@ jobs: sed -i "/JOBS := \$(subst -j,,\$(JOB_FLAG))/a JOBS := 1" Makefile sed -i -e "s/ -flto//g" Makefile sed -i '/-include objects.mk/a LIBS := -L'"$(dirname $GITHUB_WORKSPACE)"'/usr/lib/x86_64-linux-gnu \$(LIBS)' Makefile + # libswsscommon.so pulls in libyang.so.3 as an indirect dependency. ld + # does not search -L paths for indirect deps, only -rpath-link and + # LD_LIBRARY_PATH, so point it at the staged libyang3 in the prefix. + export LD_LIBRARY_PATH="$(dirname $GITHUB_WORKSPACE)/usr/lib/x86_64-linux-gnu${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" make all INCLUDES="-L$(dirname $GITHUB_WORKSPACE)/usr/lib/x86_64-linux-gnu -I$(dirname $GITHUB_WORKSPACE)/usr/include" - name: Perform CodeQL Analysis