Compiling CentOS 7.5 kernel fails with implicit declaration error

General support questions
Post Reply
Prasad
Posts: 18
Joined: 2013/08/23 13:27:59

Compiling CentOS 7.5 kernel fails with implicit declaration error

Post by Prasad » 2018/06/29 11:22:15

Hi All,

I am getting below compilation error while compiling kernel 3.10.0-862.3.3 as below. Please let me know how can I resolve it.

Code: Select all

[pchavan@onyx linux-3.10.0-862.3.3.el7]$ make
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `relocs'.
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/qrwlock.h
  CHK     include/generated/qrwlock_api_smp.h
  CHK     include/generated/qrwlock_types.h
  CHK     kernel/qrwlock_gen.c
  CHK     lib/qrwlock_debug.c
  CC      kernel/bounds.s
In file included from ./arch/x86/include/asm/string_64.h:5:0,
                 from ./arch/x86/include/asm/string.h:4,
                 from include/linux/string.h:18,
                 from include/linux/dynamic_debug.h:111,
                 from include/linux/printk.h:241,
                 from include/linux/kernel.h:13,
                 from include/asm-generic/bug.h:13,
                 from ./arch/x86/include/asm/bug.h:38,
                 from include/linux/bug.h:4,
                 from include/linux/page-flags.h:9,
                 from kernel/bounds.c:9:
include/linux/jump_label.h: In function 'static_key_slow_inc':
include/linux/jump_label.h:166:2: error: implicit declaration of function 'WARN' [-Werror=implicit-function-declaration]
  STATIC_KEY_CHECK_USE();
  ^
In file included from ./arch/x86/include/asm/processor.h:18:0,
                 from ./arch/x86/include/asm/cpufeature.h:7,
                 from ./arch/x86/include/asm/thread_info.h:22,
                 from include/linux/thread_info.h:54,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from kernel/bounds.c:14:
./arch/x86/include/asm/pgtable_types.h: At top level:
./arch/x86/include/asm/pgtable_types.h:136:23: error: "_PAGE_BIT_SWP_SOFT_DIRTY" is not defined [-Werror=undef]
 #if _PAGE_BIT_FILE == _PAGE_BIT_SWP_SOFT_DIRTY
                       ^
In file included from ./arch/x86/include/asm/spinlock_types.h:27:0,
                 from include/linux/spinlock_types.h:13,
                 from include/linux/spinlock.h:81,
                 from kernel/bounds.c:14:
include/asm-generic/qspinlock_types.h:34:13: error: conflicting types for '__ticket_t'
 typedef u16 __ticket_t;
             ^
In file included from include/linux/spinlock_types.h:13:0,
                 from include/linux/spinlock.h:81,
                 from kernel/bounds.c:14:
./arch/x86/include/asm/spinlock_types.h:15:13: note: previous declaration of '__ticket_t' was here
 typedef u8  __ticket_t;
             ^
cc1: all warnings being treated as errors
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Compiling CentOS 7.5 kernel fails with implicit declaration error

Post by TrevorH » 2018/06/29 11:25:03

If you're building for 32 bit (which it looks like from that output) then use the centosplus SRPM as a base. It has mods to allow it to build for i686 which the standard distro kernel does not have (since RH don't care about 32 bit since RHEL 7 is 64 bit only).
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Prasad
Posts: 18
Joined: 2013/08/23 13:27:59

Re: Compiling CentOS 7.5 kernel fails with implicit declaration error

Post by Prasad » 2018/06/29 11:31:35

I am building it for 64 bit. Has extracted the source code form http://vault.centos.org/7.5.1804/update ... l7.src.rpm. In make menu config 64-bit kernel is selected. What can possibly go wrong?

Prasad
Posts: 18
Joined: 2013/08/23 13:27:59

Re: Compiling CentOS 7.5 kernel fails with implicit declaration error

Post by Prasad » 2018/07/06 10:16:11

Any clue or pointers for this issue. I am still stuck on it.

Below are the steps that I followed,

wget http://vault.centos.org/7.5.1804/update ... l7.src.rpm
rpm2cpio kernel-3.10.0-862.3.3.el7.src.rpm |cpio -imdv
tar xz linux-3.10.0-862.3.3.el7.tar.xz
cd linux-3.10.0-862.3.3.el7
Applied patch mentioned in https://patchwork.kernel.org/patch/9228147/.
make -j 30 bzImage

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Compiling CentOS 7.5 kernel fails with implicit declaration error

Post by TrevorH » 2018/07/06 10:18:28

The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: Compiling CentOS 7.5 kernel fails with implicit declaration error

Post by avij » 2018/07/06 11:09:52

And try building an unpatched kernel first. Only if that succeeds, try with your patch.

Prasad
Posts: 18
Joined: 2013/08/23 13:27:59

Re: Compiling CentOS 7.5 kernel fails with implicit declaration error

Post by Prasad » 2018/07/06 11:18:16

@TrecorH: Sure, I will try and provide the updates.
@avij: I had applied the patch to resolve the implicit declaration of strstr errors.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Compiling CentOS 7.5 kernel fails with implicit declaration error

Post by TrevorH » 2018/07/06 12:16:19

If you build the source from the SRPM with all the patches from the SRPM applied then it should compile cleanly to start with.

What is your end goal here?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Prasad
Posts: 18
Joined: 2013/08/23 13:27:59

Re: Compiling CentOS 7.5 kernel fails with implicit declaration error

Post by Prasad » 2018/07/11 16:58:40

Hi TrevorH,

Currently I am migrating our application to CentOS 7.5 from CentOS 7.2. In CentOS 7.2 we have used kernel.org 3.10.77 kernel. Plan is to make use of CentOS 7.5 kernel (3.10.0-862.6.3.el7) after upgrade.

When I use the old kernel config file it fails as described in the issues. If I do make menuconfig and compile the kernel it gets compiled as expected. But there are some features that are enabled in the existing kernel. So I decided to enable them one by one in new .config file instead of fixing the compilation issues with the current kernel .config file.

But I am again getting issue while enabling the Dlink Snndance module from Device Drivers->Network device support->Ethernet driver support as pasted below.

Please provide pointers for this.

Code: Select all

drivers/net/ethernet/dlink/dl2k.c:110:2: error: unknown field 'ndo_change_mtu' specified in initializer
  .ndo_change_mtu  = change_mtu,
  ^
drivers/net/ethernet/dlink/dl2k.c:110:2: error: missing braces around initializer [-Werror=missing-braces]
drivers/net/ethernet/dlink/dl2k.c:110:2: error: (near initialization for 'netdev_ops.<anonymous>') [-Werror=missing-braces]
drivers/net/ethernet/dlink/dl2k.c:110:2: error: initialization from incompatible pointer type [-Werror]
drivers/net/ethernet/dlink/dl2k.c:110:2: error: (near initialization for 'netdev_ops.<anonymous>.ndo_get_stats64') [-Werror]
cc1: all warnings being treated as errors
distcc[14179] ERROR: compile drivers/net/ethernet/dlink/dl2k.c on localhost failed
make[5]: *** [drivers/net/ethernet/dlink/dl2k.o] Error 1
make[5]: *** Waiting for unfinished jobs....

User avatar
toracat
Site Admin
Posts: 7518
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: Compiling CentOS 7.5 kernel fails with implicit declaration error

Post by toracat » 2018/07/13 18:20:26

That build error can be fixed by changing

.ndo_change_mtu

to

.ndo_change_mtu_rh74
(Thanks to pgreco for the fix)
CentOS Forum FAQ

Post Reply