public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* kbuild variable $(src) broken in 2.6.23-rc3?
@ 2008-05-21 14:42 tvrtko.ursulin
  2008-05-21 19:04 ` Sam Ravnborg
  2008-05-25  6:54 ` Sam Ravnborg
  0 siblings, 2 replies; 13+ messages in thread
From: tvrtko.ursulin @ 2008-05-21 14:42 UTC (permalink / raw)
  To: linux-kbuild; +Cc: sam

Hi Sam, all

What are the chances $(src) variable might be broken in 2.6.26-rc3? With 
an external module I am seeing it getting expanded to "" (null string) 
while the same pretty straightforward Makefile works fine with 2.6.25.

Thanks,

Tvrtko


Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
OX14 3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-21 14:42 kbuild variable $(src) broken in 2.6.23-rc3? tvrtko.ursulin
@ 2008-05-21 19:04 ` Sam Ravnborg
  2008-05-21 19:48   ` Andrea Arcangeli
  2008-05-25  6:54 ` Sam Ravnborg
  1 sibling, 1 reply; 13+ messages in thread
From: Sam Ravnborg @ 2008-05-21 19:04 UTC (permalink / raw)
  To: tvrtko.ursulin; +Cc: linux-kbuild, Andrea Arcangeli

On Wed, May 21, 2008 at 03:42:03PM +0100, tvrtko.ursulin@sophos.com wrote:
> Hi Sam, all
> 
> What are the chances $(src) variable might be broken in 2.6.26-rc3? With 
> an external module I am seeing it getting expanded to "" (null string) 
> while the same pretty straightforward Makefile works fine with 2.6.25.

Andrea Arcangeli <andrea@qumranet.com> reported a similar issue.
I have not gotten around to look at it yet.
I minimal Makefile that exhibits the problem
would be helpfull!

	Sam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-21 19:04 ` Sam Ravnborg
@ 2008-05-21 19:48   ` Andrea Arcangeli
  2008-05-28 19:09     ` Sam Ravnborg
  0 siblings, 1 reply; 13+ messages in thread
From: Andrea Arcangeli @ 2008-05-21 19:48 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: tvrtko.ursulin, linux-kbuild

On Wed, May 21, 2008 at 09:04:53PM +0200, Sam Ravnborg wrote:
> Andrea Arcangeli <andrea@qumranet.com> reported a similar issue.
> I have not gotten around to look at it yet.
> I minimal Makefile that exhibits the problem
> would be helpfull!

I don't have the minimal but I can easily provide you a way to
reproduce:

git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-userspace.git
cd kvm-userspace
patch -p1 -R <../belowinlinedworkaround
./configure --kerneldir=/usr/src/anykernel
cd kernel
make

The below has the benefit of making more robust and higher prio the
inclusion of external-module-compat so it may not to be backed out
after this 2.6.26-rc regression is fixed.

The problem is that the $(src) in the EXTRA_CFLAGS below is expanded
to "".

Thanks.

Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>

diff --git a/kernel/Kbuild b/kernel/Kbuild
index cabfc75..d9245eb 100644
--- a/kernel/Kbuild
+++ b/kernel/Kbuild
@@ -1,4 +1,3 @@
-EXTRA_CFLAGS := -I$(src)/include -include $(src)/external-module-compat.h
 obj-m := kvm.o kvm-intel.o kvm-amd.o
 kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o anon_inodes.o irq.o i8259.o \
 	 lapic.o ioapic.o preempt.o i8254.o external-module-compat.o
diff --git a/kernel/Makefile b/kernel/Makefile
index 78ff923..e3fccbe 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -27,7 +27,8 @@ all::
 #	include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat
 	$(MAKE) -C $(KERNELDIR) M=`pwd` \
 		LINUXINCLUDE="-I`pwd`/include -Iinclude -I`pwd`/include-compat \
-		-include include/linux/autoconf.h" \
+		-include include/linux/autoconf.h \
+		-include `pwd`/external-module-compat.h"
 		"$$@"
 
 sync: header-sync source-sync

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-21 14:42 kbuild variable $(src) broken in 2.6.23-rc3? tvrtko.ursulin
  2008-05-21 19:04 ` Sam Ravnborg
@ 2008-05-25  6:54 ` Sam Ravnborg
  2008-05-26 15:15   ` Rafael J. Wysocki
  1 sibling, 1 reply; 13+ messages in thread
From: Sam Ravnborg @ 2008-05-25  6:54 UTC (permalink / raw)
  To: tvrtko.ursulin, Rafael J. Wysocki; +Cc: linux-kbuild

Rafael.
Can you add this to your regression list.

Handled by me.

Thanks,
	Sam

On Wed, May 21, 2008 at 03:42:03PM +0100, tvrtko.ursulin@sophos.com wrote:
> Hi Sam, all
> 
> What are the chances $(src) variable might be broken in 2.6.26-rc3? With 
> an external module I am seeing it getting expanded to "" (null string) 
> while the same pretty straightforward Makefile works fine with 2.6.25.
> 
> Thanks,
> 
> Tvrtko
> 
> 
> Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
> OX14 3YP, United Kingdom.
> 
> Company Reg No 2096520. VAT Reg No GB 348 3873 20.
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-25  6:54 ` Sam Ravnborg
@ 2008-05-26 15:15   ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2008-05-26 15:15 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: tvrtko.ursulin, linux-kbuild

On Sunday, 25 of May 2008, Sam Ravnborg wrote:
> Rafael.

Hi,

Sorry for the late response.

> Can you add this to your regression list.
> 
> Handled by me.

Added as http://bugzilla.kernel.org/show_bug.cgi?id=10798 .

Thanks,
Rafael


> On Wed, May 21, 2008 at 03:42:03PM +0100, tvrtko.ursulin@sophos.com wrote:
> > Hi Sam, all
> > 
> > What are the chances $(src) variable might be broken in 2.6.26-rc3? With 
> > an external module I am seeing it getting expanded to "" (null string) 
> > while the same pretty straightforward Makefile works fine with 2.6.25.
> > 
> > Thanks,
> > 
> > Tvrtko
> > 
> > 
> > Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
> > OX14 3YP, United Kingdom.
> > 
> > Company Reg No 2096520. VAT Reg No GB 348 3873 20.
> > 
> 
> 



-- 
"Premature optimization is the root of all evil." - Donald Knuth

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-21 19:48   ` Andrea Arcangeli
@ 2008-05-28 19:09     ` Sam Ravnborg
  2008-05-28 19:13       ` Sam Ravnborg
  0 siblings, 1 reply; 13+ messages in thread
From: Sam Ravnborg @ 2008-05-28 19:09 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: tvrtko.ursulin, linux-kbuild

On Wed, May 21, 2008 at 09:48:08PM +0200, Andrea Arcangeli wrote:
> On Wed, May 21, 2008 at 09:04:53PM +0200, Sam Ravnborg wrote:
> > Andrea Arcangeli <andrea@qumranet.com> reported a similar issue.
> > I have not gotten around to look at it yet.
> > I minimal Makefile that exhibits the problem
> > would be helpfull!
> 
> I don't have the minimal but I can easily provide you a way to
> reproduce:
> 
> git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-userspace.git
> cd kvm-userspace
> patch -p1 -R <../belowinlinedworkaround
> ./configure --kerneldir=/usr/src/anykernel
> cd kernel
> make
> 
> The below has the benefit of making more robust and higher prio the
> inclusion of external-module-compat so it may not to be backed out
> after this 2.6.26-rc regression is fixed.
> 
> The problem is that the $(src) in the EXTRA_CFLAGS below is expanded
> to "".

I have now tried to reproduce this bug with no luck.
- I tried to clone the git tree and follow your instructions.
  But it failed to build due to some files missing in the
  kernel directory so I gace up on that.
- Then I tried to create a few Makefiles for an external
  module. I used a copy of the ext-2 filesystem and modifided
  the Makefile like below:
#
# Makefile for the linux ext2-filesystem routines.
#

obj-m += ext2.o

ext2-y := balloc.o dir.o file.o fsync.o ialloc.o inode.o \
          ioctl.o namei.o super.o symlink.o

EXTRA_CFLAGS := -I$(src)


Manually inspecting the command lines to gcc told me that $(src) was
properly expanded.

So something more subtle is going on.

Can I ask you to in an empty directory to create
a Makefile like this:
obj-m := foo.o
ccflags-y := -I$(src)

Another question. Do you use a -mm or -next kernel.
Or do you use a vanlla -linus kernel?

Because Andrew has some patches in -mm that may impact
how we handle -I but I do not have -mm available on this box.

	Sam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-28 19:09     ` Sam Ravnborg
@ 2008-05-28 19:13       ` Sam Ravnborg
  2008-05-28 20:18         ` Andrea Arcangeli
  0 siblings, 1 reply; 13+ messages in thread
From: Sam Ravnborg @ 2008-05-28 19:13 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: tvrtko.ursulin, linux-kbuild

On Wed, May 28, 2008 at 09:09:07PM +0200, Sam Ravnborg wrote:
> On Wed, May 21, 2008 at 09:48:08PM +0200, Andrea Arcangeli wrote:
> > On Wed, May 21, 2008 at 09:04:53PM +0200, Sam Ravnborg wrote:
> > > Andrea Arcangeli <andrea@qumranet.com> reported a similar issue.
> > > I have not gotten around to look at it yet.
> > > I minimal Makefile that exhibits the problem
> > > would be helpfull!
> > 
> > I don't have the minimal but I can easily provide you a way to
> > reproduce:
> > 
> > git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-userspace.git
> > cd kvm-userspace
> > patch -p1 -R <../belowinlinedworkaround
> > ./configure --kerneldir=/usr/src/anykernel
> > cd kernel
> > make
> > 
> > The below has the benefit of making more robust and higher prio the
> > inclusion of external-module-compat so it may not to be backed out
> > after this 2.6.26-rc regression is fixed.
> > 
> > The problem is that the $(src) in the EXTRA_CFLAGS below is expanded
> > to "".
> 
> I have now tried to reproduce this bug with no luck.
> - I tried to clone the git tree and follow your instructions.
>   But it failed to build due to some files missing in the
>   kernel directory so I gace up on that.
> - Then I tried to create a few Makefiles for an external
>   module. I used a copy of the ext-2 filesystem and modifided
>   the Makefile like below:
> #
> # Makefile for the linux ext2-filesystem routines.
> #
> 
> obj-m += ext2.o
> 
> ext2-y := balloc.o dir.o file.o fsync.o ialloc.o inode.o \
>           ioctl.o namei.o super.o symlink.o
> 
> EXTRA_CFLAGS := -I$(src)
> 
> 
> Manually inspecting the command lines to gcc told me that $(src) was
> properly expanded.
> 
> So something more subtle is going on.
> 
> Can I ask you to in an empty directory to create
> a Makefile like this:
> obj-m := foo.o
> ccflags-y := -I$(src)

[Forgot the rest of the instructions...]
touch foo.c

and then run:
make -C path/to/kernelsrc/ M=`pwd` V=1

Inspect the gcc commandlien to see if the last -I
contains the expected value (which is `pwd`)

	Sam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-28 19:13       ` Sam Ravnborg
@ 2008-05-28 20:18         ` Andrea Arcangeli
  2008-05-28 20:35           ` Sam Ravnborg
  2008-05-29 19:36           ` Sam Ravnborg
  0 siblings, 2 replies; 13+ messages in thread
From: Andrea Arcangeli @ 2008-05-28 20:18 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: tvrtko.ursulin, linux-kbuild

On Wed, May 28, 2008 at 09:13:15PM +0200, Sam Ravnborg wrote:
> Inspect the gcc commandlien to see if the last -I
> contains the expected value (which is `pwd`)

I can reproduce a failure, not sure if it's the same one but it ends
up with -I. Actually on the good build it seems the -I wasn't there at
all.

andrea@duo /tmp $ mkdir xx
andrea@duo /tmp $ cat x/Makefile
obj-m := foo.o
ccflags-y := -I$(src)
andrea@duo /tmp $ cat x/Makefile >xx/Makefile
andrea@duo /tmp $ touch xx/foo.c
andrea@duo /tmp $ cd xx
andrea@duo /tmp/xx $ make -C /home/andrea/kernel/linux-2.6-mmu M=`pwd` V=1
make: Entering directory `/crypto/home/andrea/devel/kernel/linux-2.6-mmu'
test -e include/linux/autoconf.h -a -e include/config/auto.conf || (            \
        echo;                                                           \
        echo "  ERROR: Kernel configuration is invalid.";               \
        echo "         include/linux/autoconf.h or include/config/auto.conf are missing.";      \
        echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
        echo;                                                           \
        /bin/false)
mkdir -p /tmp/xx/.tmp_versions ; rm -f /tmp/xx/.tmp_versions/*
make -f scripts/Makefile.build obj=/tmp/xx
   rm -f /tmp/xx/built-in.o; ar rcs /tmp/xx/built-in.o
  gcc -Wp,-MD,/tmp/xx/.foo.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2   -fno-stack-protector -m64  -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args  -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Iinclude/asm-x86/mach-default -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -I/tmp/xx   -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(foo)"  -D"KBUILD_MODNAME=KBUILD_STR(foo)" -c -o /tmp/xx/.tmp_foo.o /tmp/xx/foo.c
(cat /dev/null;   echo kernel//tmp/xx/foo.ko;) > /tmp/xx/modules.order
  Building modules, stage 2.
make -f /crypto/home/andrea/devel/kernel/linux-2.6-mmu/scripts/Makefile.modpost
  scripts/mod/modpost -m  -i /crypto/home/andrea/devel/kernel/linux-2.6-mmu/Module.symvers -I /tmp/xx/Module.symvers  -o /tmp/xx/Module.symvers -S   -w  -s
  gcc -Wp,-MD,/tmp/xx/.foo.mod.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2   -fno-stack-protector -m64  -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args  -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Iinclude/asm-x86/mach-default -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -I    -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(foo.mod)"  -D"KBUILD_MODNAME=KBUILD_STR(foo)" -DMODULE -c -o /tmp/xx/foo.mod.o /tmp/xx/foo.mod.c
/tmp/xx/foo.mod.c:9: error: implicit declaration of function `KBUILD_STR'
/tmp/xx/foo.mod.c:9: error: `foo' undeclared here (not in a function)
/tmp/xx/foo.mod.c:9: warning: missing braces around initializer
/tmp/xx/foo.mod.c:9: warning: (near initialization for `__this_module.name')
/tmp/xx/foo.mod.c:9: error: initializer element is not constant
/tmp/xx/foo.mod.c:9: error: (near initialization for `__this_module.name[0]')
make[1]: *** [/tmp/xx/foo.mod.o] Error 1
make: *** [modules] Error 2
make: Leaving directory `/crypto/home/andrea/devel/kernel/linux-2.6-mmu'


Here the same but on a distro .24 kernel:

make: Entering directory `/usr/src/linux-2.6.24-gentoo-r8'
test -e include/linux/autoconf.h -a -e include/config/auto.conf || (            \
        echo;                                                           \
        echo "  ERROR: Kernel configuration is invalid.";               \
        echo "         include/linux/autoconf.h or include/config/auto.conf are missing.";      \
        echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
        echo;                                                           \
        /bin/false)
mkdir -p /tmp/xx/.tmp_versions ; rm -f /tmp/xx/.tmp_versions/*
make -f scripts/Makefile.build obj=/tmp/xx
   rm -f /tmp/xx/built-in.o; ar rcs /tmp/xx/built-in.o
  gcc -Wp,-MD,/tmp/xx/.foo.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2   -m64 -mno-red-zone -mcmodel=kernel -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -funit-at-a-time -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -fomit-frame-pointer -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -I/tmp/xx   -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(foo)"  -D"KBUILD_MODNAME=KBUILD_STR(foo)" -c -o /tmp/xx/.tmp_foo.o /tmp/xx/foo.c
  Building modules, stage 2.
make -f /usr/src/linux-2.6.24-gentoo-r8/scripts/Makefile.modpost
  scripts/mod/modpost -m  -i /usr/src/linux-2.6.24-gentoo-r8/Module.symvers -I /tmp/xx/Module.symvers -o /tmp/xx/Module.symvers -w  -s
  gcc -Wp,-MD,/tmp/xx/.foo.mod.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2   -m64 -mno-red-zone -mcmodel=kernel -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -funit-at-a-time -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -fomit-frame-pointer -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign    -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(foo.mod)"  -D"KBUILD_MODNAME=KBUILD_STR(foo)" -DMODULE -c -o /tmp/xx/foo.mod.o /tmp/xx/foo.mod.c
  ld -r -m elf_x86_64  --build-id -o /tmp/xx/foo.ko /tmp/xx/foo.o /tmp/xx/foo.mod.o
make: Leaving directory `/usr/src/linux-2.6.24-gentoo-r8'

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-28 20:18         ` Andrea Arcangeli
@ 2008-05-28 20:35           ` Sam Ravnborg
  2008-05-29 19:36           ` Sam Ravnborg
  1 sibling, 0 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-05-28 20:35 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: tvrtko.ursulin, linux-kbuild

On Wed, May 28, 2008 at 10:18:03PM +0200, Andrea Arcangeli wrote:
> On Wed, May 28, 2008 at 09:13:15PM +0200, Sam Ravnborg wrote:
> > Inspect the gcc commandlien to see if the last -I
> > contains the expected value (which is `pwd`)
> 
> I can reproduce a failure, not sure if it's the same one but it ends
> up with -I. Actually on the good build it seems the -I wasn't there at
> all.

Now I see. So we suddenly started to include ccflags-y in the
modpost build - which we did no do before.
I will look at it tomorrow.

Thanks,
	Sam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-28 20:18         ` Andrea Arcangeli
  2008-05-28 20:35           ` Sam Ravnborg
@ 2008-05-29 19:36           ` Sam Ravnborg
  2008-05-30  9:27             ` tvrtko.ursulin
  2008-05-30 12:41             ` Andrea Arcangeli
  1 sibling, 2 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-05-29 19:36 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: tvrtko.ursulin, linux-kbuild

On Wed, May 28, 2008 at 10:18:03PM +0200, Andrea Arcangeli wrote:
> On Wed, May 28, 2008 at 09:13:15PM +0200, Sam Ravnborg wrote:
> > Inspect the gcc commandlien to see if the last -I
> > contains the expected value (which is `pwd`)
> 
> I can reproduce a failure, not sure if it's the same one but it ends
> up with -I. Actually on the good build it seems the -I wasn't there at
> all.

I tracked it down now (a simple bisect would have doen the trick too).
It was the introduction of KBUILD_EXTRA_SYMBOLS that caused
us troubles because we started to include the Makefile
in Makefile.modpost and thus ccflags-y (EXTRA_CFLAGS) were
assigned the value "-I$(src)" but $(src) was not defined so
we ended up with an empty -I which then picked up the following
parameter on the command line.

I cooked up the following fix:

diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index a098a04..28ef233 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -37,6 +37,10 @@
 # symbols in the final module linking stage
 # KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
 # This is solely usefull to speed up test compiles
+
+# Assign src as it may be used in ccflags-y
+src = .
+
 PHONY := _modpost
 _modpost: __modpost
 

Please let me know if this solves your problem or more issues reamin.

	Sam

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-29 19:36           ` Sam Ravnborg
@ 2008-05-30  9:27             ` tvrtko.ursulin
  2008-05-30 12:41             ` Andrea Arcangeli
  1 sibling, 0 replies; 13+ messages in thread
From: tvrtko.ursulin @ 2008-05-30  9:27 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Andrea Arcangeli, linux-kbuild

Sam Ravnborg <sam@ravnborg.org> wrote on 29/05/2008 20:36:58:

> On Wed, May 28, 2008 at 10:18:03PM +0200, Andrea Arcangeli wrote:
> > On Wed, May 28, 2008 at 09:13:15PM +0200, Sam Ravnborg wrote:
> > > Inspect the gcc commandlien to see if the last -I
> > > contains the expected value (which is `pwd`)
> > 
> > I can reproduce a failure, not sure if it's the same one but it ends
> > up with -I. Actually on the good build it seems the -I wasn't there at
> > all.
> 
> I tracked it down now (a simple bisect would have doen the trick too).
> It was the introduction of KBUILD_EXTRA_SYMBOLS that caused
> us troubles because we started to include the Makefile
> in Makefile.modpost and thus ccflags-y (EXTRA_CFLAGS) were
> assigned the value "-I$(src)" but $(src) was not defined so
> we ended up with an empty -I which then picked up the following
> parameter on the command line.
> 
> I cooked up the following fix:
> 
> diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
> index a098a04..28ef233 100644
> --- a/scripts/Makefile.modpost
> +++ b/scripts/Makefile.modpost
> @@ -37,6 +37,10 @@
>  # symbols in the final module linking stage
>  # KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
>  # This is solely usefull to speed up test compiles
> +
> +# Assign src as it may be used in ccflags-y
> +src = .
> +
>  PHONY := _modpost
>  _modpost: __modpost
> 
> 
> Please let me know if this solves your problem or more issues reamin.

For me this changes the output but $(src) is still wrong. Shouldn't it 
contain the thing passed in M ie. pwd?

Excerpts from make ... V=1 below.

2.6.26-rc3:
--------------------------------
  Building modules, stage 2.
make -f /usr/src/linux-2.6.26-rc3/scripts/Makefile.modpost
/root/talpa-0.9.46/Makefile:52: /src/app-ctrl/core/talpa-linux/common.mk: 
No such file or directory

2.6.26-rc3 with the above patch:
--------------------------------
  Building modules, stage 2.
make -f /usr/src/linux-2.6.26-rc3/scripts/Makefile.modpost
/root/talpa-0.9.46/Makefile:52: src/app-ctrl/core/talpa-linux/common.mk: 
No such file or directory

2.6.25:
--------------------------------
  Building modules, stage 2.
make -f /usr/src/linux-2.6.25/scripts/Makefile.modpost
scripts/mod/modpost   -i /usr/src/linux-2.6.25/Module.symvers -I 
/root/2.6.25/talpa-0.9.46/Module.symvers -o 
/root/2.6.25/talpa-0.9.46/Module.symvers -S   -w  -s

Tvrtko


Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
OX14 3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-29 19:36           ` Sam Ravnborg
  2008-05-30  9:27             ` tvrtko.ursulin
@ 2008-05-30 12:41             ` Andrea Arcangeli
  2008-05-30 12:52               ` tvrtko.ursulin
  1 sibling, 1 reply; 13+ messages in thread
From: Andrea Arcangeli @ 2008-05-30 12:41 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: tvrtko.ursulin, linux-kbuild

On Thu, May 29, 2008 at 09:36:58PM +0200, Sam Ravnborg wrote:
> On Wed, May 28, 2008 at 10:18:03PM +0200, Andrea Arcangeli wrote:
> > On Wed, May 28, 2008 at 09:13:15PM +0200, Sam Ravnborg wrote:
> > > Inspect the gcc commandlien to see if the last -I
> > > contains the expected value (which is `pwd`)
> > 
> > I can reproduce a failure, not sure if it's the same one but it ends
> > up with -I. Actually on the good build it seems the -I wasn't there at
> > all.
> 
> I tracked it down now (a simple bisect would have doen the trick too).
> It was the introduction of KBUILD_EXTRA_SYMBOLS that caused
> us troubles because we started to include the Makefile
> in Makefile.modpost and thus ccflags-y (EXTRA_CFLAGS) were
> assigned the value "-I$(src)" but $(src) was not defined so
> we ended up with an empty -I which then picked up the following
> parameter on the command line.
> 
> I cooked up the following fix:
> 
> diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
> index a098a04..28ef233 100644
> --- a/scripts/Makefile.modpost
> +++ b/scripts/Makefile.modpost
> @@ -37,6 +37,10 @@
>  # symbols in the final module linking stage
>  # KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
>  # This is solely usefull to speed up test compiles
> +
> +# Assign src as it may be used in ccflags-y
> +src = .
> +
>  PHONY := _modpost
>  _modpost: __modpost
>  

The module source is the src, so this fixes the build for KVM at least.

Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>

diff -r d99f6640491e scripts/Makefile.modpost
--- a/scripts/Makefile.modpost	Tue May 20 18:19:45 2008 +0200
+++ b/scripts/Makefile.modpost	Fri May 30 14:40:16 2008 +0200
@@ -37,6 +37,10 @@
 # symbols in the final module linking stage
 # KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
 # This is solely usefull to speed up test compiles
+
+# Assign src as it may be used in ccflags-y
+src = $(KBUILD_EXTMOD)
+
 PHONY := _modpost
 _modpost: __modpost
 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: kbuild variable $(src) broken in 2.6.23-rc3?
  2008-05-30 12:41             ` Andrea Arcangeli
@ 2008-05-30 12:52               ` tvrtko.ursulin
  0 siblings, 0 replies; 13+ messages in thread
From: tvrtko.ursulin @ 2008-05-30 12:52 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: linux-kbuild, Sam Ravnborg

Andrea Arcangeli <andrea@qumranet.com> wrote on 30/05/2008 13:41:11:

> On Thu, May 29, 2008 at 09:36:58PM +0200, Sam Ravnborg wrote:
> > I tracked it down now (a simple bisect would have doen the trick too).
> > It was the introduction of KBUILD_EXTRA_SYMBOLS that caused
> > us troubles because we started to include the Makefile
> > in Makefile.modpost and thus ccflags-y (EXTRA_CFLAGS) were
> > assigned the value "-I$(src)" but $(src) was not defined so
> > we ended up with an empty -I which then picked up the following
> > parameter on the command line.
> > 
> > I cooked up the following fix:
> > 
> > diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
> > index a098a04..28ef233 100644
> > --- a/scripts/Makefile.modpost
> > +++ b/scripts/Makefile.modpost
> > @@ -37,6 +37,10 @@
> >  # symbols in the final module linking stage
> >  # KBUILD_MODPOST_NOFINAL can be set to skip the final link of 
modules.
> >  # This is solely usefull to speed up test compiles
> > +
> > +# Assign src as it may be used in ccflags-y
> > +src = .
> > +
> >  PHONY := _modpost
> >  _modpost: __modpost
> > 
> 
> The module source is the src, so this fixes the build for KVM at least.
> 
> Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>
> 
> diff -r d99f6640491e scripts/Makefile.modpost
> --- a/scripts/Makefile.modpost   Tue May 20 18:19:45 2008 +0200
> +++ b/scripts/Makefile.modpost   Fri May 30 14:40:16 2008 +0200
> @@ -37,6 +37,10 @@
>  # symbols in the final module linking stage
>  # KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
>  # This is solely usefull to speed up test compiles
> +
> +# Assign src as it may be used in ccflags-y
> +src = $(KBUILD_EXTMOD)
> +
>  PHONY := _modpost
>  _modpost: __modpost

This works for me as well.

Tvrtko



Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
OX14 3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-05-30 12:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 14:42 kbuild variable $(src) broken in 2.6.23-rc3? tvrtko.ursulin
2008-05-21 19:04 ` Sam Ravnborg
2008-05-21 19:48   ` Andrea Arcangeli
2008-05-28 19:09     ` Sam Ravnborg
2008-05-28 19:13       ` Sam Ravnborg
2008-05-28 20:18         ` Andrea Arcangeli
2008-05-28 20:35           ` Sam Ravnborg
2008-05-29 19:36           ` Sam Ravnborg
2008-05-30  9:27             ` tvrtko.ursulin
2008-05-30 12:41             ` Andrea Arcangeli
2008-05-30 12:52               ` tvrtko.ursulin
2008-05-25  6:54 ` Sam Ravnborg
2008-05-26 15:15   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox