OpenWrt Forum Archive

Topic: Compiling the openwrt with openflow

The content of this topic has been archived on 24 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi everyone, I am new in this field.

Environment:  Ubuntu 14.04.3 with 40G Disk 1G Ram on VMware.

These few days I'm trying to compiling the openwrt with openflow and I follow the steps as below:
https://github.com/Farzaneh1363/OpenFlo … work-/wiki

I have tried about 5 to 6 time doing this but I got the result of error message below after doing the final step "make V=s"

=================================================================================================================
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo lib/ipv6_util.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    mips-openwrt-linux-musl-gcc -DHAVE_CONFIG_H -I.   -g -I ./include -I ./lib  -DOFL_LOG_VLOG -DOFL_LOG_VLOG -DNETPDLDIR='"/usr/share/openflow"' -I/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/usr/include -I/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/include -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/usr/include -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include/fortify -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include  -Wstrict-prototypes  -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -std=c99 -MT lib/ipv6_util.o -MD -MP -MF $depbase.Tpo -c -o lib/ipv6_util.o lib/ipv6_util.c &&\
    mv -f $depbase.Tpo $depbase.Po
lib/ipv6_util.c: In function 'str_to_ipv6':
lib/ipv6_util.c:74:12: warning: implicit declaration of function 'strtok_r' [-Wimplicit-function-declaration]
     name = strtok_r(str, "/", &save_ptr);
            ^
lib/ipv6_util.c:74:10: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     name = strtok_r(str, "/", &save_ptr);
          ^
lib/ipv6_util.c:81:13: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     netmask = strtok_r(NULL, "/", &save_ptr);
             ^
depbase=`echo lib/leak-checker.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    mips-openwrt-linux-musl-gcc -DHAVE_CONFIG_H -I.   -g -I ./include -I ./lib  -DOFL_LOG_VLOG -DOFL_LOG_VLOG -DNETPDLDIR='"/usr/share/openflow"' -I/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/usr/include -I/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/include -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/usr/include -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include/fortify -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include  -Wstrict-prototypes  -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -std=c99 -MT lib/leak-checker.o -MD -MP -MF $depbase.Tpo -c -o lib/leak-checker.o lib/leak-checker.c &&\
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo lib/list.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    mips-openwrt-linux-musl-gcc -DHAVE_CONFIG_H -I.   -g -I ./include -I ./lib  -DOFL_LOG_VLOG -DOFL_LOG_VLOG -DNETPDLDIR='"/usr/share/openflow"' -I/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/usr/include -I/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/include -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/usr/include -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include/fortify -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include  -Wstrict-prototypes  -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -std=c99 -MT lib/list.o -MD -MP -MF $depbase.Tpo -c -o lib/list.o lib/list.c &&\
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo lib/mac-learning.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    mips-openwrt-linux-musl-gcc -DHAVE_CONFIG_H -I.   -g -I ./include -I ./lib  -DOFL_LOG_VLOG -DOFL_LOG_VLOG -DNETPDLDIR='"/usr/share/openflow"' -I/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/usr/include -I/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/include -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/usr/include -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include/fortify -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include  -Wstrict-prototypes  -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -std=c99 -MT lib/mac-learning.o -MD -MP -MF $depbase.Tpo -c -o lib/mac-learning.o lib/mac-learning.c &&\
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo lib/netdev.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    mips-openwrt-linux-musl-gcc -DHAVE_CONFIG_H -I.   -g -I ./include -I ./lib  -DOFL_LOG_VLOG -DOFL_LOG_VLOG -DNETPDLDIR='"/usr/share/openflow"' -I/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/usr/include -I/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/include -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/usr/include -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include/fortify -I/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include  -Wstrict-prototypes  -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -std=c99 -MT lib/netdev.o -MD -MP -MF $depbase.Tpo -c -o lib/netdev.o lib/netdev.c &&\
    mv -f $depbase.Tpo $depbase.Po
In file included from /home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include/net/ethernet.h:10:0,
                 from lib/netdev.c:105:
/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include/netinet/if_ether.h:96:8: error: redefinition of 'struct ethhdr'
struct ethhdr {
        ^
In file included from /home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include/linux/if_tun.h:20:0,
                 from lib/netdev.c:74:
/home/sdn/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include/linux/if_ether.h:139:8: note: originally defined here
struct ethhdr {
        ^
make[6]: *** [lib/netdev.o] Error 1
make[6]: Leaving directory `/home/sdn/openwrt/trunk/build_dir/target-mips_34kc_musl-1.1.11/ofsoftswitch13-open_wrt'
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/home/sdn/openwrt/trunk/build_dir/target-mips_34kc_musl-1.1.11/ofsoftswitch13-open_wrt'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/home/sdn/openwrt/trunk/build_dir/target-mips_34kc_musl-1.1.11/ofsoftswitch13-open_wrt'
make[3]: *** [/home/sdn/openwrt/trunk/build_dir/target-mips_34kc_musl-1.1.11/ofsoftswitch13-open_wrt/.built] Error 2
make[3]: Leaving directory `/home/sdn/openwrt/openflow-openwrt/openflow-1.3'
make[2]: *** [package/openflow-1.3/compile] Error 2
make[2]: Leaving directory `/home/sdn/openwrt/trunk'
make[1]: *** [/home/sdn/openwrt/trunk/staging_dir/target-mips_34kc_musl-1.1.11/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/sdn/openwrt/trunk'
make: *** [world] Error 2
=================================================================================================================

It's the final part output. I have no idea about all of these message.
Can any body help me? Please and thanks.

(Last edited by andy565866 on 25 Jan 2016, 03:51)

So you compiled Openflow and got

error: redefinition of 'struct ethhdr'

This error is common and documented at: http://wiki.musl-libc.org/wiki/FAQ

Possible solutions for beginners:
- use uclibc or glibc library instead of musl (see advanced developer options in menuconfig)
might require patching/reverting some commits

Advanced solutions:
- report this issue to Openflow/check if openflow fixed it already in some new version
- fix the problem (see musl faq or other OpenWrt packages that did this)

The discussion might have continued from here.