Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross compilation of FRR #7141

Closed
nic1225 opened this issue Sep 21, 2020 · 29 comments
Closed

Cross compilation of FRR #7141

nic1225 opened this issue Sep 21, 2020 · 29 comments
Labels
build Issues with the build platform Issue in a specific platform

Comments

@nic1225
Copy link

nic1225 commented Sep 21, 2020

hi,
I want to cross compile FRR in ubuntu 18.04 to run in arm64 environment device,are there any compilation instructions?
Or how to configure the parameters of a ./configure

thanks
Nick.

@pjdruddy
Copy link
Contributor

this pretty much worked for me on a RASPI4 - there was some jiggery-pokery getting the right packages installed but give me a shout on the slack channel if you hit issues.
http://docs.frrouting.org/projects/dev-guide/en/latest/building-frr-for-ubuntu1804.html

@qlyoung
Copy link
Member

qlyoung commented Sep 21, 2020

While we ostensibly support cjson, I have always used libjson-c, which has ARM packages prebuilt for most distros. It's very possible that compilation with cJSON is either broken, or that your source install did not install a corresponding pkg-config file, which is what automake is looking for when searching for json libraries.

@qlyoung qlyoung added build Issues with the build platform Issue in a specific platform labels Sep 21, 2020
@nic1225
Copy link
Author

nic1225 commented Sep 22, 2020

Back to the previous question, I use command ./configure --host=aarch64-linux-gnu, It is mentioned in the echo
" builddir separate from srcdir or by building clippy separately",Is there any operation procedure related to it?

checking build system type... x86_64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
configure: error: cross-compilation is only possible with builddir separate from srcdir or by building clippy separately and using the --with-clippy option.  create a separate directory and run as .../path-to-frr/configure.

And then when compiling in a new directory,as follow

root@nick-virtual-machine:/home/frr# cd build
root@nick-virtual-machine:/home/frr/build# ../configure --host=aarch64-linux-gnu
checking build system type... x86_64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
configure: ...
configure: ... cross-compilation: creating hosttools directory and self-configuring for build platform tools
configure: ... use HOST_CPPFLAGS / HOST_CFLAGS / HOST_LDFLAGS if neccessary
configure: ...
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
configure: error: source directory already configured; run "make distclean" there first

The compiling platform is Ubuntu 18.04, and the host is armv8 64 bit system

thanks
Nick.

@nic1225
Copy link
Author

nic1225 commented Sep 23, 2020

@lucize
The cross-compilation platform is Ubuntu 18.04, and the host is armv8(cortex-a53) 64 bit system, the issue is similar as reported in#2131, my configure like this

../configure \
--host="aarch64-linux-gnu" \
--build="x86_64-pc-linux-gnu" \
CFLAGS="-Os -g -mcpu=cortex-a53 -mfpu=neon -funroll-all-loops --param max-inline-insns-auto=550 -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include/aarch64-linux-gnu" \
CXXFLAGS="-Os -g -mcpu=cortex-a53 -mfpu=neon -funroll-all-loops --param max-inline-insns-auto=550 -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include/aarch64-linux-gnu" \
LDFLAGS="-L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/local/lib -L$/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/lib/aarch64-linux-gnu -L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/lib" \
HOST_CFLAGS="" \
HOST_LDFLAGS="" \
BUILD_CPPFLAGS="" \
BUILD_CFLAGS="-Os -g -mcpu=cortex-a53 -mfpu=neon -funroll-all-loops --param max-inline-insns-auto=550 -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include/aarch64-linux-gnu" \
BUILD_LDFLAGS="-L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/local/lib -L$/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/lib/aarch64-linux-gnu -L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/lib" \
--prefix=/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main \
--localstatedir=/var/run/frr \
--sysconfdir=/etc/frr/ \
--enable-multipath=1 \
--with-pkg-extra-version=-ctyun \
--enable-sysrepo=yes \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty  \
--localstatedir=/var/run/frr \
--sysconfdir=/etc/frr/ 

error as follow

The above user and group must have read/write access to the state file
directory and to the config files in the config file directory.
configure: ...
configure: ... cross-compilation: finished self-configuring for build platform tools
configure: ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for aarch64-linux-gnu-strip... aarch64-linux-gnu-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for perl... /usr/bin/perl
checking for aarch64-linux-gnu-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.9.0... yes
checking for aarch64-linux-gnu-gcc... aarch64-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/home/nick/nxp/flexbuild/packages/apps/frr/build':
configure: error: C compiler cannot create executables
See `config.log' for more details

thanks
Nick.

@lucize
Copy link
Contributor

lucize commented Sep 23, 2020

But did you find the exact error from config.log?

@nic1225
Copy link
Author

nic1225 commented Sep 24, 2020

hi,lucize.

Judging from the error message above, it is probably the compiler's fault

checking for aarch64-linux-gnu-gcc... aarch64-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/home/nick/nxp/flexbuild/packages/apps/frr/build':
configure: error: C compiler cannot create executables

I don't know what the problem is, I posted the log, please help to have a look
config.log

In addition, I am not clear about whether the HOST_* parameter is necessary and how to fill it in. the environment variables we use are as follows

export CROSS=aarch64-linux-gnu-
export RTE_SDK=/home/nick/nxp/flexbuild/packages/apps/frr
export RTE_TARGET=arm64-dpaa-linuxapp-gcc
export LDFLAGS="-L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/lib/aarch64-linux-gnu -L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/lib -L$(RFSDIR)/usr/lib"
export CROSS_PREFIX=aarch64-linux-gnu
export CROSS_TOOLCHAIN=/usr
export CROSS_SYSROOT=/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main
export ARCH=arm64
export OPENSSL_PATH=/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr
export EXTRA_INC=/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include/aarch64-linux-gnu
export EXTRA_LIBS=/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/lib/aarch64-linux-gnu
export LD_LIBRARY_PATH=$(DESTDIR)/usr/local/dpdk4vpp/lib:$(RFSDIR)/lib/aarch64-linux-gnu

thanks
Nick.

@lucize
Copy link
Contributor

lucize commented Sep 24, 2020

this is a working rock64 configuration, maybe you can spot something here:

 zebra -v
zebra version 7.4
Copyright 1996-2005 Kunihiro Ishiguro, et al.
configured with:
 '--target=aarch64-openwrt-linux' '--host=aarch64-openwrt-linux' '--build=x86_64-pc-linux-gnu' '--program-prefix=' '--program-suffix='
 '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib' '--sysconfdir=/etc' '--datadir=/usr/share'
 '--localstatedir=/var' '--mandir=/usr/man' '--infodir=/usr/info' '--disable-nls' '--with-clippy=/home/build/staging/staging_dir/hostpkg/bin/clippy'
 '--prefix=/usr' '--enable-shared' '--disable-static' '--enable-user=network' '--enable-group=network' '--disable-ospfclient'
 '--disable-doc' '--disable-backtrace' '--localstatedir=/var/run/frr' '--sysconfdir=/etc/frr/' '--with-crypto=openssl' '--disable-babeld'
 '--disable-bfdd' '--enable-bgpd' '--enable-eigrpd' '--disable-fabricd' '--disable-isisd' '--disable-ldpd' '--enable-nhrpd' '--enable-ospfd'
 '--disable-ospf6d' '--disable-pbrd' '--disable-pimd' '--enable-ripd' '--disable-ripngd' '--enable-staticd' '--disable-vrrpd' '--enable-vtysh' '--enable-zebra'
 'build_alias=x86_64-pc-linux-gnu' 'host_alias=aarch64-openwrt-linux' 'target_alias=aarch64-openwrt-linux'
 'PKG_CONFIG=/home/build/staging/staging_dir/host/bin/pkg-config'
 'PKG_CONFIG_PATH=/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/lib/pkgconfig:/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/share/pkgconfig'
 'PKG_CONFIG_LIBDIR=/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/lib/pkgconfig:/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/share/pkgconfig'
 'CC=aarch64-openwrt-linux-musl-gcc'
 'CXX=aarch64-openwrt-linux-musl-g++'

but from your config file it seems that you are missing at least the --target option or build only clippy first, not in the cross compile stage and specify it like I did in the second stage

config for clippy only (for running on build system):

./configure --target=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --program-prefix= --program-suffix= --prefix=/home/build/staging/staging_dir/hostpkg --exec-prefix=/home/build/staging/staging_dir/hostpkg --sysconfdir=/home/build/staging/staging_dir/hostpkg/etc --localstatedir=/home/build/staging/staging_dir/hostpkg/var --sbindir=/home/build/staging/staging_dir/hostpkg/bin --enable-clippy-only

don't know exactly what variables are exported because I use Openwrt SDK in cross building it

@nic1225
Copy link
Author

nic1225 commented Sep 24, 2020

hi,lucize
I don't quite understand what a means for cross compilation. I think the cross compilation process is as follows

./bootstrap.sh 
mkdir build; cd build/
../configure xxx
cd hosttools
make
make install

is that all?

thanks
Nick

@lucize
Copy link
Contributor

lucize commented Sep 24, 2020

it can be like your example, but that is the mixed config setup
you can split the build, I found it more clear like that
first natively build with --enable-clippy-only then
second if you specify --with-clippy= it seems you don't have to make a sub folder, again look at my configure argument for the cross compile stage

@emabo
Copy link
Contributor

emabo commented Sep 24, 2020

Hi,

I also have a cross-compilation issue. I don't know if it's the same described here, but I'll try to describe the problem.
My environment is adding a prefix to all main tools:

MACHINE = tilegx
ARCH = tilegx
CROSS_COMPILE = tile-
CROSS = $(CROSS_COMPILE)
CC = $(CROSS_COMPILE)gcc $(CPUCFLAGS)
AS = $(CROSS_COMPILE)as $(CPUCFLAGS)
CXX = $(CROSS_COMPILE)g++ $(CPUCFLAGS)
AR = $(CROSS_COMPILE)ar
LD = $(CROSS_COMPILE)ld $(CPULDFLAGS)
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
RANLIB = $(CROSS_COMPILE)ranlib
STRIPTOOL = $(CROSS_COMPILE)strip
STRIP = $(STRIPTOOL)
READELF = $(CROSS_COMPILE)readelf

when I cross compile FRR, I face a mixed configuration when it's time to compile hosttools, because CC, LD, etc. are referring to the host machine instead of native one.
So, my solution is to add following patch to configure.ac:

--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,13 @@
AC_CANONICAL_BUILD()
AC_CANONICAL_HOST()

+AC_ARG_VAR([AR],[archiver command])
+AC_ARG_VAR([LD],[linker command])
+AC_ARG_VAR([OBJCOPY],[objcopy command])
+AC_ARG_VAR([OBJDUMP],[objdump command])
+AC_ARG_VAR([RANLIB],[ranlib command])
+AC_ARG_VAR([STRIP],[strip command])
+
hosttools_clippy="false"
build_clippy="true"

and then add following variables to configure command line:

HOST_CC=gcc HOST_LD=ld HOST_AR=ar HOST_CXX=g++ HOST_OBJCOPY=objcopy HOST_OBJDUMP=objdump HOST_RANLIB=ranlib HOST_STRIP=strip

In this way hosttools configure correctly copies HOST_LD to LD, HOST_AR to AR, etc..
Before this change only HOST_CC was copied to CC, because it was the only one present in ac_precious_vars:

ac_precious_vars='build_alias
host_alias
target_alias
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP
CXX
CXXFLAGS
CCC
LUA
LUA_INCLUDE
LUA_LIB
CXXCPP
PYTHON_CFLAGS
PYTHON_LIBS
PYTHON
PROTOBUF_C_CFLAGS
PROTOBUF_C_LIBS
CARES_CFLAGS
CARES_LIBS
LIBYANG_CFLAGS
LIBYANG_LIBS
SQLITE3_CFLAGS
SQLITE3_LIBS
SYSREPO_CFLAGS
SYSREPO_LIBS
GRPC_CFLAGS
GRPC_LIBS
ZEROMQ_CFLAGS
ZEROMQ_LIBS
RTRLIB_CFLAGS
RTRLIB_LIBS
YACC
YFLAGS
UNWIND_CFLAGS
UNWIND_LIBS'

I hope that this can help and to have a feedback on my change. If it's the case I can push a patch.
Thanks
Ema

@nic1225
Copy link
Author

nic1225 commented Sep 24, 2020

hi @emabo

How do you set the configure parameter?

thanks
Nick

@emabo
Copy link
Contributor

emabo commented Sep 24, 2020

in the configure command line:

configure --sysconfdir=/var/tmp/shells --localstatedir=/tmp --sbindir=/usr/local/6bin --bindir=/usr/local/6bin --libdir=/lib --host=tilegx-redhat-linux --build=x86_64-linux-gnu --srcdir=/home/emanu/ports/frr/src --enable-user=root --enable-group=root --enable-vtysh --enable-multipath=4 --enable-capabilities --disable-irdp --disable-rtadv --disable-doc --disable-ripd --disable-ripngd --disable-isisd --disable-pimd --disable-babeld --disable-ospfclient --disable-eigrpd --disable-nhrpd --disable-rr-semantics CFLAGS="-O2 -fomit-frame-pointer -Dlinux -Dlinux -Dunix -DEMBED LIBS="-l6whas -lxml2 -lxt -lm" HOST_CC=gcc HOST_LD=ld HOST_AR=ar HOST_CXX=g++ HOST_OBJCOPY=objcopy HOST_OBJDUMP=objdump HOST_RANLIB=ranlib HOST_STRIP=strip

Ema

@nic1225
Copy link
Author

nic1225 commented Sep 24, 2020

hi @emabo

I've added the following to line 28 of the configure.ac file

AC_ARG_VAR([AR],[archiver command])
AC_ARG_VAR([LD],[linker command])
AC_ARG_VAR([OBJCOPY],[objcopy command])
AC_ARG_VAR([OBJDUMP],[objdump command])
AC_ARG_VAR([RANLIB],[ranlib command])
AC_ARG_VAR([STRIP],[strip command])

Use the following configure parameter

../configure --host=aarch64-linux-gnu 	--build=x86_64-linux-gnu 	HOST_CC=aarch64-linux-gnu-gcc 	HOST_CXX=aarch64-linux-gnu-g++ 	HOST_AR=aarch64-linux-gnu-ar 	HOST_LD=aarch64-linux-gnu-ld     CFLAGS="-Os -g -mcpu=cortex-a53 -mfpu=neon -funroll-all-loops --param max-inline-insns-auto=550 -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include/aarch64-linux-gnu"     LDFLAGS="-L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/local/lib -L$/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/lib/aarch64-linux-gnu -L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/lib"     --prefix=/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main     --localstatedir=/var/run/frr     --sysconfdir=/etc/frr/     --enable-multipath=1     --with-pkg-extra-version=-ctyun     --enable-sysrepo=yes 

Also try changing the a parameter to HOST_* to be the same as yours

HOST_CC=gcc 
HOST_LD=ld 
HOST_AR=ar 
HOST_CXX=g++ 
HOST_OBJCOPY=objcopy 
HOST_OBJDUMP=objdump 
HOST_RANLIB=ranlib 
HOST_STRIP=strip

Encountered the following log

The above user and group must have read/write access to the state file
directory and to the config files in the config file directory.
configure: ...
configure: ... cross-compilation: finished self-configuring for build platform tools
configure: ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for aarch64-linux-gnu-strip... aarch64-linux-gnu-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for perl... /usr/bin/perl
checking for aarch64-linux-gnu-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.9.0... yes
checking for aarch64-linux-gnu-gcc... aarch64-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/home/nick/nxp/flexbuild/packages/apps/frr/build':
configure: error: C compiler cannot create executables
See `config.log' for more details

In addition,Why is your cross-compiler gcc, not something like aarch64-linux-gnu-gcc, powerpc-fsl-linux-gcc and so on.

thanks
Nick

@emabo
Copy link
Contributor

emabo commented Sep 24, 2020

I think it's a bit confusing, but from what I understood from configure.ac, HOST_xx contains the local tools and flags needed for building hosttools:

configure:2996: checking build system type
configure:3010: result: x86_64-pc-linux-gnu
configure:3030: checking host system type
configure:3043: result: tilegx-redhat-linux-gnu
configure:3085: ...
configure:3087: ... cross-compilation: creating hosttools directory and self-configuring for build platform tools
configure:3089: ... use HOST_CPPFLAGS / HOST_CFLAGS / HOST_LDFLAGS if neccessary
configure:3091: ...
configure:3111: host unset build_alias
configure:3111: host unset host_alias
configure:3111: host unset target_alias
configure:3111: host unset PKG_CONFIG
configure:3111: host unset PKG_CONFIG_PATH
configure:3111: host unset PKG_CONFIG_LIBDIR
configure:3106: host CC='gcc'
configure:3111: host unset CFLAGS
configure:3111: host unset LDFLAGS
configure:3111: host unset LIBS
configure:3111: host unset CPPFLAGS
configure:3111: host unset CPP
configure:3111: host unset CXX

so, in my case CC=tile-gcc while HOST_CC=gcc.
If you already tried this option, I think you have a different problem in your configuration.
Probably, in my case I should have to open a new issue.

@lucize
Copy link
Contributor

lucize commented Sep 24, 2020

I again ask, did you tried with adding also --target?

and some output variables:

It was created by frr configure 7.4, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ ./configure --target=aarch64-openwrt-linux --host=aarch64-openwrt-linux --build=x86_64-pc-linux-gnu --program-prefix= --program-suffix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls --with-clippy=/home/build/staging/staging_dir/hostpkg/bin/clippy --prefix=/usr --enable-shared --disable-static --enable-user=network --enable-group=network --disable-ospfclient --disable-doc --disable-backtrace --localstatedir=/var/run/frr --sysconfdir=/etc/frr/ --with-crypto=openssl --disable-babeld --disable-bfdd --enable-bgpd --enable-eigrpd --disable-fabricd --disable-isisd --disable-ldpd --enable-nhrpd --enable-ospfd --disable-ospf6d --disable-pbrd --disable-pimd --enable-ripd --disable-ripngd --enable-staticd --disable-vrrpd --enable-vtysh --enable-zebra

Output variables.

AR='aarch64-openwrt-linux-musl-gcc-ar'
CC='aarch64-openwrt-linux-musl-gcc -std=gnu11'
CFLAGS='-Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/build/staging/build_dir/target-aarch64_generic_musl/frr-frr-7.4=frr-frr-7.4 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -flto  -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 '
CLIPPY='/home/build/staging/staging_dir/hostpkg/bin/clippy'
CONFIG_ARGS=''\''--target=aarch64-openwrt-linux'\'' '\''--host=aarch64-openwrt-linux'\'' '\''--build=x86_64-pc-linux-gnu'\'' '\''--program-prefix='\'' '\''--program-suffix='\'' '\''--exec-prefix=/usr'\'' '\''--bindir=/usr/bin'\'' '\''--sbindir=/usr/sbin'\'' '\''--libexecdir=/usr/lib'\'' '\''--sysconfdir=/etc'\'' '\''--datadir=/usr/share'\'' '\''--localstatedir=/var'\'' '\''--mandir=/usr/man'\'' '\''--infodir=/usr/info'\'' '\''--disable-nls'\'' '\''--with-clippy=/home/build/staging/staging_dir/hostpkg/bin/clippy'\'' '\''--prefix=/usr'\'' '\''--enable-shared'\'' '\''--disable-static'\'' '\''--enable-user=network'\'' '\''--enable-group=network'\'' '\''--disable-ospfclient'\'' '\''--disable-doc'\'' '\''--disable-backtrace'\'' '\''--localstatedir=/var/run/frr'\'' '\''--sysconfdir=/etc/frr/'\'' '\''--with-crypto=openssl'\'' '\''--disable-babeld'\'' '\''--disable-bfdd'\'' '\''--enable-bgpd'\'' '\''--enable-eigrpd'\'' '\''--disable-fabricd'\'' '\''--disable-isisd'\'' '\''--disable-ldpd'\'' '\''--enable-nhrpd'\'' '\''--enable-ospfd'\'' '\''--disable-ospf6d'\'' '\''--disable-pbrd'\'' '\''--disable-pimd'\'' '\''--enable-ripd'\'' '\''--disable-ripngd'\'' '\''--enable-staticd'\'' '\''--disable-vrrpd'\'' '\''--enable-vtysh'\'' '\''--enable-zebra'\'' '\''build_alias=x86_64-pc-linux-gnu'\'' '\''host_alias=aarch64-openwrt-linux'\'' '\''target_alias=aarch64-openwrt-linux'\'' '\''PKG_CONFIG=/home/build/staging/staging_dir/host/bin/pkg-config'\'' '\''PKG_CONFIG_PATH=/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/lib/pkgconfig:/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/share/pkgconfig'\'' '\''PKG_CONFIG_LIBDIR=/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/lib/pkgconfig:/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/share/pkgconfig'\'' '\''CC=aarch64-openwrt-linux-musl-gcc'\'' '\''CXX=aarch64-openwrt-linux-musl-g++'\'''
CPP='aarch64-openwrt-linux-musl-gcc -E'
CPPFLAGS='-I/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/include -I/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/usr/include -I/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/include/fortify -I/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/include '
CXX='aarch64-openwrt-linux-musl-g++'
CXXCPP='aarch64-openwrt-linux-musl-g++ -E'
CXXFLAGS='-Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/build/staging/build_dir/target-aarch64_generic_musl/frr-frr-7.4=frr-frr-7.4 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -flto '

LD='aarch64-openwrt-linux-musl-ld'
LDFLAGS='-L/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/lib -L/home/build/staging/staging_dir/target-aarch64_generic_musl/lib -L/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/usr/lib -L/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/lib -znow -zrelro -Wl,--gc-sections,--as-needed -latomic '
LIBS='-lresolv -lcrypt   -lcrypto -ljson-c -lrt'
NM='aarch64-openwrt-linux-musl-gcc-nm'
OBJCOPY='aarch64-openwrt-linux-musl-objcopy'
OBJDUMP='aarch64-openwrt-linux-musl-objdump'
PTHREAD_CC='aarch64-openwrt-linux-musl-gcc -std=gnu11'
RANLIB='aarch64-openwrt-linux-musl-gcc-ranlib -D'
STRIP='aarch64-openwrt-linux-musl-strip'
target_alias='aarch64-openwrt-linux'

@nic1225
Copy link
Author

nic1225 commented Sep 24, 2020

hi,lucize

Sorry for the late recovery, I just tried it, the problem remains the same

../configure --host=aarch64-linux-gnu --build=x86_64-linux-gnu --target=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ AR=aarch64-linux-gnu-ar LD=aarch64-linux-gnu-ld HOST_CC=gcc HOST_LD=ld HOST_AR=ar HOST_CXX=g++ HOST_OBJCOPY=objcopy HOST_OBJDUMP=objdump HOST_RANLIB=ranlib HOST_STRIP=strip CFLAGS="-Os -g -mcpu=cortex-a53 -mfpu=neon -funroll-all-loops --param max-inline-insns-auto=550 -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include/aarch64-linux-gnu" LDFLAGS="-L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/local/lib -L$/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/lib/aarch64-linux-gnu -L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/lib" HOST_CFLAGS="" HOST_LDFLAGS="" BUILD_CPPFLAGS="" --prefix=/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main --localstatedir=/var/run/frr --sysconfdir=/etc/frr/ --enable-multipath=1 --with-pkg-extra-version=-ctyun --enable-sysrepo=yes --enable-user=frr --enable-group=frr --enable-vty-group=frrvty --localstatedir=/var/run/frr --sysconfdir=/etc/frr/

FRRouting configuration
------------------------------
FRR version             : 7.3
host operating system   : linux-gnu
source code location    : /home/nick/nxp/flexbuild/packages/apps/frr
compiler                : gcc -std=gnu11
compiler flags          :  -g -O2 -fno-omit-frame-pointer -funwind-tables -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -pthread 
make                    : make
linker flags            :     -lrt -lcap  
state file directory    : /var/run
config file directory   : /usr/local/etc
example directory       : /usr/local/etc
module directory        : /usr/local/lib/frr/modules
user to run as          : frr
group to run as         : frr
group for vty sockets   : 
config file mask        : 0600
log file mask           : 0600
zebra protobuf enabled  : no

The above user and group must have read/write access to the state file
directory and to the config files in the config file directory.
configure: ...
configure: ... cross-compilation: finished self-configuring for build platform tools
configure: ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for aarch64-linux-gnu-strip... aarch64-linux-gnu-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for perl... /usr/bin/perl
checking for aarch64-linux-gnu-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.9.0... yes
checking for aarch64-linux-gnu-gcc... aarch64-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/home/nick/nxp/flexbuild/packages/apps/frr/build':
configure: error: C compiler cannot create executables

thanks
Nick

@lucize
Copy link
Contributor

lucize commented Sep 24, 2020

@nic1225 please try first native build of clippy only and then specify the clippy path and let's see

@lucize
Copy link
Contributor

lucize commented Sep 24, 2020

also look at specific variables aarch64-* that you didn't defined in the config

@nic1225
Copy link
Author

nic1225 commented Sep 24, 2020

I understand the steps are as follows
first, build clippy only
./configure --target=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --enable-clippy-only

FRRouting configuration
------------------------------
FRR version             : 7.3
host operating system   : linux-gnu
source code location    : .
compiler                : gcc -std=gnu11
compiler flags          :  -g -O2 -fno-omit-frame-pointer -funwind-tables -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -pthread 
make                    : make
linker flags            :     -lrt -lcap  
state file directory    : /var/run
config file directory   : /usr/local/etc
example directory       : /usr/local/etc
module directory        : /usr/local/lib/frr/modules
user to run as          : frr
group to run as         : frr
group for vty sockets   : 
config file mask        : 0600
log file mask           : 0600
zebra protobuf enabled  : no

The above user and group must have read/write access to the state file
directory and to the config files in the config file directory.

and then, cross-compilation with clippy path

./configure --target=aarch64-linux-gnu --host=aarch64-linux-gnu --build=x86_64-linux-gnu CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ AR=aarch64-linux-gnu-ar LD=aarch64-linux-gnu-ld CFLAGS="-Os -g -mcpu=cortex-a53 -mfpu=neon -funroll-all-loops --param max-inline-insns-auto=550 -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include/aarch64-linux-gnu" LDFLAGS="-L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/local/lib -L$/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/lib/aarch64-linux-gnu -L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/lib" --prefix=/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main --localstatedir=/var/run/frr --sysconfdir=/etc/frr/ --enable-multipath=1 --with-pkg-extra-version=-ctyun --enable-sysrepo=yes --enable-user=frr --enable-group=frr --enable-vty-group=frrvty --localstatedir=/var/run/frr --sysconfdir=/etc/frr/ --with-clippy=./build

log as follow:

checking build system type... x86_64-pc-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for aarch64-linux-gnu-strip... aarch64-linux-gnu-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for perl... /usr/bin/perl
checking for aarch64-linux-gnu-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.9.0... yes
checking for aarch64-linux-gnu-gcc... aarch64-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/home/nick/nxp/flexbuild/packages/apps/frr':
configure: error: C compiler cannot create executables
See `config.log' for more details

thanks
Nick

@lucize
Copy link
Contributor

lucize commented Sep 24, 2020

./configure --enable-clippy-only
make (build), it will take a while because configure.ac builds everything even if clippy-only is selected
..
then cross compile, your cflags are not ok, if you look at my output variables the includes are added to cppflags and clippy path is the full path to the bin object
here is a paste with all variables added before ./configure


 AR="aarch64-openwrt-linux-musl-gcc-ar" AS="aarch64-openwrt-linux-musl-gcc -c -Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/build/staging/build_dir/target-aarch64_generic_musl/frr-frr-7.4=frr-frr-7.4 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -flto" LD=aarch64-openwrt-linux-musl-ld NM="aarch64-openwrt-linux-musl-gcc-nm" CC="aarch64-openwrt-linux-musl-gcc" GCC="aarch64-openwrt-linux-musl-gcc" CXX="aarch64-openwrt-linux-musl-g++" RANLIB="aarch64-openwrt-linux-musl-gcc-ranlib" STRIP=aarch64-openwrt-linux-musl-strip OBJCOPY=aarch64-openwrt-linux-musl-objcopy OBJDUMP=aarch64-openwrt-linux-musl-objdump SIZE=aarch64-openwrt-linux-musl-size CFLAGS="-Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/build/staging/build_dir/target-aarch64_generic_musl/frr-frr-7.4=frr-frr-7.4 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -flto " CXXFLAGS="-Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/build/staging/build_dir/target-aarch64_generic_musl/frr-frr-7.4=frr-frr-7.4 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -flto " CPPFLAGS="-I/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/include -I/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/usr/include -I/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/include/fortify -I/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/include " LDFLAGS="-L/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/lib -L/home/build/staging/staging_dir/target-aarch64_generic_musl/lib -L/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/usr/lib -L/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/lib -znow -zrelro -Wl,--gc-sections,--as-needed -latomic "   ./configure --target=aarch64-openwrt-linux --host=aarch64-openwrt-linux --build=x86_64-pc-linux-gnu (and the rest options)


checking build system type... x86_64-pc-linux-gnu
checking host system type... aarch64-openwrt-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for aarch64-openwrt-linux-strip... aarch64-openwrt-linux-musl-strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for perl... /home/build/staging/staging_dir/host/bin/perl
checking pkg-config is at least version 0.9.0... yes
checking for aarch64-openwrt-linux-gcc... aarch64-openwrt-linux-musl-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
...

FRRouting configuration
------------------------------
FRR version             : 7.4
host operating system   : linux-gnu
source code location    : .
compiler                : aarch64-openwrt-linux-musl-gcc -std=gnu11
compiler flags          : -Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/build/staging/build_dir/target-aarch64_generic_musl/frr-frr-7.4=frr-frr-7.4 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -flto  -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
make                    : make
linker flags            : -L/home/build/staging/staging_dir/target-aarch64_generic_musl/usr/lib -L/home/build/staging/staging_dir/target-aarch64_generic_musl/lib -L/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/usr/lib -L/home/build/staging/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/lib -znow -zrelro -Wl,--gc-sections,--as-needed -latomic   -lresolv -lcrypt   -lcrypto -ljson-c -lrt -lcap -lreadline
state file directory    : /var/run/frr
config file directory   : /etc/frr
example directory       : /etc/frr
module directory        : /usr/lib/frr/modules
user to run as          : network
group to run as         : network
group for vty sockets   :
config file mask        : 0600
log file mask           : 0600

@nic1225
Copy link
Author

nic1225 commented Sep 25, 2020

hi,lucize
Your suggestion is correct. With the modification of CFLAGS, it can continue to go down, but new libjson problem have been encountered

 ./configure --enable-clippy-only
./configure --target=aarch64-ubuntu-linux --host=aarch64-ubuntu-linux --build=x86_64-pc-linux-gnu AR=aarch64-linux-gnu-ar  AS=aarch64-linux-gnu-as LD=aarch64-linux-gnu-ld NM=aarch64-linux-gnu-nm CC=aarch64-linux-gnu-gcc  CXX=aarch64-linux-gnu-g++ RANLIB=aarch64-linux-gnu-ranlib STRIP=aarch64-linux-gnu-strip  CFLAGS="-Os -g -mcpu=cortex-a53 -funroll-all-loops --param max-inline-insns-auto=550 -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include -I/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/include/aarch64-linux-gnu" LDFLAGS="-L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/local/lib -L$/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/lib/aarch64-linux-gnu -L/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main/usr/lib"  --prefix=/home/nick/nxp/flexbuild/build/rfs/rootfs_lsdk1909_LS_arm64_main  --enable-multipath=1 --with-pkg-extra-version=-ctyun --enable-sysrepo=yes --with-clippy=./build

libjson failed as follow:

checking build system type... x86_64-pc-linux-gnu
checking host system type... aarch64-ubuntu-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for aarch64-ubuntu-linux-strip... aarch64-linux-gnu-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for perl... /usr/bin/perl
checking for aarch64-ubuntu-linux-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.9.0... yes
checking for aarch64-ubuntu-linux-gcc... aarch64-linux-gnu-gcc
checking whether the C compiler works... yes

... ... Omit most normal printing
checking whether aarch64-linux-gnu-ranlib supports D option... yes
checking json-c/json.h usability... yes
checking json-c/json.h presence... yes
checking for json-c/json.h... yes
checking for json_object_get in -ljson-c... no
checking for json_object_get in -ljson... no
configure: error: libjson is needed to compile

thanks
Nick

@lucize
Copy link
Contributor

lucize commented Sep 25, 2020

the problem could be that you also need the dependencies to be compiled for aarch64, might I ask what is the board? can't it be used with openwrt sdk as there is already a layerscape target working ?
or maybe just use de precompiled packages if your musl version is compatible

@nic1225
Copy link
Author

nic1225 commented Sep 25, 2020

This is a 4 core armv8 development board running Ubuntu18.04 version.It can also run Openwrt, but we're going to use its Ubuntu system for now.

@lucize
Copy link
Contributor

lucize commented Sep 25, 2020

ok, so on openwrt I added this crosscompiled dependencies, depending on config:
librt libatomic libcap libjson-c libyang libopenssl libnetsnmp libreadline libncurses more libcares all are available on the sdk include folders

@nic1225 nic1225 closed this as completed Sep 25, 2020
@nic1225 nic1225 reopened this Sep 25, 2020
@nic1225
Copy link
Author

nic1225 commented Sep 25, 2020

hi,@lucize
after configure ,I run the command make

CLIPPY   bgpd/bgp_debug_clippy.c
/bin/bash: ./build: Is a directory
Makefile:9695: recipe for target 'bgpd/bgp_debug_clippy.c' failed
make[1]: *** [bgpd/bgp_debug_clippy.c] Error 126
make[1]: Leaving directory '/home/nick/nxp/flexbuild/packages/apps/frr'
Makefile:4060: recipe for target 'all' failed
make: *** [all] Error 2

Does this have something to do with the fact that I was executing ./configure with --with-clippy=./build, so what is the correct procedure?

./configure --enable-clippy-only
./configure ... --with-clippy=./build

thanks
Nick

@lucize
Copy link
Contributor

lucize commented Sep 25, 2020

--with-clippy=/home/build/staging/staging_dir/hostpkg/bin/clippy

I already told you that you have to add the path of the clippy binary
you build the native clippy and in another folder you build the cross compile (not a sub folder) specifying the full path to your other native folder with clippy

@nic1225
Copy link
Author

nic1225 commented Sep 28, 2020

hi,@lucize
When I execute the make command, I have the following problem,libyang is 1.0.184 version and it is normal during compilation of other modules.

  CC       pimd/mtracebis_netlink.o
  CC       pimd/mtracebis_routeget.o
  CCLD     pimd/mtracebis
lib/.libs/libfrr.so: undefined reference to `cap_to_text'
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 `cap_get_flag'
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 `cap_set_proc'
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 `cap_init'
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 `cap_get_proc'
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 `cap_clear'
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 `cap_free'
lib/.libs/libfrr.so: undefined reference to `cap_set_flag'
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:5730: recipe for target 'pimd/mtracebis' failed
make[1]: *** [pimd/mtracebis] Error 1
make[1]: Leaving directory '/home/nick/nxp/flexbuild/packages/apps/frr/build'
Makefile:4060: recipe for target 'all' failed
make: *** [all] Error 2

Could you send out the makefile file after execute configure, and I'll compare it to mine,Check to see if LIBRARY_PATH is assigned

thanks
Nick

@lucize
Copy link
Contributor

lucize commented Sep 28, 2020

libyang is built in a subfolder with

CMAKE_OPTIONS +=
-DENABLE_LYD_PRIV:BOOL=ON
-DCMAKE_BUILD_TYPE:String="Release"
-DGEN_LANGUAGE_BINDINGS=ON
-DGEN_PYTHON_BINDINGS=OFF

Makefile_libyang.txt
Makefile_frr.txt

@hothotstreet
Copy link

I encountered this error when cross-compiling FRR8.2. I installed the library during cross-compiling, but it was not found.

checking for openat... yes
checking for unlinkat... yes
checking for posix_fallocate... yes
checking for sendmmsg... yes
checking for struct mmsghdr.msg_hdr... yes
checking for main in -lreadline... no
checking for library containing tputs... no
configure: error: libreadline (needed for vtysh) not found and/or missing dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues with the build platform Issue in a specific platform
Projects
None yet
Development

No branches or pull requests

6 participants