FRRouting / frr

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

libyang errors when compiling for openwrt #5344

Open Tualua opened 4 years ago

Tualua commented 4 years ago

Hello!

I'm trying to build frr for openwrt 18.06.5 using http://docs.frrouting.org/projects/dev-guide/en/latest/building-frr-for-openwrt.html

Error is:

checking for LIBYANG (libyang >= 0.16.7)... no
configure: error: libyang (>= 0.16.7) was not found on your system.
Makefile:389: recipe for target '/home/user/openwrt/build_dir/target-mipsel_24kc_musl/frr-ce746edebb88320af871d6e4bc42a8022f7c1da5/.configured_486748fa83b6fa4885f41a5a0a5c460e' failed
make[2]: *** [/home/user/openwrt/build_dir/target-mipsel_24kc_musl/frr-ce746edebb88320af871d6e4bc42a8022f7c1da5/.configured_486748fa83b6fa4885f41a5a0a5c460e] Error 1
make[2]: Leaving directory '/home/user/openwrt/feeds/routing/frr'
time: package/feeds/routing/frr/compile#30.07#6.09#36.45
package/Makefile:111: recipe for target 'package/feeds/routing/frr/compile' failed
make[1]: *** [package/feeds/routing/frr/compile] Error 2
make[1]: Leaving directory '/home/user/openwrt'
/home/user/openwrt/include/toplevel.mk:216: recipe for target 'package/frr/compile' failed
make: *** [package/frr/compile] Error 2

libyang is enabled as a module in openwrt menuconfig and installed in the system I'm using to build openwrt (Ubuntu 18.04.3)

What am I doing wrong? Please help

donaldsharp commented 4 years ago

What version of libyang is installed?

Tualua commented 4 years ago
apt list --installed|grep libyang

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libyang-dev/now 0.16.105-1 amd64 [installed,local]
libyang0.16/now 0.16.105-1 amd64 [installed,local]
donaldsharp commented 4 years ago

@rwestphal any thoughts here?

rwestphal commented 4 years ago

@Tualua this error indicates that libyang isn't correctly installed in your OpenWRT box.

Please provide the output of the following command: pkg-config --exists --print-errors libyang

lucize commented 4 years ago

update libyang from master(1.0-r4), it should work, also use the frr from master, I've update it ot 7.2, also take a look at the pending PR (fix for mips)

lucize commented 4 years ago

I wanted to drop the build instructions as it is now in master, but the PR was closed

qlyoung commented 4 years ago

@lucize what are you referring to?

lucize commented 4 years ago

5080 regarding to build instructions you mean ?

I don't know why the commit description was put in place of the build instruction

Cryst commented 4 years ago

FRR 7.3 is compiling fine with libyang 0.16.105 (0.16-r3) package for OpenWrt CC 15.05.1. Then I tried to build FRR 7.4 with same libyang (I removed lib clippy from Makefile) but it ends with error:

checking for LIBYANG... no
configure: error: libyang (>= 0.16.105) was not found on your system.
Makefile:219: recipe for target '/home/user/chaos_calmer/build_dir/host/frr-frr-7.4/.configured' failed

libyang was working before, so I commented PKG_CHECK for checking libyang version in configure.ac.

  CC       pimd/mtracebis.o
  CC       pimd/mtracebis_netlink.o
  CC       pimd/mtracebis_routeget.o
  CCLD     pimd/mtracebis
lib/.libs/libfrr.so: undefined reference to `lyd_schema_sort'
lib/.libs/libfrr.so: undefined reference to `ly_errno_glob_address'
lib/.libs/libfrr.so: undefined reference to `lyd_parse_path'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_get_module'
lib/.libs/libfrr.so: undefined reference to `lys_data_path'
lib/.libs/libfrr.so: undefined reference to `lys_set_enabled'
lib/.libs/libfrr.so: undefined reference to `lyd_change_leaf'
lib/.libs/libfrr.so: undefined reference to `ly_set_free'
lib/.libs/libfrr.so: undefined reference to `lyd_find_path'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_get_module_iter'
lib/.libs/libfrr.so: undefined reference to `ly_verb'
lib/.libs/libfrr.so: undefined reference to `lyd_free_withsiblings'
lib/.libs/libfrr.so: undefined reference to `lys_path'
lib/.libs/libfrr.so: undefined reference to `ly_log_options'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_destroy'
lib/.libs/libfrr.so: undefined reference to `lyd_dup_withsiblings'
lib/.libs/libfrr.so: undefined reference to `ly_err_first'
lib/.libs/libfrr.so: undefined reference to `ly_err_clean'
lib/.libs/libfrr.so: undefined reference to `lyd_diff'
lib/.libs/libfrr.so: undefined reference to `lyd_dec64_to_double'
lib/.libs/libfrr.so: undefined reference to `lys_is_key'
lib/.libs/libfrr.so: undefined reference to `lys_set_private'
lib/.libs/libfrr.so: undefined reference to `lyd_validate'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_get_node'
lib/.libs/libfrr.so: undefined reference to `lyd_path'
lib/.libs/libfrr.so: undefined reference to `lyd_print_mem'
lib/.libs/libfrr.so: undefined reference to `lyd_new_path'
lib/.libs/libfrr.so: undefined reference to `lyd_wd_default'
lib/.libs/libfrr.so: undefined reference to `lys_print_mem'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_set_module_imp_clb'
lib/.libs/libfrr.so: undefined reference to `ly_errpath'
lib/.libs/libfrr.so: undefined reference to `lyd_free_diff'
lib/.libs/libfrr.so: undefined reference to `lyd_merge'
lib/.libs/libfrr.so: undefined reference to `ly_set_log_clb'
lib/.libs/libfrr.so: undefined reference to `lyd_free'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_load_module'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_new'
lib/.libs/libfrr.so: undefined reference to `ly_verb_dbg'
lib/.libs/libfrr.so: undefined reference to `lys_set_disabled'
collect2: error: ld returned 1 exit status
Makefile:5839: recipe for target 'pimd/mtracebis' failed
make[4]: *** [pimd/mtracebis] Error 1
make[4]: Leaving directory '/home/user/chaos_calmer/build_dir/host/frr-frr-7.4'
Makefile:4139: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/user/chaos_calmer/build_dir/host/frr-frr-7.4'
Makefile:219: recipe for target '/home/user/chaos_calmer/build_dir/host/frr-frr-7.4/.built' failed
make[2]: *** [/home/user/chaos_calmer/build_dir/host/frr-frr-7.4/.built] Error 2
make[2]: Leaving directory '/home/user/chaos_calmer/customfeed/frr'
package/Makefile:191: recipe for target 'package/feeds/customfeed/frr/host/compile' failed
make[1]: *** [package/feeds/customfeed/frr/host/compile] Error 2
make[1]: Leaving directory '/home/user/chaos_calmer'
/home/user/chaos_calmer/include/toplevel.mk:181: recipe for target 'package/frr/compile' failed
make: *** [package/frr/compile] Error 2

Looks like there is a path mismath somewhere starting from FRR7.4 and libyang cannot be found.

lucize commented 4 years ago

don't have the commit in mind, libyand dependency was increased, just backport the new libyang committed in master branch

nic1225 commented 3 years ago

@Cryst, Is this problem finally solved? I have the same problem as you?

Cryst commented 3 years ago

@nic1225 No. I'm unable to compile frr7.4.

cheesy63 commented 3 years ago

I am seeing a similar error with FRR 7.6.0 and libyang 1.9.2. I have built libyang with cmake -DENABLE_LYD_PRIV=ON as directed by the configure script. I also verifed that the symbols listed below exist with the libyang library. Any help would be greatly appreciated. I am cross-compiling to gcc5.3.0-X86_64

from the configure script:

checking for netinet6/in6.h... no
checking for netinet/in6_var.h... no
checking for netinet6/in6_var.h... no
checking for netinet6/nd6.h... no
checking for LIBYANG (libyang >= 1.0.184)... yes
checking for struct lyd_node.priv... yes
libtool: link: ( cd "zebra/.libs" && rm -f "zebra_irdp.la" && ln -s "../zebra_irdp.la" "zebra_irdp.la" )
depbase=`echo zebra/zebra_mlag_private.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu11 -DHAVE_CONFIG_H -DSYSCONFDIR=\"/etc/\" -DCONFDATE=20210206 -I.  -I. -I./include -I./lib -I. -I./include -I./lib   -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/include -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-pcre-8.44.0.999-Linux-gcc5.3.0-x86_64/include -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/include/libyang -I/build_box/frrouting_ver7/dep_artifacts/dependencies/libcap-L3-v2.47-13-g865f118-Linux-gcc5.3.0-x86_64-release/usr/include -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/include      -g -O2 -fno-omit-frame-pointer -funwind-tables -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wundef -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -pthread -MT zebra/zebra_mlag_private.lo -MD -MP -MF $depbase.Tpo -c -o zebra/zebra_mlag_private.lo zebra/zebra_mlag_private.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -std=gnu11 -DHAVE_CONFIG_H -DSYSCONFDIR=\"/etc/\" -DCONFDATE=20210206 -I. -I. -I./include -I./lib -I. -I./include -I./lib -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/include -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-pcre-8.44.0.999-Linux-gcc5.3.0-x86_64/include -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/include/libyang -I/build_box/frrouting_ver7/dep_artifacts/dependencies/libcap-L3-v2.47-13-g865f118-Linux-gcc5.3.0-x86_64-release/usr/include -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/include -g -O2 -fno-omit-frame-pointer -funwind-tables -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wundef -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -pthread -MT zebra/zebra_mlag_private.lo -MD -MP -MF zebra/.deps/zebra_mlag_private.Tpo -c zebra/zebra_mlag_private.c  -fPIC -DPIC -o zebra/.libs/zebra_mlag_private.o
libtool: compile:  gcc -std=gnu11 -DHAVE_CONFIG_H -DSYSCONFDIR=\"/etc/\" -DCONFDATE=20210206 -I. -I. -I./include -I./lib -I. -I./include -I./lib -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/include -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-pcre-8.44.0.999-Linux-gcc5.3.0-x86_64/include -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/include/libyang -I/build_box/frrouting_ver7/dep_artifacts/dependencies/libcap-L3-v2.47-13-g865f118-Linux-gcc5.3.0-x86_64-release/usr/include -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/include -g -O2 -fno-omit-frame-pointer -funwind-tables -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wundef -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -pthread -MT zebra/zebra_mlag_private.lo -MD -MP -MF zebra/.deps/zebra_mlag_private.Tpo -c zebra/zebra_mlag_private.c -o zebra/zebra_mlag_private.o >/dev/null 2>&1
/bin/sh ./libtool  --tag=CC   --mode=link gcc -std=gnu11 -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/include      -g -O2 -fno-omit-frame-pointer -funwind-tables -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wundef -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -pthread -avoid-version -module -shared -export-dynamic -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-pcre-8.44.0.999-Linux-gcc5.3.0-x86_64/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/libcap-L3-v2.47-13-g865f118-Linux-gcc5.3.0-x86_64-release/lib64 -L/lib/aarch64-linux-gnu -o zebra/zebra_cumulus_mlag.la -rpath /lib/frr/modules zebra/zebra_mlag_private.lo  -ldl -lcrypt   -ljson-c -lrt
libtool: link: warning: library `/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib/libjson-c.la' was moved.
libtool: link: rm -fr  zebra/.libs/zebra_cumulus_mlag.la zebra/.libs/zebra_cumulus_mlag.lai zebra/.libs/zebra_cumulus_mlag.so
libtool: link: gcc -std=gnu11 -shared  -fPIC -DPIC  zebra/.libs/zebra_mlag_private.o   -Wl,-rpath -Wl,/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib -Wl,-rpath -Wl,/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-pcre-8.44.0.999-Linux-gcc5.3.0-x86_64/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/libcap-L3-v2.47-13-g865f118-Linux-gcc5.3.0-x86_64-release/lib64 -L/lib/aarch64-linux-gnu -ldl -lcrypt /build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib/libjson-c.so -lrt  -O2 -pthread   -pthread -Wl,-soname -Wl,zebra_cumulus_mlag.so -o zebra/.libs/zebra_cumulus_mlag.so
libtool: link: ( cd "zebra/.libs" && rm -f "zebra_cumulus_mlag.la" && ln -s "../zebra_cumulus_mlag.la" "zebra_cumulus_mlag.la" )
/bin/sh ./libtool  --tag=CC   --mode=link gcc -std=gnu11 -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/include      -g -O2 -fno-omit-frame-pointer -funwind-tables -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wundef -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -pthread -export-dynamic    -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-pcre-8.44.0.999-Linux-gcc5.3.0-x86_64/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/libcap-L3-v2.47-13-g865f118-Linux-gcc5.3.0-x86_64-release/lib64 -L/lib/aarch64-linux-gnu -o pimd/mtracebis pimd/mtracebis.o pimd/mtracebis_netlink.o pimd/mtracebis_routeget.o lib/libfrr.la -ldl -lcrypt   -ljson-c -lrt
libtool: link: warning: library `/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib/libjson-c.la' was moved.
libtool: link: warning: library `/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib/libjson-c.la' was moved.
libtool: link: gcc -std=gnu11 -I/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/include -g -O2 -fno-omit-frame-pointer -funwind-tables -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wundef -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -pthread -o pimd/.libs/mtracebis pimd/mtracebis.o pimd/mtracebis_netlink.o pimd/mtracebis_routeget.o -Wl,--export-dynamic  -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-pcre-8.44.0.999-Linux-gcc5.3.0-x86_64/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libyang/lib -L/build_box/frrouting_ver7/dep_artifacts/dependencies/libcap-L3-v2.47-13-g865f118-Linux-gcc5.3.0-x86_64-release/lib64 -L/lib/aarch64-linux-gnu lib/.libs/libfrr.so -lcap -lm -ldl -lcrypt /build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib/libjson-c.so -lrt -pthread -Wl,-rpath -Wl,/build_box/frrouting_ver7/dep_artifacts/dependencies/foss-libjson-c-0.12.1.23-Linux-gcc5.3.0-x86_64/lib
lib/.libs/libfrr.so: undefined reference to `lyd_schema_sort'
lib/.libs/libfrr.so: undefined reference to `ly_errno_glob_address'
lib/.libs/libfrr.so: undefined reference to `lyd_parse_path'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_get_module'
lib/.libs/libfrr.so: undefined reference to `lyd_list_pos'
lib/.libs/libfrr.so: undefined reference to `lys_data_path'
lib/.libs/libfrr.so: undefined reference to `lys_set_enabled'
lib/.libs/libfrr.so: undefined reference to `lyd_change_leaf'
lib/.libs/libfrr.so: undefined reference to `ly_set_free'
lib/.libs/libfrr.so: undefined reference to `lyd_find_path'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_get_module_iter'
lib/.libs/libfrr.so: undefined reference to `ly_verb'
lib/.libs/libfrr.so: undefined reference to `lyd_free_withsiblings'
lib/.libs/libfrr.so: undefined reference to `lys_path'
lib/.libs/libfrr.so: undefined reference to `ly_log_options'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_destroy'
lib/.libs/libfrr.so: undefined reference to `lyd_dup_withsiblings'
lib/.libs/libfrr.so: undefined reference to `ly_err_first'
lib/.libs/libfrr.so: undefined reference to `ly_err_clean'
lib/.libs/libfrr.so: undefined reference to `lyd_diff'
lib/.libs/libfrr.so: undefined reference to `lyd_dec64_to_double'
lib/.libs/libfrr.so: undefined reference to `lys_is_key'
lib/.libs/libfrr.so: undefined reference to `lys_set_private'
lib/.libs/libfrr.so: undefined reference to `lyd_validate'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_get_node'
lib/.libs/libfrr.so: undefined reference to `lyd_path'
lib/.libs/libfrr.so: undefined reference to `lyd_print_mem'
lib/.libs/libfrr.so: undefined reference to `lyd_new_path'
lib/.libs/libfrr.so: undefined reference to `lyd_wd_default'
lib/.libs/libfrr.so: undefined reference to `lys_print_mem'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_set_module_imp_clb'
lib/.libs/libfrr.so: undefined reference to `ly_errpath'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_internal_modules_count'
lib/.libs/libfrr.so: undefined reference to `lyd_free_diff'
lib/.libs/libfrr.so: undefined reference to `lyd_merge'
lib/.libs/libfrr.so: undefined reference to `ly_set_log_clb'
lib/.libs/libfrr.so: undefined reference to `lyd_free'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_load_module'
lib/.libs/libfrr.so: undefined reference to `ly_ctx_new'
lib/.libs/libfrr.so: undefined reference to `ly_verb_dbg'
lib/.libs/libfrr.so: undefined reference to `lys_set_disabled'
collect2: error: ld returned 1 exit status
make[2]: *** [pimd/mtracebis] Error 1
make[2]: Leaving directory `/build_box/frrouting_ver7/frr-7.6.0'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/build_box/frrouting_ver7/frr-7.6.0'
make: *** [arch] Error 2

Compilation exited abnormally with code 2 at Sat Feb  6 13:30:10
qlyoung commented 3 years ago

Usually this happens when you compiled with the correct headers and then tried to link against the wrong headers. Is it possible you have an old version of libyang installed? If so, I would try completely purging all libyangs and then reinstalling the newer one, and then clean and recompile FRR.