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

Issue with module compilation on Centos 7 kernel-lt-5.4 from elrepo #171

Closed
gavrilov-i opened this issue Mar 30, 2021 · 2 comments
Closed

Comments

@gavrilov-i
Copy link

gavrilov-i commented Mar 30, 2021

Hello, recently we've updated kernel from the kernel-lt-4.4 tree to kernel-lt-5.4 (from elrepo), and now we are experiencing issue with ipt_NETFLOW compilation:
Here is ./configure output with module/kernel/iptables versions


Module version: 2.5.1-11-g5405927-dirty
Kernel version: 5.4.108-1.el7.elrepo.x86_64 (requested)
Kernel sources: /lib/modules/5.4.108-1.el7.elrepo.x86_64/build (found)
Checking for presence of include/linux/netfilter.h... Yes
netfilter.h uses CONFIG_NF_NAT_NEEDED... No
Checking for presence of include/linux/llist.h... Yes
Checking for presence of include/linux/grsecurity.h... No
Iptables binary version: 1.4.21 (detected from /sbin/iptables)
pkg-config for version 1.4.21 exists: Yes
Check for working gcc: Yes (gcc)
Checking for presence of xtables.h... Yes (using pkg-config)
Iptables include flags:   (pkg-config)
Iptables module path: /usr/lib64/xtables (pkg-config)
Searching for net-snmp-config... No.
Searching for net-snmp agent... Yes.
! You have net-snmp agent but not development package.
! net-snmp agent will not be built, to fix:
!   run:  yum install net-snmp-devel
Checking for DKMS... Yes.
! You are already have module installed via DKMS
!   it will be uninstalled on 'make install' and
!   current version of module installed afterwards.
! Use --disable-dkms option if don't want this.
Creating Makefile.. done.

  If you need some options enabled run ./configure --help
  Now run: make all install

and part of the make output (there are vast of output, but the most of it points to the similar errors):

Test symbol xt_family linux/netfilter_ipv4/ip_tables.h  undeclared
Error: unexpected error from compiler
make -s -B -C /lib/modules/5.4.108-1.el7.elrepo.x86_64/build M=/usr/src/ipt-netflow/cc-test-build modules
In file included from <command-line>:0:0:
./arch/x86/include/asm/page_64.h: In function 'clear_page':
././include/linux/compiler_types.h:214:24: error: expected '(' before '__inline'
 #define asm_inline asm __inline
                        ^
./arch/x86/include/asm/alternative.h:256:2: note: in expansion of macro 'asm_inline'
  asm_inline volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\
  ^
./arch/x86/include/asm/page_64.h:49:2: note: in expansion of macro 'alternative_call_2'
  alternative_call_2(clear_page_orig,
  ^
In file included from ./arch/x86/include/asm/barrier.h:5:0,
                 from ./include/linux/compiler.h:323,
                 from ./include/linux/export.h:42,
                 from ./include/linux/linkage.h:7,
                 from ./include/linux/kernel.h:8,
                 from ./include/linux/list.h:9,
                 from ./include/linux/module.h:9,
                 from /usr/src/ipt-netflow/cc-test-build/test.c:1:
./arch/x86/include/asm/alternative.h:128:2: error: expected identifier or '(' before string constant
  "# ALT: oldinstr2\n"         \
  ^
./arch/x86/include/asm/alternative.h:168:2: note: in expansion of macro 'OLDINSTR_2'
  OLDINSTR_2(oldinstr, 1, 2)     \
  ^
./arch/x86/include/asm/alternative.h:256:23: note: in expansion of macro 'ALTERNATIVE_2'
  asm_inline volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\
                       ^
./arch/x86/include/asm/page_64.h:49:2: note: in expansion of macro 'alternative_call_2'
  alternative_call_2(clear_page_orig,
  ^
In file included from <command-line>:0:0:
././include/linux/compiler_types.h:214:24: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
 #define asm_inline asm __inline
                        ^
./arch/x86/include/asm/alternative.h:256:2: note: in expansion of macro 'asm_inline'
  asm_inline volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\
  ^
./arch/x86/include/asm/page_64.h:49:2: note: in expansion of macro 'alternative_call_2'
  alternative_call_2(clear_page_orig,
  ^
./arch/x86/include/asm/segment.h: In function 'vdso_read_cpunode':
././include/linux/compiler_types.h:214:24: error: expected '(' before '__inline'
 #define asm_inline asm __inline
                        ^
./arch/x86/include/asm/alternative.h:240:2: note: in expansion of macro 'asm_inline'
  asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \
  ^
./arch/x86/include/asm/segment.h:266:2: note: in expansion of macro 'alternative_io'
  alternative_io ("lsl %[seg],%[p]",
  ^
In file included from ./arch/x86/include/asm/barrier.h:5:0,
                 from ./include/linux/compiler.h:323,
                 from ./include/linux/export.h:42,
                 from ./include/linux/linkage.h:7,
                 from ./include/linux/kernel.h:8,
                 from ./include/linux/list.h:9,
                 from ./include/linux/module.h:9,
                 from /usr/src/ipt-netflow/cc-test-build/test.c:1:
./arch/x86/include/asm/alternative.h:108:2: error: expected identifier or '(' before string constant
  "# ALT: oldnstr\n"      \
  ^
./arch/x86/include/asm/alternative.h:159:2: note: in expansion of macro 'OLDINSTR'
  OLDINSTR(oldinstr, 1)      \
  ^
./arch/x86/include/asm/alternative.h:240:23: note: in expansion of macro 'ALTERNATIVE'
  asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \
                       ^
./arch/x86/include/asm/segment.h:266:2: note: in expansion of macro 'alternative_io'
  alternative_io ("lsl %[seg],%[p]",
  ^
In file included from <command-line>:0:0:
././include/linux/compiler_types.h:214:24: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
 #define asm_inline asm __inline
                        ^
./arch/x86/include/asm/alternative.h:240:2: note: in expansion of macro 'asm_inline'
  asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \
  ^
./arch/x86/include/asm/segment.h:266:2: note: in expansion of macro 'alternative_io'
  alternative_io ("lsl %[seg],%[p]",
  ^
./arch/x86/include/asm/special_insns.h: In function 'clflushopt':
././include/linux/compiler_types.h:214:24: error: expected '(' before '__inline'
 #define asm_inline asm __inline
                        ^
./arch/x86/include/asm/alternative.h:240:2: note: in expansion of macro 'asm_inline'
  asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \
  ^
./arch/x86/include/asm/special_insns.h:207:2: note: in expansion of macro 'alternative_io'
  alternative_io(".byte " __stringify(NOP_DS_PREFIX) "; clflush %P0",
  ^
In file included from ./arch/x86/include/asm/barrier.h:5:0,
                 from ./include/linux/compiler.h:323,
                 from ./include/linux/export.h:42,
                 from ./include/linux/linkage.h:7,
                 from ./include/linux/kernel.h:8,
                 from ./include/linux/list.h:9,
                 from ./include/linux/module.h:9,
                 from /usr/src/ipt-netflow/cc-test-build/test.c:1:
./arch/x86/include/asm/alternative.h:108:2: error: expected identifier or '(' before string constant
  "# ALT: oldnstr\n"      \
  ^

If you need more output I can attach all.

@gavrilov-i
Copy link
Author

gavrilov-i commented Mar 31, 2021

Hi all, I've found the reason of the specified issue:
modern kernels requires newer GCC version than standard one (4.8.5).
installing GCC 9 fixed the build:

yum --enablerepo=extras install centos-release-scl-rh
yum install devtoolset-9-gcc
scl enable devtoolset-9 bash

Hope this will help others.

@aabc
Copy link
Owner

aabc commented Apr 19, 2021

Thanks for the report and solution!

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

2 participants