Fenix 1.4.2 build failure

Which Khadas SBC do you use?

Vim3

Which system do you use? Android, Ubuntu, OOWOW or others?

Fenix running on docker hosted on an intel Mac

Which version of system do you use? Khadas official images, self built images, or others?

Fenix 1.4.2

Please describe your issue below:

I’ve encountered a problem when trying to build the image myself.

I’m using the following build config for Fenix

***********************PARAMETERS************************
Fenix Version:         1.4.2
Khadas Board:          VIM3
Uboot Version:         mainline
Uboot Configuration:   khadas-vim3_defconfig
Uboot Branch:          master
Linux Version:         mainline
Linux Configuration:   kvims_defconfig
Linux DTB:             arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dtb
Linux Branch:          khadas-linux-6.1.y
Distribution:          Ubuntu
Distribution Release:  jammy
Distribution Type:     gnome
Distribution Arch:     arm64
Install Type:          SD-USB
Final Image:           vim3-ubuntu-22.04-gnome-linux-6.1-fenix-1.4.2-230220-develop.img
*********************************************************

The first weird thing is at some point down the build process, it detected some changes in the khadas/linux repo and required me to confirm

Info: Linux: Already on branch 'khadas-linux-6.1.y'
Warning:: Repo[/home/khadas/fenix/build/linux] You made some modifications to file(s):
[
include/uapi/linux/netfilter/xt_connmark.h
include/uapi/linux/netfilter/xt_dscp.h
include/uapi/linux/netfilter/xt_mark.h
include/uapi/linux/netfilter/xt_rateest.h
include/uapi/linux/netfilter/xt_tcpmss.h
include/uapi/linux/netfilter_ipv4/ipt_ecn.h
include/uapi/linux/netfilter_ipv4/ipt_ttl.h
include/uapi/linux/netfilter_ipv6/ip6t_hl.h
net/netfilter/xt_dscp.c
net/netfilter/xt_hl.c
net/netfilter/xt_rateest.c
net/netfilter/xt_tcpmss.c
tools/memory-model/litmus-tests/Z6.0+pooncelock+pooncelock+pombonce.litmus
]
Info: Try to update linux:khadas-linux-6.1.y
From https://github.com/khadas/linux
 * branch                      khadas-linux-6.1.y -> FETCH_HEAD
Already up to date.
Press <Ctrl-C> to abort compilation, <Enter> to ignore and continue

I didn’t change anything to any repo, I was just following the Fenix readme with a docker build environment.

Then the build failed

net/netfilter/xt_mark.c: In function ‘mark_tg’:
net/netfilter/xt_mark.c:30:39: error: invalid use of undefined type ‘const struct xt_mark_tginfo2’
   30 |         skb->mark = (skb->mark & ~info->mask) ^ info->mark;
      |                                       ^~
net/netfilter/xt_mark.c:30:53: error: invalid use of undefined type ‘const struct xt_mark_tginfo2’
   30 |         skb->mark = (skb->mark & ~info->mask) ^ info->mark;
      |                                                     ^~
net/netfilter/xt_mark.c: In function ‘mark_mt’:
net/netfilter/xt_mark.c:39:34: error: invalid use of undefined type ‘const struct xt_mark_mtinfo1’
   39 |         return ((skb->mark & info->mask) == info->mark) ^ info->invert;
      |                                  ^~
net/netfilter/xt_mark.c:39:49: error: invalid use of undefined type ‘const struct xt_mark_mtinfo1’
   39 |         return ((skb->mark & info->mask) == info->mark) ^ info->invert;
      |                                                 ^~
net/netfilter/xt_mark.c:39:63: error: invalid use of undefined type ‘const struct xt_mark_mtinfo1’
   39 |         return ((skb->mark & info->mask) == info->mark) ^ info->invert;
      |                                                               ^~
net/netfilter/xt_mark.c: At top level:
net/netfilter/xt_mark.c:47:34: error: invalid application of ‘sizeof’ to incomplete type ‘struct xt_mark_tginfo2’
   47 |         .targetsize     = sizeof(struct xt_mark_tginfo2),
      |                                  ^~~~~~
net/netfilter/xt_mark.c:56:34: error: invalid application of ‘sizeof’ to incomplete type ‘struct xt_mark_mtinfo1’
   56 |         .matchsize      = sizeof(struct xt_mark_mtinfo1),
      |                                  ^~~~~~
make[4]: *** [scripts/Makefile.build:250: net/netfilter/xt_mark.o] Error 1
make[3]: *** [scripts/Makefile.build:500: net/netfilter] Error 2
make[2]: *** [scripts/Makefile.build:500: net] Error 2
make[2]: *** Waiting for unfinished jobs....

I did try git reset those files but the build still fails

make[4]: *** No rule to make target 'net/netfilter/xt_dscp.o', needed by 'net/netfilter/'.  Stop.
make[4]: *** Waiting for unfinished jobs....

Any thoughts?

Oh, never checked Fenix build in docker on Mac. :wink:
I will check on my side but we still suggest you to build under Ununtu.

I don’t think the above error is related to the platform. I thought the Docker option was prepared for Mac / Windows users :wink: Guess I’m wrong. The only Ubuntu device I have is the Vim3 and it can’t build since it’s not x86. BTW why do we have to cross compile? If vim3 can build for itself, maybe it’s easier to tweak around?

It seems that you made some modifications to the source code. Please revert all the changes and try again.

I didn’t change anything to any repo, I was just following the Fenix readme with a docker build environment.

From the logs above, you did.

Please goto build/linux folder and check the status.

git status

That’s what I found weird.

Anyway, let me start over again.

Hey, I just tried to build again from scratch and I’m 100% sure that I did nothing more than source env/setenv.sh and make. Those files were changed sometime somehow during the building process

diff --git a/include/uapi/linux/netfilter/xt_RATEEST.h b/include/uapi/linux/netfilter/xt_RATEEST.h
index 2b87a71e6266..52a37bdc1837 100644
--- a/include/uapi/linux/netfilter/xt_RATEEST.h
+++ b/include/uapi/linux/netfilter/xt_RATEEST.h
@@ -1,17 +1,39 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef _XT_RATEEST_TARGET_H
-#define _XT_RATEEST_TARGET_H
+#ifndef _XT_RATEEST_MATCH_H
+#define _XT_RATEEST_MATCH_H

 #include <linux/types.h>
 #include <linux/if.h>

-struct xt_rateest_target_info {
-       char                    name[IFNAMSIZ];
-       __s8                    interval;
-       __u8            ewma_log;
+enum xt_rateest_match_flags {
+       XT_RATEEST_MATCH_INVERT = 1<<0,
+       XT_RATEEST_MATCH_ABS    = 1<<1,
+       XT_RATEEST_MATCH_REL    = 1<<2,
+       XT_RATEEST_MATCH_DELTA  = 1<<3,
+       XT_RATEEST_MATCH_BPS    = 1<<4,
+       XT_RATEEST_MATCH_PPS    = 1<<5,
+};
+
+enum xt_rateest_match_mode {
+       XT_RATEEST_MATCH_NONE,
+       XT_RATEEST_MATCH_EQ,
+       XT_RATEEST_MATCH_LT,
+       XT_RATEEST_MATCH_GT,
+};
+
+struct xt_rateest_match_info {
+       char                    name1[IFNAMSIZ];
+       char                    name2[IFNAMSIZ];
+       __u16           flags;
+       __u16           mode;
+       __u32           bps1;
+       __u32           pps1;
+       __u32           bps2;
+       __u32           pps2;

        /* Used internally by the kernel */
-       struct xt_rateest       *est __attribute__((aligned(8)));
+       struct xt_rateest       *est1 __attribute__((aligned(8)));
+       struct xt_rateest       *est2 __attribute__((aligned(8)));
 };

-#endif /* _XT_RATEEST_TARGET_H */
+#endif /* _XT_RATEEST_MATCH_H */

And as I mentioned in the original post, git reset the repo still gives an error.

Hello @Eurus

Can you try to build from a fresh folder ?

I did. Same thing ;/

Just checked on my side with a fresh build and works well.

Okay I tried this on a windows machine with WSL and it worked great. So weird.
Anyway, thanks a lot.