Hi List,

I am porting KTCPVS (last released for 2.6.18) to the latest kernel. I
was able to compile most of the files on 2.6.30, until I got struck at
a strange "KBUILD_MODNAME undefined warning" The Makefile of KTCPVS is
:

---------------------------------Makefile
Starts-------------------------------------
# ktcpvs migrate to 2.6

ifneq ($(KERNELRELEASE),)
    ifdef CONFIG_MODVERSIONS
    EXTRA_CFLAGS := -DCONFIG_TCP_VS_DEBUG
    endif
    obj-m := ktcpvs.o tvs_hhttp.o tvs_phttp.o tvs_chttp.o tvs_http.o tvs_wlc.o
    LIBS := tcp_vs_sched.o tcp_vs_ctl.o misc.o redirect.o
tcp_vs_srvconn.o tcp_vs_timer.o tcp_vs.o fault.o regex/regcomp.o
    LIBS += regex/kernel.o regex/regfree.o
    ktcpvs-y := $(LIBS)

    RELIBS := regex/kernel.o regex/regexec.o regex/regfree.o
    tvs_hhttp-y := tcp_vs_hhttp.o  $(RELIBS)
    tvs_phttp-y := tcp_vs_phttp.o tcp_vs_http_parser.o
tcp_vs_http_trans.o $(RELIBS)
    tvs_chttp-y := tcp_vs_chttp.o tcp_vs_http_parser.o
tcp_vs_http_trans.o avl.o $(RELIBS)
    tvs_http-y := tcp_vs_http.o tcp_vs_http_parser.o
tcp_vs_http_trans.o $(RELIBS)
    tvs_wlc-y := tcp_vs_wlc.o $(RELIBS)
else
# Set kerneldir
KERNELDIR := /lib/modules/$(shell uname -r)/build
TARGET := tcp_vs.ko

$(TARGET):
    $(MAKE) -C $(KERNELDIR) M=`pwd` modules
install: $(TARGET)
    @sh install.sh
clean:
    @rm -fv *o *mod* .*.cmd
    @rm -rfv .tmp*
    @rm -fv regex/*o regex/.*.cmd
load:
    @insmod ktcpvs.ko
    @insmod tvs_hhttp.ko
    @/root/bin/tcpvsadm -f config/conftest
test:
    @insmod ktcpvs.ko
    @echo 12 >/proc/sys/net/ktcpvs/debug_level
    @insmod tvs_phttp.ko
    @/root/bin/tcpvsadm -f config/conftest
unload:
    @echo 1 >/proc/sys/net/ktcpvs/unload
    @sleep 2
    @rmmod tvs_hhttp
    @rmmod ktcpvs
endif

--------------------------------Makefile
ends---------------------------------------


The error goes like this :

--------------------------------Compile
Error-----------------------------------------
In file included from include/linux/tcp.h:178,
                 from /home/nipun/ktcpvs/new/ktcpvs/tcp_vs_http_trans.c:29:
include/net/inet_connection_sock.h: In function ‘inet_csk_clear_xmit_timer’:
include/net/inet_connection_sock.h:203: error: unknown field ‘Usage’
specified in initializer
include/net/inet_connection_sock.h:203: error: expected expression
before ‘.’ token
include/net/inet_connection_sock.h:203: error: ‘Usage’ undeclared
(first use in this function)
include/net/inet_connection_sock.h:203: error: (Each undeclared
identifier is reported only once
include/net/inet_connection_sock.h:203: error: for each function it appears in.)
include/net/inet_connection_sock.h:203: error: expected ‘)’ before ‘:’ token
include/net/inet_connection_sock.h:203: error: expected ‘)’ before ‘:’ token
include/net/inet_connection_sock.h: In function ‘inet_csk_reset_xmit_timer’:
include/net/inet_connection_sock.h:219: error: unknown field ‘Usage’
specified in initializer
include/net/inet_connection_sock.h:219: error: expected expression
before ‘.’ token
include/net/inet_connection_sock.h:219: error: ‘Usage’ undeclared
(first use in this function)
include/net/inet_connection_sock.h:219: error: expected ‘)’ before ‘:’ token
include/net/inet_connection_sock.h:219: error: expected ‘)’ before ‘:’ token
include/net/inet_connection_sock.h:236: error: unknown field ‘Usage’
specified in initializer
include/net/inet_connection_sock.h:236: error: expected expression
before ‘.’ token
include/net/inet_connection_sock.h:236: error: expected ‘)’ before ‘:’ token
include/net/inet_connection_sock.h:236: error: expected ‘)’ before ‘:’ token
make[2]: *** [/home/nipun/ktcpvs/new/ktcpvs/tcp_vs_http_trans.o] Error 1
make[1]: *** [_module_/home/nipun/ktcpvs/new/ktcpvs] Error 2
make[1]: Leaving directory `/home/nipun/linux-2.6.30'
make: *** [tcp_vs.ko] Error 2
------------------------Compile Error
Ends-----------------------------------------------

Following is the last line in output, before above error comes, of "make V=1" :

------------------------make
output--------------------------------------------------------------------
gcc -Wp,-MD,/home/nipun/ktcpvs/new/ktcpvs/.tcp_vs_http_trans.o.d
-nostdinc -isystem /usr/lib/gcc/i486-linux-gnu/4.3.3/include -Iinclude
 -I/home/nipun/linux-2.6.30/arch/x86/include -include
include/linux/autoconf.h -D__KERNEL__ -Wall -Wundef
-Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -O2 -m32 -msoft-float
-mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2
-march=i586 -mtune=generic -Wa,-mtune=generic32 -ffreestanding -pipe
-Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx
-mno-sse2 -mno-3dnow -fno-stack-protector -fno-omit-frame-pointer
-fno-optimize-sibling-calls -g -Wdeclaration-after-statement
-Wno-pointer-sign -fwrapv -DCONFIG_TCP_VS_DEBUG
-D"KBUILD_MODNAME=KBUILD_STR(tvsphttp_tvschttp_tvshttp)"  -DMODULE
-D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(tcp_vs_http_trans)"
 -D"DEBUG_HASH=Usage: ./scripts/basic/hash <djb2|r5> <modname>"
-D"DEBUG_HASH2=Usage: ./scripts/basic/hash <djb2|r5> <modname>" -c -o
/home/nipun/ktcpvs/new/ktcpvs/.tmp_tcp_vs_http_trans.o
/home/nipun/ktcpvs/new/ktcpvs/tcp_vs_http_trans.c
-----------------------make output
ends--------------------------------------------------------------

As you can see, there is no KBUILD_MODNAME defined. Another strange
this in above line is :
-D"DEBUG_HASH2=Usage: ./scripts/basic/hash <djb2|r5> <modname>"

In case of other files, it gave an integer value to this field.

It seems to me that the problem arises as there are multiple targets
in obj-m and they share "tcp_vs_http_trans.o" (but so is
"tcp_vs_http_parser.o", which is not causing any problems) . I tried
keeping objects, not involving this target at the same time, and the
build goes fine.

Please help me out. Thanks for reading such long post.

Cheers,
Nipun

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel

Reply via email to