kohler / click

The Click modular router: fast modular packet processing and analysis
Other
744 stars 321 forks source link

Can't build kernel module in Kernel 3.2 #288

Open xiaottang2 opened 8 years ago

xiaottang2 commented 8 years ago

When I was trying to build click's kernel module by running ./configure --enable-linuxmodule, it gave me an error as below:

=========================================

Your Linux kernel header files cause errors when included by a C++ program.

Click modifies the Linux kernel's header files to make them work with
C++, using the program 'linuxmodule/click-linuxtool.pl'. It looks like
your kernel header files have features that tool doesn't know how to fix.
You can report this error to us on the Click mailing list, or, even better,
try to fix the error. See the config.log file for more information on the
error.

=========================================

So I took a look at the config.log file, here is a snippet of it:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by click configure 2.1, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --enable-linuxmodule

## --------- ##
## Platform. ##
## --------- ##

hostname = jason-ubuntu01
uname -m = x86_64
uname -r = 3.2.0-23-generic
uname -s = Linux
uname -v = #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/lib/lightdm/lightdm
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games

## ----------- ##
## Core tests. ##
## ----------- ##

configure:3313: checking build system type
configure:3327: result: x86_64-unknown-linux-gnu
configure:3347: checking host system type
configure:3360: result: x86_64-unknown-linux-gnu
configure:3380: checking target system type
configure:3393: result: x86_64-unknown-linux-gnu
configure:3464: checking for gcc
configure:3480: found /usr/bin/gcc
configure:3491: result: gcc
configure:3556: checking for g++
configure:3572: found /usr/bin/g++
configure:3583: result: g++
...

whole file is here ### config.log.txt

According to the INSTALL, kernel 3.2 should be supported, and this is running on a clean VM (iso from http://old-linux.com/ ).

I appreciate your help.

pallas commented 8 years ago

Here's the actual compiler error.

In file included from /home/jasontang/Documents/click/include/click-linuxmodule/include2/linux/spinlock.h:92:0,
                 from /home/jasontang/Documents/click/include/click-linuxmodule/include2/linux/seqlock.h:34,
                 from /home/jasontang/Documents/click/include/click-linuxmodule/include2/linux/time.h:13,
                 from /home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/signal.h:11,
                 from /home/jasontang/Documents/click/include/click-linuxmodule/include2/linux/signal.h:9,
                 from conftest.cpp:132:
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock.h: In function 'int __ticket_spin_trylock(arch_spinlock_t*)':
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock.h:77:16: error: no match for 'operator=' in 'old.arch_spinlock::<anonymous>.arch_spinlock::<anonymous union>::tickets = *(volatile __raw_tickets*)(& lock->arch_spinlock::<anonymous>.arch_spinlock::<anonymous union>::tickets)'
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock.h:77:16: note: candidates are:
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note: __raw_tickets& __raw_tickets::operator=(const __raw_tickets&)
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note:   no known conversion for argument 1 from 'volatile __raw_tickets' to 'const __raw_tickets&'
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note: __raw_tickets& __raw_tickets::operator=(__raw_tickets&&)
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note:   no known conversion for argument 1 from 'volatile __raw_tickets' to '__raw_tickets&&'
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock.h: In function 'int __ticket_spin_is_locked(arch_spinlock_t*)':
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock.h:107:29: error: no matching function for call to '__raw_tickets::__raw_tickets(volatile __raw_tickets&)'
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock.h:107:29: note: candidates are:
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note: __raw_tickets::__raw_tickets()
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note:   candidate expects 0 arguments, 1 provided
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note: constexpr __raw_tickets::__raw_tickets(const __raw_tickets&)
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note:   no known conversion for argument 1 from 'volatile __raw_tickets' to 'const __raw_tickets&'
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note: constexpr __raw_tickets::__raw_tickets(__raw_tickets&&)
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note:   no known conversion for argument 1 from 'volatile __raw_tickets' to '__raw_tickets&&'
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock.h: In function 'int __ticket_spin_is_contended(arch_spinlock_t*)':
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock.h:114:29: error: no matching function for call to '__raw_tickets::__raw_tickets(volatile __raw_tickets&)'
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock.h:114:29: note: candidates are:
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note: __raw_tickets::__raw_tickets()
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note:   candidate expects 0 arguments, 1 provided
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note: constexpr __raw_tickets::__raw_tickets(const __raw_tickets&)
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note:   no known conversion for argument 1 from 'volatile __raw_tickets' to 'const __raw_tickets&'
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note: constexpr __raw_tickets::__raw_tickets(__raw_tickets&&)
/home/jasontang/Documents/click/include/click-linuxmodule/include0/asm/spinlock_types.h:26:8: note:   no known conversion for argument 1 from 'volatile __raw_tickets' to '__raw_tickets&&'
menagahcl commented 8 years ago

I am facing the same issue. Are you successful in building it now ?

tbarbette commented 7 years ago

This was introduced by 7d0d624 which breaks compilation with kernel <=3.2 at least (maybe anything up to <3.16 which compile fine) by stopping to patch ACCESS_ONCE. Fix is as easy as uncommenting line 434 of linuxmodule/click-linuxtool.pl . I would like to enable it if kernel is lower than 3.2 but there is no reference to linux version in click-linuxtool.pl. Anyone have an idea about a clean way to do that? @kohler @pallas ?