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

Crosscompile master on LEDE/Openwrt #958

Closed
lucize opened this issue Aug 11, 2017 · 41 comments
Closed

Crosscompile master on LEDE/Openwrt #958

lucize opened this issue Aug 11, 2017 · 41 comments
Assignees

Comments

@lucize
Copy link
Contributor

lucize commented Aug 11, 2017

version 2 worked without problems no needed to manually pass anything to configure related to target arch, but now I'm trying to update and the first issue was with
configure: error: cross-compilation is only possible with builddir separate from srcdir. create a separate directory and run as .../path-to-frr/configure.
made a dir and ran configure from that dir passing --host="$(GNU_TARGET_NAME)" HOST_CPPFLAGS="$(TARGET_CPPLAGS)" HOST_CFLAGS="$(TARGET_CFLAGS)" HOST_LDFLAGS="$(TARGET_LDFLAGS)"
and all other options
the hosttools log is telling me this:

configure:4069: checking for C compiler default output file name
configure:4071: result: a.out
configure:4077: checking for suffix of executables
configure:4084: x86_64-openwrt-linux-musl-gcc -o conftest -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-var
iable -Wno-error=unused-result -iremap/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1:frr-3.1 -Wformat -Werror=format-security -fst
ack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -L/home/build/x86_64/staging_dir/target-x86_64_musl/usr/lib -L/home/build/x86_64
/staging_dir/target-x86_64_musl/lib -L/home/build/x86_64/staging_dir/toolchain-x86_64_gcc-5.4.0_musl/usr/lib -L/home/build/x86_64/staging_d
ir/toolchain-x86_64_gcc-5.4.0_musl/lib -znow -zrelro conftest.c  >&5
configure:4088: $? = 0
configure:4110: result:
configure:4132: checking whether we are cross compiling
configure:4140: x86_64-openwrt-linux-musl-gcc -o conftest -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-var
iable -Wno-error=unused-result -iremap/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1:frr-3.1 -Wformat -Werror=format-security -fst
ack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -L/home/build/x86_64/staging_dir/target-x86_64_musl/usr/lib -L/home/build/x86_64
/staging_dir/target-x86_64_musl/lib -L/home/build/x86_64/staging_dir/toolchain-x86_64_gcc-5.4.0_musl/usr/lib -L/home/build/x86_64/staging_d
ir/toolchain-x86_64_gcc-5.4.0_musl/lib -znow -zrelro conftest.c  >&5
configure:4144: $? = 0
configure:4151: ./conftest
/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1/configure: line 4153: ./conftest: No such file or directory
configure:4155: $? = 127
configure:4162: error: in `/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1/build/hosttools':
configure:4164: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

but if I patch the configure.ac with the --host at hosttools configure, it will enter in a loop and create subdirectories until is stopped.

then the configure ends with:

FRRouting configuration
------------------------------
FRR version             : 3.1-dev
host operating system   : linux-gnu
source code location    : ..
compiler                : x86_64-openwrt-linux-musl-gcc -std=gnu11
compiler flags          :  -g -Os -fno-omit-frame-pointer -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers
make                    : make
linker flags            :  -rdynamic -lresolv -lcrypt   -ljson-c -lrt  -lreadline  -lncurses -lm
state file directory    : /var/run/frr
config file directory   : /etc/frr
example directory       : /etc/frr
module directory        : /usr/local/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
zebra protobuf enabled  : no

then the compile is starting but ends with

  CC       lib/pid_output.lo
cc1: note: someone does not honour COPTS correctly, passed 0 times
make[5]: *** No rule to make target 'hosttools/lib/clippy', needed by 'lib/plist_clippy.c'.  Stop.
make[5]: Leaving directory '/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1/build'
Makefile:1954: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1/build'
Makefile:973: recipe for target 'all' failed
make[3]: *** [all] Error 2

what option do I have to use with this ?

Regards

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

HOST_CPPFLAGS="$(TARGET_CPPLAGS)"
HOST_CFLAGS="$(TARGET_CFLAGS)"
HOST_LDFLAGS="$(TARGET_LDFLAGS)"

This are the wrong way around, the HOST_* variables are used for building on the build host. I should probably rename them to BUILD_* to match the autoconf naming scheme.

=>
CFLAGS="${TARGET_CFLAGS}"
HOST_CFLAGS="${BUILD_CFLAGS}"

HOST_* is used to compile auxiliary tools that are executed as compiler-like tools during the build process.

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

adding

CFLAGS="$(TARGET_CFLAGS)"
HOST_CFLAGS="$(BUILD_CFLAGS)"

cc will not complain anymore about cc1: note: someone does not honour COPTS correctly, passed 0 times

the config is like this:

define Build/Configure
    ( cd $(PKG_BUILD_DIR)/ ; \
    mkdir build/ ; \
    cd build ; \
    $(TARGET_CONFIGURE_OPTS) \
    ../configure \
        --host="$(GNU_TARGET_NAME)" \
        CFLAGS="$(TARGET_CFLAGS)" \
        HOST_CFLAGS="$(BUILD_CFLAGS)" \
        BUILD_CPPFLAGS="$(TARGET_CPPLAGS)" \
        BUILD_CFLAGS="$(TARGET_CFLAGS)" \
        BUILD_LDFLAGS="$(TARGET_LDFLAGS)" \
        --localstatedir=/var/run/frr \
        --sysconfdir=/etc/frr/ \
        --enable-shared \
        --disable-static \
        --enable-user=network \
        --enable-group=network \
        --enable-multipath=8 \
        --disable-ospfclient \
        --disable-capabilities \
        --disable-doc \
        $(call autoconf_bool,CONFIG_PACKAGE_frr-libfrr,zebra) \
        $(call autoconf_bool,CONFIG_PACKAGE_frr-bgpd,bgpd) \
        $(call autoconf_bool,CONFIG_PACKAGE_frr-eigrpd,eigrpd) \
        $(call autoconf_bool,CONFIG_PACKAGE_frr-isisd,isisd) \
        $(call autoconf_bool,CONFIG_PACKAGE_frr-nhrpd,nhrpd) \
        $(call autoconf_bool,CONFIG_PACKAGE_frr-ospfd,ospfd) \
        $(call autoconf_bool,CONFIG_PACKAGE_frr-ospf6d,ospf6d) \
        $(call autoconf_bool,CONFIG_PACKAGE_frr-ripd,ripd) \
        $(call autoconf_bool,CONFIG_PACKAGE_frr-ripngd,ripngd) \
        $(call autoconf_bool,CONFIG_PACKAGE_frr-vtysh,vtysh) \
)
endef

but the hosttools keep complaining

touch /home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1/.prepared_661d2b975768acdc4d474a8dc45d0973_6664517399ebbbc92a37c5bb081b5c53
rm -f /home/build/x86_64/staging_dir/target-x86_64_musl/stamp/.frr_installed
(cd /home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1; rm -f aclocal.m4; if [ -f ./configure.ac ] || [ -f ./configure.in ]; then [ -d ./autom4te.cach/home/build/x86_64/scripts/config.rpath ./config.rpath; touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; AUTOM4TE=/home/build/x86_64/staging_dir/host/bin/auonf AUTOMAKE=/home/build/x86_64/staging_dir/host/bin/automake ACLOCAL=/home/build/x86_64/staging_dir/host/bin/aclocal AUTOHEADER=/home/build/x86_64/stagingg_dir/host/bin/libtoolize LIBTOOL=/home/build/x86_64/staging_dir/host/bin/libtool M4=/home/build/x86_64/staging_dir/host/bin/m4 AUTOPOINT=true /home/build/uild/x86_64/staging_dir/host/share/aclocal -I /home/build/x86_64/staging_dir/target-x86_64_musl/host/share/aclocal -I /home/build/x86_64/staging_dir/hostpk64_musl/usr/share/aclocal -I m4 -I . . || true; fi; );
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: /home/build/x86_64/staging_dir/host/bin/aclocal -I /home/build/x86_64/staging_dir/target-x86_64_musl/host/share/aclocal -I /home/build64/staging_dir/target-x86_64_musl/usr/share/aclocal -I m4 -I . --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: /home/build/x86_64/staging_dir/host/bin/libtoolize --force
OpenWrt-libtoolize: putting auxiliary files in `.'.
OpenWrt-libtoolize: linking file `./ltmain.sh'
OpenWrt-libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
OpenWrt-libtoolize: linking file `m4/libtool.m4'
OpenWrt-libtoolize: linking file `m4/ltoptions.m4'
OpenWrt-libtoolize: linking file `m4/ltsugar.m4'
OpenWrt-libtoolize: linking file `m4/ltversion.m4'
OpenWrt-libtoolize: linking file `m4/lt~obsolete.m4'
autoreconf: running: /home/build/x86_64/staging_dir/host/bin/autoconf --include=/home/build/x86_64/staging_dir/target-x86_64_musl/host/share/aclocal --inclclude=/home/build/x86_64/staging_dir/target-x86_64_musl/usr/share/aclocal --include=m4 --include=. --prepend-include=/home/build/x86_64/staging_dir/host/sh
autoreconf: running: /home/build/x86_64/staging_dir/host/bin/autoheader --include=/home/build/x86_64/staging_dir/target-x86_64_musl/host/share/aclocal --ininclude=/home/build/x86_64/staging_dir/target-x86_64_musl/usr/share/aclocal --include=m4 --include=. --prepend-include=/home/build/x86_64/staging_dir/host/
autoreconf: running: /home/build/x86_64/staging_dir/host/bin/automake --add-missing --force-missing
configure.ac:114: installing './compile'
configure.ac:24: installing './config.guess'
configure.ac:24: installing './config.sub'
configure.ac:59: installing './install-sh'
configure.ac:59: installing './missing'
Makefile.am: installing './INSTALL'
Makefile.am: installing './depcomp'
configure.ac: installing './ylwrap'
doc/Makefile.am:51: installing 'doc/mdate-sh'
doc/Makefile.am:51: installing 'doc/texinfo.tex'
autoreconf: Leaving directory `.'
( cd /home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1/ ; mkdir build/ ; cd build ; AR="x86_64-openwrt-linux-musl-gcc-ar" AS="x86_64-openwrt-linux-mu -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1:frr-3.1 -Wformat -Werror=formatl,-z,relro" LD=x86_64-openwrt-linux-musl-ld NM="x86_64-openwrt-linux-musl-gcc-nm" CC="x86_64-openwrt-linux-musl-gcc" GCC="x86_64-openwrt-linux-musl-gcc" CXx-musl-gcc-ranlib" STRIP=x86_64-openwrt-linux-musl-strip OBJCOPY=x86_64-openwrt-linux-musl-objcopy OBJDUMP=x86_64-openwrt-linux-musl-objdump SIZE=x86_64-opux" CFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap/home/build/x86_64/buildat-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" HOST_CFLAGS="" BUILD_CPPFLAGS="" BUILD_CFLAGS="-Os -pipe -fno-caller-saves -fno-ror=unused-result -iremap/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1:frr-3.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOUR6_64/staging_dir/target-x86_64_musl/usr/lib -L/home/build/x86_64/staging_dir/target-x86_64_musl/lib -L/home/build/x86_64/staging_dir/toolchain-x86_64_gcc-5x86_64_gcc-5.4.0_musl/lib -znow -zrelro" --localstatedir=/var/run/frr --sysconfdir=/etc/frr/ --enable-shared --disable-static --enable-user=network --enablisable-capabilities --disable-doc --enable-zebra --enable-bgpd --enable-eigrpd --enable-isisd --enable-nhrpd --enable-ospfd --enable-ospf6d --enable-ripd -
configure: loading site script /home/build/x86_64/include/site/x86_64
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-openwrt-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: ...
configure: loading site script /home/build/x86_64/include/site/x86_64
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-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
checking whether make supports nested variables... (cached) yes
checking for perl... /home/build/x86_64/staging_dir/host/bin/perl
checking pkg-config is at least version 0.9.0... yes
checking for x86_64-pc-linux-gnu-gcc... x86_64-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... configure: error: in `/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1/build/hosttools':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
configure: ...
configure: ... cross-compilation: finished self-configuring for build platform tools
configure: ...

should I look int to configure.ac ?

  ( CPPFLAGS="$HOST_CPPFLAGS"; \
    CFLAGS="$HOST_CFLAGS"; \
    LDFLAGS="$HOST_LDFLAGS"; \
    cd hosttools; "${abssrc}/configure" "--host=$build" "--build=$build"; )

  AC_MSG_NOTICE([...])
  AC_MSG_NOTICE([... cross-compilation: finished self-configuring for build platform tools])
  AC_MSG_NOTICE([...])

  build_clippy="false"
  HOSTTOOLS="hosttools/"
], [
  build_clippy="true"
  HOSTTOOLS=""

do I need build_clippy ? because this one is failing

regards

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

Yes, you need clippy. Can you post hosttools/config.log?

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

it's probably using the wrong C compiler:

checking for x86_64-pc-linux-gnu-gcc... x86_64-openwrt-linux-musl-gcc

unless the system you are compiling on is actually amd64 openwrt?

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

try un-setting the CC environment variable before running configure

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

I'm compiling on x86_64 for x86_64 musl
attached the build/config.log and build/hosttools/config.log

buil-config.log.txt
hosttools.config.log.txt

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

ok, it's mixing up the CC for the 2 different targets

frr

  • target = x86_64-openwrt-musl
  • CC = x86_64-openwrt-linux-musl-gcc
  • CFLAGS, LDFLAGS = whatever OpenWRT needs

frr/hosttools

  • target = x86_64-glibc
  • CC = x86_64-pc-linux-gnu-gcc
  • CFLAGS, LDFLAGS = NOT OpenWRT, just normal

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

yes, but from where should I control the hosttools ? configure is doing it, should configure.ac be patched somehow ?

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

i think the bug is that i forgot CC in configure.ac line 40

=> this is why i said "try un-setting the CC variable"

if you don't have the CC variable set, it should auto-detect the correct compiler to use
(i'll post a patch to fix this)

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

it should work with this:

define Build/Configure
    ( cd $(PKG_BUILD_DIR)/ ; \
    mkdir build/ ; \
    cd build ; \
    $(TARGET_CONFIGURE_OPTS) \
    CC="" ../configure \

(note the CC="")

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

no is failing at

conftest.c:11:28: fatal error: ac_nonexistent.h: No such file or directory
 #include <ac_nonexistent.h> 

hosttools.config.log.txt

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

no, it isn't, that's a normal autoconf test.

please try with CC="" and report back

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

actually... it's failing because you don't have a json library installed

configure:14556: checking for json_object_get in -ljson
configure:14581: gcc -std=gnu11 -o conftest  -g -Os -fno-omit-frame-pointer -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -pthread   -rdynamic conftest.c -ljson    >&5
/usr/bin/ld: cannot find -ljson

...

configure:14590: result: no
configure:14597: error: lib json is needed to compile

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

yes I tried the CC=""
the on screen configure log is better
but, can't use the json from the build environment ?

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

I see it now

checking for json-c/json.h... no
checking for json_object_get in -ljson-c... no
checking for json_object_get in -ljson... no
configure: error: lib json is needed to compile
configure: ...

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

there's no way I can point the location for that ?
the crossconfig is finding it

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

actually... json isn't even needed in hosttools :( ... it's just running the same checks... this is a bit of a mess >_>

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

it's trying to find json from the host because it is compiling a tool for the host, so json for openwrt-musl doesn't help...

you could try this:

diff --git a/configure.ac b/configure.ac
index d501c4449..51a0f6c07 100755
--- a/configure.ac
+++ b/configure.ac
@@ -40,7 +40,7 @@ AS_IF([test "$host" != "$build"], [
   ( CPPFLAGS="$HOST_CPPFLAGS"; \
     CFLAGS="$HOST_CFLAGS"; \
     LDFLAGS="$HOST_LDFLAGS"; \
-    cd hosttools; "${abssrc}/configure" "--host=$build" "--build=$build"; )
+    cd hosttools; "${abssrc}/configure" "--host=$build" "--build=$build" "--enable-clippy-only"; )
 
   AC_MSG_NOTICE([...])
   AC_MSG_NOTICE([... cross-compilation: finished self-configuring for build platform tools])
@@ -375,7 +375,10 @@ AC_ARG_ENABLE([protobuf],
   AS_HELP_STRING([--enable-protobuf], [Enable experimental protobuf support]))
 AC_ARG_ENABLE([oldvpn_commands],
   AS_HELP_STRING([--enable-oldvpn-commands], [Keep old vpn commands]))
+AC_ARG_ENABLE([clippy-only],
+  AS_HELP_STRING([--enable-clippy-only], [Only build clippy]))
 
+AS_IF([test "${enable_clippy_only}" != "yes"], [
 AC_CHECK_HEADERS(json-c/json.h)
 AC_CHECK_LIB(json-c, json_object_get, LIBS="$LIBS -ljson-c", [], [-lm])
 if test $ac_cv_lib_json_c_json_object_get = no; then
@@ -384,6 +387,7 @@ if test $ac_cv_lib_json_c_json_object_get = no; then
       AC_MSG_ERROR([lib json is needed to compile])
   fi
 fi
+])
 
 AC_ARG_ENABLE([dev_build],
     AS_HELP_STRING([--enable-dev-build], [build for development]))

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

progress :)

configure: error: could not find python-config or pkg-config python, please install Python development files from libpython-dev or similar
the host has only the minimal tools installed i'm not sure if the buildbots have or not the libpython-dev installed

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

libpython-dev is needed on the host... FRR uses a custom mixed python+C tool to pre-process source files

best thing to do here is probably include the output from this preprocessing, so you don't have to run it... i can work on that, but that's not gonna be done today :/

(you do not need libpython-dev on the OpenWRT target, it's only used during compile...)

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

btw, the 3.0-rc1 release does not have this yet, so it should still work...

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

installed libpython-dev on the host but is still complaining
the hosttools:

checking for x86_64-pc-linux-gnu-python3-config... no
checking for x86_64-pc-linux-gnu-python-config... no
checking for x86_64-pc-linux-gnu-python2-config... no
checking for python3-config... no
checking for python-config... no
checking for python2-config... no
checking for PYTHON... no
checking for PYTHON... no
checking for PYTHON... no
checking for PYTHON... no
checking for PYTHON... no
configure: error: in `/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.1/build/hosttools':
configure: error: could not find python-config or pkg-config python, please install Python development files from libpython-dev or similar

the build-config doesn't ask for it

I was looking to test eigrp more, on x86 and mips

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

hrm, can you post the hosttools/config.log again? not sure why it's not finding libpython-dev there...

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

sure
hosttools.config.log.txt

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

The following additional packages will be installed:
  libexpat1-dev libpython2.7 libpython2.7-dev
The following NEW packages will be installed:
  libexpat1-dev libpython-dev libpython2.7 libpython2.7-dev
0 upgraded, 4 newly installed, 0 to remove and 2 not upgraded.
Need to get 29.4 MB of archives.
After this operation, 46.2 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ro.archive.ubuntu.com/ubuntu zesty-updates/main amd64 libexpat1-dev amd64 2.2.0-2ubuntu0.1 [122 kB]
Get:2 http://ro.archive.ubuntu.com/ubuntu zesty/main amd64 libpython2.7 amd64 2.7.13-2 [1,072 kB]
Get:3 http://ro.archive.ubuntu.com/ubuntu zesty/main amd64 libpython2.7-dev amd64 2.7.13-2 [28.2 MB]
Get:4 http://ro.archive.ubuntu.com/ubuntu zesty/main amd64 libpython-dev amd64 2.7.13-2 [7,842 B]
Fetched 29.4 MB in 2s (11.1 MB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database ... 138838 files and directories currently installed.)
Preparing to unpack .../libexpat1-dev_2.2.0-2ubuntu0.1_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.0-2ubuntu0.1) ...
Selecting previously unselected package libpython2.7:amd64.
Preparing to unpack .../libpython2.7_2.7.13-2_amd64.deb ...
Unpacking libpython2.7:amd64 (2.7.13-2) ...
Selecting previously unselected package libpython2.7-dev:amd64.
Preparing to unpack .../libpython2.7-dev_2.7.13-2_amd64.deb ...
Unpacking libpython2.7-dev:amd64 (2.7.13-2) ...
Selecting previously unselected package libpython-dev:amd64.
Preparing to unpack .../libpython-dev_2.7.13-2_amd64.deb ...
Unpacking libpython-dev:amd64 (2.7.13-2) ...
Processing triggers for libc-bin (2.24-9ubuntu2.2) ...
Setting up libpython2.7:amd64 (2.7.13-2) ...
Setting up libexpat1-dev:amd64 (2.2.0-2ubuntu0.1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up libpython2.7-dev:amd64 (2.7.13-2) ...
Setting up libpython-dev:amd64 (2.7.13-2) ...
Processing triggers for libc-bin (2.24-9ubuntu2.2) ...

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

argh, the problem is 3 more variables:

  • PKG_CONFIG_LIBDIR
  • PKG_CONFIG_PATH
  • PKG_CONFIG
    you could try setting all 3 to "" like CC

(i probably need to rework the entire "hosttools" thing...)

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017


    $(TARGET_CONFIGURE_OPTS) \
    CC="" PKG_CONFIG_LIBDIR="" \
    PKG_CONFIG_PATH="" PKG_CONFIG="" \
    ../configure \

it is failing again but with those unset build config will not find the

checking for CARES... no
configure: error: trying to build nhrpd, but libcares not found. install c-ares and its -dev headers.

anyway is better than yesterday when I wasn't sure about how to make the package and erased checks from configure.ac

hosttools.config.log.txt

@eqvinox
Copy link
Contributor

eqvinox commented Aug 11, 2017

sorry for the delay, had to get some other stuff done...

another change for configure.ac:

diff --git a/configure.ac b/configure.ac
index 51a0f6c07..e3f71e418 100755
--- a/configure.ac
+++ b/configure.ac
@@ -40,7 +40,7 @@ AS_IF([test "$host" != "$build"], [
   ( CPPFLAGS="$HOST_CPPFLAGS"; \
     CFLAGS="$HOST_CFLAGS"; \
     LDFLAGS="$HOST_LDFLAGS"; \
-    cd hosttools; "${abssrc}/configure" "--host=$build" "--build=$build" "--enable-clippy-only"; )
+    cd hosttools; "${abssrc}/configure" "--host=$build" "--build=$build" "--enable-clippy-only" "--disable-nhrpd"; )
 
   AC_MSG_NOTICE([...])
   AC_MSG_NOTICE([... cross-compilation: finished self-configuring for build platform tools])

(because c-ares is only needed for nhrpd... so it can be disabled for hosttools)

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

sorry, I didn't wrote clearer, python is failing for hosttools and cares for general build, not hosttools. If I unset any one of the PKG_CONFIG or PKG_CONFIG_PATH it would fail with checking for CARES... no
python is not found in either way

@lucize
Copy link
Contributor Author

lucize commented Aug 11, 2017

I tried a make on 3.0-rc1 c47b10c and is failing at:

Making all in zebra
make[5]: Entering directory '/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.0-rc1/zebra'
  CC       if_netlink.o
  CCLD     testzebra
In file included from /home/build/x86_64/staging_dir/toolchain-x86_64_gcc-5.4.0_musl/include/net/ethernet.h:10:0,
                 from ../lib/prefix.h:30,
                 from if_netlink.c:31:
/home/build/x86_64/staging_dir/toolchain-x86_64_gcc-5.4.0_musl/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr'
 struct ethhdr {
        ^
In file included from /home/build/x86_64/staging_dir/toolchain-x86_64_gcc-5.4.0_musl/include/linux/ethtool.h:18:0,
                 from if_netlink.c:26:
/home/build/x86_64/staging_dir/toolchain-x86_64_gcc-5.4.0_musl/include/linux/if_ether.h:143:8: note: originally defined here
 struct ethhdr {
        ^
Makefile:748: recipe for target 'if_netlink.o' failed
make[5]: *** [if_netlink.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: Leaving directory '/home/build/x86_64/build_dir/target-x86_64_musl/frr-3.0-rc1/zebra'
Makefile:492: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1

Regards

@mwinter-osr
Copy link
Member

@lucize Not sure how far you are involved in OpenWRT, but would be interested to work with you on getting OpenWRT added to the CI system ( https://ci1.netdef.org ) after this is all resolved (and would welcome some doc about building it on OpenWRT and/or LEDE to be included in the git)

@lucize
Copy link
Contributor Author

lucize commented Aug 12, 2017

@mwinter-osr I will gladly help!
Building it would be straightforward like any other packet on OpenWRT/LEDE: here
Anyway, once accepted in master it will be built by buildbots and available from snapshots or future releases, of course I'm speaking about the release version.
I could make a copy paste instruction on how to prepare the build environment
Regards

@lucize
Copy link
Contributor Author

lucize commented Aug 13, 2017

on 3.0-rc1, this fixes zebra/if_netlink.c

--- a/zebra/if_netlink.c        2017-08-13 04:59:26.779456946 +0300
+++ b/zebra/if_netlink.c        2017-08-13 05:00:14.856453707 +0300
@@ -22,6 +22,7 @@

 #include <zebra.h>
 #include <net/if_arp.h>
+#include <net/ethernet.h>
 #include <linux/sockios.h>
 #include <linux/ethtool.h>

and for:

In file included from debug.h:1:0,
                 from netlink_gre.c:19:
../lib/log.h:65:8: error: unknown type name 'u_short'
        u_short instance, int syslog_options, int syslog_facility);
        ^
Makefile:529: recipe for target 'netlink_gre.o' failed

this patch fixes it:


--- a/lib/log.h 2017-08-13 05:11:58.624824609 +0300
+++ b/lib/log.h 2017-08-13 05:12:10.020121314 +0300
@@ -25,6 +25,7 @@

 #include <syslog.h>
 #include <stdio.h>
+#include <sys/types.h>

 /* Here is some guidance on logging levels to use:
  *

@lucize
Copy link
Contributor Author

lucize commented Aug 13, 2017

v3.0.x runtested on LEDE x86_64 r4696-df3295f50e and AR7xxx openwrt/routing#319
Regards

@lucize
Copy link
Contributor Author

lucize commented Aug 13, 2017

another issue regarding vtysh and more not being found despite more being present (as a busybox symlink to less)
openwrt/routing#299 (comment)

quagga vtysh version uses cat

--- a/vtysh/vtysh.c     2017-08-13 19:34:50.552975949 +0300
+++ b/vtysh/vtysh.c     2017-08-13 19:35:15.891427915 +0300
@@ -249,7 +249,7 @@
        if (pager_defined)
                vtysh_pager_name = strdup(pager_defined);
        else
-               vtysh_pager_name = strdup("more");
+               vtysh_pager_name = strdup("cat");
 }

 /* Command execution over the vty interface. */

turns out that more needs to be enabled explicit in busybox for vtysh to work well, cat seems to be good also

@donaldsharp
Copy link
Member

@eqvinox Needs to rework clippy to be less weird

@lucize
Copy link
Contributor Author

lucize commented Sep 7, 2017

@eqvinox can you have a look at python dependencies on clippy ? If I set the path manually on configure.ac is working, but if it can work without python dev on host would be awesome
I backported eigrp to 3.0 (it does compile but has other dependencies in tree) but I think I would have better spent my time on clippy

@lucize
Copy link
Contributor Author

lucize commented Dec 12, 2017

finally tracked down the problem with python, it's an Openwrt problem that I hope it can be fixed

@donaldsharp
Copy link
Member

@lucize do we need to keep this open with the Openwrt python issue discovered?

@lucize
Copy link
Contributor Author

lucize commented Mar 21, 2018

No, thank you!

@lucize
Copy link
Contributor Author

lucize commented Apr 24, 2018

finally found the solution for openwrt, -lz is not detected by python-config so a patch is needed to append -lz to the PYTHON_LIBS

--- a/configure.ac   2018-04-24 12:05:46.122679906 +0300
+++ b/configure.ac        2018-04-24 18:50:18.885120833 +0300
@@ -511,7 +511,7 @@
   AC_CHECK_TOOLS([PYTHONCONFIG], [python3-config python-config python2-config])
   if test -n "$PYTHONCONFIG"; then
     PYTHON_CFLAGS="`\"${PYTHONCONFIG}\" --includes`"
-    PYTHON_LIBS="`\"${PYTHONCONFIG}\" --libs`"
+    PYTHON_LIBS="`\"${PYTHONCONFIG}\" --libs` -lz"

     AC_MSG_CHECKING([whether we found a working Python version])
     AC_LINK_IFELSE_FLAGS([$PYTHON_CFLAGS], [$PYTHON_LIBS], [AC_LANG_PROGRAM([

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants