FRRouting / frr

The FRRouting Protocol Suite
https://frrouting.org/
Other
3.36k stars 1.25k forks source link

build alpine docker image failed when enable grpc #14345

Closed ad-c2-ip58n4 closed 1 year ago

ad-c2-ip58n4 commented 1 year ago

when I build frr docker image with grpc enabled, it is always failed with the following error:

  CXX tests/lib/test_grpc-test_grpc.o
  CXXLD tests/lib/test_grpc
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: tests/lib/test_grpc-test_grpc.o: undefined reference to symbol '_ZN4absl12lts_202206235MutexD1Ev'
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libabsl_synchronization.so.2206.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:8659: tests/lib/test_grpc] Error 1
>>> ERROR: frr: check failed

frr version: tag 8.5.2 build command: docker build -t frr-grpc-alpine:8.5.2 -f docker/alpine/Dockerfile . APKBUILD.in file changed:

diff --git a/alpine/APKBUILD.in b/alpine/APKBUILD.in
index fef7a61cc..adeb48199 100644
--- a/alpine/APKBUILD.in
+++ b/alpine/APKBUILD.in
@@ -13,12 +13,12 @@ makedepends="ncurses-dev net-snmp-dev gawk texinfo perl
     expat fakeroot flex fortify-headers gdbm git gmp json-c-dev kmod
     lddtree libacl libatomic libattr libblkid libburn libbz2 libc-dev
     libcap-dev libcurl libedit libffi libgcc libgomp libisoburn libisofs
- libltdl libressl libssh2 libstdc++ libtool libuuid
+ libltdl libressl libssh2 libstdc++ libtool libuuid abseil-cpp abseil-cpp-dev
     linux-headers lzip lzo m4 make mkinitfs mpc1 mpfr4 mtools musl-dev
     ncurses-libs ncurses-terminfo ncurses-terminfo-base patch pax-utils pcre2
     perl pkgconf python3 python3-dev readline readline-dev sqlite-libs pcre2-dev
- squashfs-tools sudo tar texinfo xorriso xz-libs py-pip rtrlib rtrlib-dev
- py3-sphinx elfutils elfutils-dev libyang-dev"
+ squashfs-tools sudo tar texinfo xorriso xz-libs py-pip rtrlib rtrlib-dev re2-dev
+ py3-sphinx elfutils elfutils-dev libyang-dev cmake grpc grpc-dev protobuf-dev"
 checkdepends="pytest py-setuptools"
 install="$pkgname.pre-install $pkgname.pre-deinstall $pkgname.post-deinstall"
 subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg"
@@ -43,6 +43,7 @@ build() {
                --localstatedir=$_localstatedir \
                --enable-rpki \
                --enable-vtysh \
+ --enable-grpc \
                --enable-multipath=64 \
                --enable-vty-group=frrvty \
                --enable-user=$_user \
ton31337 commented 1 year ago

This is kinda an experimental feature right now, and we don't build it to be enabled by default (including the containers). This might be a linker issue, due to missing linker flags. Did you try older/newer Alpine versions?