ipt-netflow icon indicating copy to clipboard operation
ipt-netflow copied to clipboard

No longer builds Arch 6.12.1 - unaligned.h

Open jayray-git opened this issue 1 year ago • 4 comments

Getting the following build error that is fixable: Compiling 2.6-17-g0eb2092-dirty for kernel 6.12.1-arch1-1 make -C /lib/modules/6.12.1-arch1-1/build M=/root/ipt-netflow modules make[1]: Entering directory '/usr/lib/modules/6.12.1-arch1-1/build' CC [M] /root/ipt-netflow/ipt_NETFLOW.o /root/ipt-netflow/ipt_NETFLOW.c:71:10: fatal error: asm/unaligned.h: No such file or directory 71 | #include <asm/unaligned.h> | ^~~~~~~~~~~~~~~~~ compilation terminated. make[3]: *** [scripts/Makefile.build:229: /root/ipt-netflow/ipt_NETFLOW.o] Error 1 make[2]: *** [/usr/lib/modules/6.12.1-arch1-1/build/Makefile:1936: /root/ipt-netflow] Error 2 make[1]: *** [Makefile:224: __sub-make] Error 2 make[1]: Leaving directory '/usr/lib/modules/6.12.1-arch1-1/build' make: *** [Makefile:27: ipt_NETFLOW.ko] Error 2 Compiling 2.6-17-g0eb2092-dirty for kernel 6.12.1-arch1-1 make -C /lib/modules/6.12.1-arch1-1/build M=/root/ipt-netflow modules make[1]: Entering directory '/usr/lib/modules/6.12.1-arch1-1/build' CC [M] /root/ipt-netflow/ipt_NETFLOW.o /root/ipt-netflow/ipt_NETFLOW.c:71:10: fatal error: asm/unaligned.h: No such file or directory 71 | #include <asm/unaligned.h> | ^~~~~~~~~~~~~~~~~ compilation terminated. make[3]: *** [scripts/Makefile.build:229: /root/ipt-netflow/ipt_NETFLOW.o] Error 1 make[2]: *** [/usr/lib/modules/6.12.1-arch1-1/build/Makefile:1936: /root/ipt-netflow] Error 2 make[1]: *** [Makefile:224: __sub-make] Error 2 make[1]: Leaving directory '/usr/lib/modules/6.12.1-arch1-1/build' make: *** [Makefile:27: ipt_NETFLOW.ko] Error 2

#change the following: < #include <asm/unaligned.h>

#include <linux/unaligned.h>

Then the build error is this array: Compiling 2.6-17-g0eb2092-dirty for kernel 6.12.1-arch1-1 make -C /lib/modules/6.12.1-arch1-1/build M=/root/ipt-netflow modules make[1]: Entering directory '/usr/lib/modules/6.12.1-arch1-1/build' CC [M] /root/ipt-netflow/ipt_NETFLOW.o In file included from /root/ipt-netflow/ipt_NETFLOW.c:77: /root/ipt-netflow/compat.h:219:15: warning: no previous prototype for 'timeval_to_jiffies' [-Wmissing-prototypes] 219 | unsigned long timeval_to_jiffies(const struct timeval *tv) | ^~~~~~~~~~~~~~~~~~ /root/ipt-netflow/compat.h:384:20: warning: no previous prototype for 'compat_hex_to_bin' [-Wmissing-prototypes] 384 | #define hex_to_bin compat_hex_to_bin | ^~~~~~~~~~~~~~~~~ /root/ipt-netflow/compat.h:386:5: note: in expansion of macro 'hex_to_bin' 386 | int hex_to_bin(char ch) | ^~~~~~~~~~ /root/ipt-netflow/compat.h:716:20: warning: no previous prototype for 'strtoul' [-Wmissing-prototypes] 716 | unsigned long long strtoul(const char *cp, char **endp, unsigned int base) | ^~~~~~~ /root/ipt-netflow/ipt_NETFLOW.c:3538:20: error: conflicting types for 'put_unaligned_be24'; have 'void(u32, unsigned char *)' {aka 'void(unsigned int, unsigned char *)'} 3538 | static inline void put_unaligned_be24(u32 val, unsigned char *p) | ^~~~~~~~~~~~~~~~~~ In file included from ./include/linux/etherdevice.h:24, from /root/ipt-netflow/ipt_NETFLOW.c:38: ./include/linux/unaligned.h:103:20: note: previous definition of 'put_unaligned_be24' with type 'void(const u32, void *)' {aka 'void(const unsigned int, void *)'} 103 | static inline void put_unaligned_be24(const u32 val, void *p) | ^~~~~~~~~~~~~~~~~~ make[3]: *** [scripts/Makefile.build:229: /root/ipt-netflow/ipt_NETFLOW.o] Error 1 make[2]: *** [/usr/lib/modules/6.12.1-arch1-1/build/Makefile:1936: /root/ipt-netflow] Error 2 make[1]: *** [Makefile:224: __sub-make] Error 2 make[1]: Leaving directory '/usr/lib/modules/6.12.1-arch1-1/build' make: *** [Makefile:27: ipt_NETFLOW.ko] Error 2

Anyone want to give me a hand in fixing this? error: conflicting types for 'put_unaligned_be24'; have 'void(u32, unsigned char *)' {aka 'void(unsigned int, unsigned char *)'}

jayray-git avatar Dec 04 '24 20:12 jayray-git

Hello,

You had a good idea to replace asm/unaligned.h to linux/unaligned.h but it is not enough. When I also added:

#define HAVE_PUT_UNALIGNED_BE24

before

#endif /* COMPAT_NETFLOW_H */

in compat.h

I was able to compile ipt-netflow module on debian sid with kernel 6.12.5 for amd64 architecture but this was after applying 230.patch file patch from: https://aur.archlinux.org/ipt_netflow.git/

This preprocessor constant should be generated by make and saved in compat_def.h but somehow it is not that is why we need workaround in compat.h

Best regards, Łukasz

kalamlacki avatar Dec 21 '24 17:12 kalamlacki

Hello! I have the same issue while trying to compile for Linux-6.13.2.

fancywriter avatar Feb 16 '25 22:02 fancywriter

Doesn't seem to be working for me with Oracle Enterprise Linux 9 and GCC 14. After applying your changes as per ca9a6ae, got this (see also https://github.com/aabc/ipt-netflow/issues/240):

Compiling 2.6-21-gd46ef26-dirty for kernel 6.12.0-101.33.4.3.el9uek.x86_64
make -C /lib/modules/6.12.0-101.33.4.3.el9uek.x86_64/build M=/usr/src/ipt-netflow modules
make[1]: Entering directory '/usr/src/kernels/6.12.0-101.33.4.3.el9uek.x86_64'
  CC [M]  /usr/src/ipt-netflow/ipt_NETFLOW.o
In file included from /usr/src/ipt-netflow/ipt_NETFLOW.c:77:
/usr/src/ipt-netflow/compat.h:219:15: error: no previous prototype for ‘timeval_to_jiffies’ [-Werror=missing-prototypes]
  219 | unsigned long timeval_to_jiffies(const struct timeval *tv)
      |               ^~~~~~~~~~~~~~~~~~
/usr/src/ipt-netflow/compat.h:384:20: error: no previous prototype for ‘compat_hex_to_bin’ [-Werror=missing-prototypes]
  384 | #define hex_to_bin compat_hex_to_bin
      |                    ^~~~~~~~~~~~~~~~~
/usr/src/ipt-netflow/compat.h:386:5: note: in expansion of macro ‘hex_to_bin’
  386 | int hex_to_bin(char ch)
      |     ^~~~~~~~~~
/usr/src/ipt-netflow/compat.h:716:20: error: no previous prototype for ‘strtoul’ [-Werror=missing-prototypes]
  716 | unsigned long long strtoul(const char *cp, char **endp, unsigned int base)
      |                    ^~~~~~~
/usr/src/ipt-netflow/ipt_NETFLOW.c:1807:35: error: initialization of ‘int (*)(const struct ctl_table *, int,  void *, size_t *, loff_t *)’ {aka ‘int (*)(const struct ctl_table *, int,  void *, long unsigned int *, long long int *)’} from incompatible pointer type ‘int (*)(struct ctl_table *, int,  void *, size_t *, loff_t *)’ {aka ‘int (*)(struct ctl_table *, int,  void *, long unsigned int *, long long int *)’} [-Wincompatible-pointer-types]
 1807 |                 .proc_handler   = &hsize_procctl,
      |                                   ^
...

While I managed to fix missing prototypes, I still have an issue with incompatible pointer types (https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types).

rlevytskyi avatar Aug 18 '25 12:08 rlevytskyi

Hello! I have the same issue while trying to compile for Linux-6.12.48, After applying your changes as per https://github.com/aabc/ipt-netflow/commit/ca9a6ae33874c124f8382e68fc65fdbf08cdd6cd

Linux NAT4 6.12.48+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.48-1 (2025-09-20) x86_64 GNU/Linux

Image

jim2310 avatar Oct 28 '25 15:10 jim2310