Skip to content

Commit

Permalink
[Build] Fix libyang build broken issue (#13162)
Browse files Browse the repository at this point in the history
Why I did it
The libyang cannot be built with the latest version of cmake.
Example: https://dev.azure.com/mssonic/build/_build/results?buildId=181862&view=logs&j=993d6e22-aeec-5c03-fa19-35ecba587dd9&t=d0538dec-1681-5ff8-bd45-c0de13be9706

[ 96%] Building CXX object swig/python2/CMakeFiles/_yang2.dir/yangPYTHON_wrap.cxx.o
/sonic/src/libyang/libyang-1.0.73/build/swig/python2/yangPYTHON_wrap.cxx:3292:33: error: expected initializer before '.' token
 #  define SWIG_init    init_yang.so
                                 ^
/sonic/src/libyang/libyang-1.0.73/build/swig/python2/yangPYTHON_wrap.cxx:102537:1: note: in expansion of macro 'SWIG_init'
 SWIG_init(void) {
 ^~~~~~~~~
/sonic/src/libyang/libyang-1.0.73/build/swig/python2/yangPYTHON_wrap.cxx:101971:24: warning: 'swig_const_table' defined but not used [-Wunused-variable]
 static swig_const_info swig_const_table[] = {

See relative issue: #4315

How I did it
Not upgrade the cmake, change to use the dbus-python 1.2.18 which is compatible with cmake 3.13.4

How to verify it
See https://dev.azure.com/mssonic/build/_build/results?buildId=194756&view=results
  • Loading branch information
xumia authored Dec 28, 2022
1 parent 852d41b commit 0e559e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y -t
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install gir1.2-glib-2.0 libdbus-1-3 libgirepository-1.0-1
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y -t $IMAGE_DISTRO-backports install libsystemd0

if [[ $CONFIGURED_ARCH == armhf ]]; then
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install dbus-python==1.2.18
fi

# Install SONiC host services package
SONIC_HOST_SERVICES_PY3_WHEEL_NAME=$(basename {{sonic_host_services_py3_wheel_path}})
sudo cp {{sonic_host_services_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_HOST_SERVICES_PY3_WHEEL_NAME
Expand Down
6 changes: 3 additions & 3 deletions sonic-slave-buster/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@ RUN apt-get update && apt-get install -y \
libsystemd-dev \
pkg-config

# Upgrade cmake to support dbus-python build in armhf
RUN apt-get install -t buster-backports -y cmake

RUN apt-get -y build-dep openssh

# Build fix for ARMHF buster libsairedis
Expand All @@ -380,6 +377,9 @@ RUN apt-get -y build-dep openssh

# workaround because of https://bugs.launchpad.net/qemu/+bug/1805913, just disable aspell
RUN cp /bin/true /usr/bin/aspell

# The cmake (>3.15) is required to install the latest version of dbus-python in armhf, but the cmake will conflict with libyang
RUN pip3 install dbus-python==1.2.18
{%- endif %}

## Config dpkg
Expand Down

0 comments on commit 0e559e0

Please sign in to comment.