2006-01-19 06:47:15

by Miles Lane

[permalink] [raw]
Subject: 2.6.16-rc1-git1 -- Build error "make: *** [include/linux/version.h] Error 2"

make all install modules modules_install
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `set -e; echo ' CHK
include/linux/version.h'; mkdir -p include/linux/; if [ `echo -n
"2.6.16-rc1-git1 .file null .ident
GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
.note.GNU-stack,,@progbits" | wc -c ` -gt 64 ]; then echo
'"2.6.16-rc1-git1 .file null .ident
GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
.note.GNU-stack,,@progbits" exceeds 64 characters' >&2; exit 1; fi;
(echo \#define UTS_RELEASE \"2.6.16-rc1-git1 .file null .ident
GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
.note.GNU-stack,,@progbits\"; echo \#define LINUX_VERSION_CODE `expr 2
\\* 65536 + 6 \\* 256 + 16`; echo '#define KERNEL_VERSION(a,b,c) (((a)
<< 16) + ((b) << 8) + (c))'; ) < /usr/src/linux-2.6/Makefile >
include/linux/version.h.tmp; if [ -r include/linux/version.h ] && cmp
-s include/linux/version.h include/linux/version.h.tmp; then rm -f
include/linux/version.h.tmp; else echo ' UPD
include/linux/version.h'; mv -f include/linux/version.h.tmp
include/linux/version.h; fi'
make: *** [include/linux/version.h] Error 2


2006-01-19 07:35:25

by Sam Ravnborg

[permalink] [raw]
Subject: Re: 2.6.16-rc1-git1 -- Build error "make: *** [include/linux/version.h] Error 2"

On Wed, Jan 18, 2006 at 10:47:13PM -0800, Miles Lane wrote:
> make all install modules modules_install
> /bin/sh: -c: line 0: syntax error near unexpected token `('
> /bin/sh: -c: line 0: `set -e; echo ' CHK
> include/linux/version.h'; mkdir -p include/linux/; if [ `echo -n
> "2.6.16-rc1-git1 .file null .ident
> GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
> .note.GNU-stack,,@progbits" | wc -c ` -gt 64 ]; then echo
> '"2.6.16-rc1-git1 .file null .ident
> GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
> .note.GNU-stack,,@progbits" exceeds 64 characters' >&2; exit 1; fi;
> (echo \#define UTS_RELEASE \"2.6.16-rc1-git1 .file null .ident
> GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
> .note.GNU-stack,,@progbits\"; echo \#define LINUX_VERSION_CODE `expr 2
> \\* 65536 + 6 \\* 256 + 16`; echo '#define KERNEL_VERSION(a,b,c) (((a)
> << 16) + ((b) << 8) + (c))'; ) < /usr/src/linux-2.6/Makefile >
> include/linux/version.h.tmp; if [ -r include/linux/version.h ] && cmp
> -s include/linux/version.h include/linux/version.h.tmp; then rm -f
> include/linux/version.h.tmp; else echo ' UPD
> include/linux/version.h'; mv -f include/linux/version.h.tmp
> include/linux/version.h; fi'
> make: *** [include/linux/version.h] Error 2
Do you have any file in your build directory named localversion* ?
That would explain the loon line that includes
".file null .ident GCC: ..."

Otherwise something else goes in and trigger the long localversion.
The variable CONFIG_LOCALVERSION may also be set to a wrong value in
your environment but this is unlikely.

Sam

2006-01-19 09:15:52

by Miles Lane

[permalink] [raw]
Subject: Re: 2.6.16-rc1-git1 -- Build error "make: *** [include/linux/version.h] Error 2"

On 1/18/06, Sam Ravnborg <[email protected]> wrote:
> On Wed, Jan 18, 2006 at 10:47:13PM -0800, Miles Lane wrote:
> > make all install modules modules_install
> > /bin/sh: -c: line 0: syntax error near unexpected token `('
> > /bin/sh: -c: line 0: `set -e; echo ' CHK
> > include/linux/version.h'; mkdir -p include/linux/; if [ `echo -n
> > "2.6.16-rc1-git1 .file null .ident
> > GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
> > .note.GNU-stack,,@progbits" | wc -c ` -gt 64 ]; then echo
> > '"2.6.16-rc1-git1 .file null .ident
> > GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
> > .note.GNU-stack,,@progbits" exceeds 64 characters' >&2; exit 1; fi;
> > (echo \#define UTS_RELEASE \"2.6.16-rc1-git1 .file null .ident
> > GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
> > .note.GNU-stack,,@progbits\"; echo \#define LINUX_VERSION_CODE `expr 2
> > \\* 65536 + 6 \\* 256 + 16`; echo '#define KERNEL_VERSION(a,b,c) (((a)
> > << 16) + ((b) << 8) + (c))'; ) < /usr/src/linux-2.6/Makefile >
> > include/linux/version.h.tmp; if [ -r include/linux/version.h ] && cmp
> > -s include/linux/version.h include/linux/version.h.tmp; then rm -f
> > include/linux/version.h.tmp; else echo ' UPD
> > include/linux/version.h'; mv -f include/linux/version.h.tmp
> > include/linux/version.h; fi'
> > make: *** [include/linux/version.h] Error 2
> Do you have any file in your build directory named localversion* ?
> That would explain the loon line that includes
> ".file null .ident GCC: ..."
>
> Otherwise something else goes in and trigger the long localversion.
> The variable CONFIG_LOCALVERSION may also be set to a wrong value in
> your environment but this is unlikely.

I don't have any localversion* files in the build directory.
I do have .kernelrelease that contains:
"2.6.16-rc1-mm1 .file null .ident
GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
.note.GNU-stack,,@progbits"
I tried deleting it, but it gets recreated.

I'm pretty frustrated. I have built hundreds of kernels and have not
hit this problem before.

Any help is most appreciated!
Miles

2006-01-19 09:23:31

by Sam Ravnborg

[permalink] [raw]
Subject: Re: 2.6.16-rc1-git1 -- Build error "make: *** [include/linux/version.h] Error 2"

On Thu, Jan 19, 2006 at 01:15:49AM -0800, Miles Lane wrote:
> I do have .kernelrelease that contains:
> "2.6.16-rc1-mm1 .file null .ident
> GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
> .note.GNU-stack,,@progbits"
> I tried deleting it, but it gets recreated.
>
> I'm pretty frustrated. I have built hundreds of kernels and have not
> hit this problem before.
>
> Any help is most appreciated!
This can also be a side-effect of /dev/null being damaged.
In scripts/kconfig/lxdialog/check-lxdialog.sh we do:
echo main() {} | gcc -nncursesw -cx - -o /dev/null

I could imagine that your /dev/null has become a regular file and is now
filled with garbage.
And then the trick:
cat /dev/null $(wildcard .kernelrelease)
causes KERNELRELEASE to be full of crap.

Care to check that?

I have not a patch ready to fix the /dev/null issue - later today.

Sam

2006-01-19 11:06:09

by David Luyer

[permalink] [raw]
Subject: Re: 2.6.16-rc1-git1 -- Build error "make: *** [include/linux/version.h] Error 2"

On Wed, Jan 18, 2006 at 10:47:13PM -0800, Miles Lane wrote:
> make all install modules modules_install
> /bin/sh: -c: line 0: syntax error near unexpected token `('
> /bin/sh: -c: line 0: `set -e; echo ' CHK
> include/linux/version.h'; mkdir -p include/linux/; if [ `echo -n
> "2.6.16-rc1-git1 .file null .ident
> GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
> .note.GNU-stack,,@progbits" | wc -c ` -gt 64 ]; then echo
> '"2.6.16-rc1-git1 .file null .ident
[...]

Happens for me also (on latest snapshot).

/dev/null is removed by this line in check-lxdialog.sh during a
'make menuconfig':

echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null

This only happens if you don't have a libncursesw installed (not sure
if it is compiler dependant as well).

/dev/null being removed has many side-effects, this is just one of them.

Obviously 'cd /dev; ./MAKEDEV null' will fix. Oh, and fixing the script
would be useful too ;-)

David.
--
Pacific Internet (Australia) Pty Ltd
Business card: http://www.luyer.net/bc.html
Important notice: http://www.pacific.net.au/disclaimer/

2006-01-19 19:59:29

by Miles Lane

[permalink] [raw]
Subject: Re: 2.6.16-rc1-git1 -- Build error "make: *** [include/linux/version.h] Error 2"

On 1/19/06, David Luyer <[email protected]> wrote:
> On Wed, Jan 18, 2006 at 10:47:13PM -0800, Miles Lane wrote:
> > make all install modules modules_install
> > /bin/sh: -c: line 0: syntax error near unexpected token `('
> > /bin/sh: -c: line 0: `set -e; echo ' CHK
> > include/linux/version.h'; mkdir -p include/linux/; if [ `echo -n
> > "2.6.16-rc1-git1 .file null .ident
> > GCC:(GNU)4.0.320060115(prerelease)(Ubuntu4.0.2-7ubuntu1) .section
> > .note.GNU-stack,,@progbits" | wc -c ` -gt 64 ]; then echo
> > '"2.6.16-rc1-git1 .file null .ident
> [...]
>
> Happens for me also (on latest snapshot).
>
> /dev/null is removed by this line in check-lxdialog.sh during a
> 'make menuconfig':
>
> echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null
>
> This only happens if you don't have a libncursesw installed (not sure
> if it is compiler dependant as well).
>
> /dev/null being removed has many side-effects, this is just one of them.
>
> Obviously 'cd /dev; ./MAKEDEV null' will fix. Oh, and fixing the script
> would be useful too ;-)

I checked and /dev/null exists. I also have libncursesw5 installed.
Oddly, I rebooted and when I ran make, the build proceeded. I quit
and ran "make menuconfig" again. As you suggested, this did break
my build process as before. I had to reboot in order to complete the
build process. Any other possibilities?

Thanks!
Miles

2006-01-19 20:07:31

by Sam Ravnborg

[permalink] [raw]
Subject: Re: 2.6.16-rc1-git1 -- Build error "make: *** [include/linux/version.h] Error 2"

On Thu, Jan 19, 2006 at 11:59:26AM -0800, Miles Lane wrote:

> I checked and /dev/null exists. I also have libncursesw5 installed.
> Oddly, I rebooted and when I ran make, the build proceeded. I quit
> and ran "make menuconfig" again. As you suggested, this did break
> my build process as before. I had to reboot in order to complete the
> build process. Any other possibilities?

I've just posted a patch to fix it.
Included below also.

Subject: [PATCH 1/3] kconfig: fix /dev/null breakage

While running "make menuconfig" and "make mrproper"
some people experienced that /dev/null suddenly changed
permissions or suddenly became a regular file.
The main reason was that /dev/null was used as output
to gcc in the check-lxdialog.sh script and gcc did
some strange things with the output file; in this
case /dev/null when it errorred out.

Following patch implements a suggestion
from Bryan O'Sullivan <[email protected]> to
use gcc -print-file-name=libxxx.so.

Also the Makefile is adjusted to not resolve value of
HOST_EXTRACFLAGS and HOST_LOADLIBES until they are actually used.
This prevents us from calling gcc when running make *clean/mrproper

Thanks to Eyal Lebedinsky <[email protected]> and
Jean Delvare <[email protected]> for the first error reports.

Signed-off-by: Sam Ravnborg <[email protected]>

---

scripts/kconfig/lxdialog/Makefile | 7 +++++--
scripts/kconfig/lxdialog/check-lxdialog.sh | 14 +++++++++-----
2 files changed, 14 insertions(+), 7 deletions(-)

ec29b10f689f292accf9af0bc1c00e7815f6be7b
diff --git a/scripts/kconfig/lxdialog/Makefile b/scripts/kconfig/lxdialog/Makefile
index fae3e29..bbf4887 100644
--- a/scripts/kconfig/lxdialog/Makefile
+++ b/scripts/kconfig/lxdialog/Makefile
@@ -2,8 +2,11 @@
#

check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh
-HOST_EXTRACFLAGS:= $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
-HOST_LOADLIBES := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
+
+# Use reursively expanded variables so we do not call gcc unless
+# we really need to do so. (Do not call gcc as part of make mrproper)
+HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
+HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))

HOST_EXTRACFLAGS += -DLOCALE

diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 448e353..120d624 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -4,17 +4,17 @@
# What library to link
ldflags()
{
- echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null
+ $cc -print-file-name=libncursesw.so | grep -q /
if [ $? -eq 0 ]; then
echo '-lncursesw'
exit
fi
- echo "main() {}" | $cc -lncurses -xc - -o /dev/null 2> /dev/null
+ $cc -print-file-name=libncurses.so | grep -q /
if [ $? -eq 0 ]; then
echo '-lncurses'
exit
fi
- echo "main() {}" | $cc -lcurses -xc - -o /dev/null 2> /dev/null
+ $cc -print-file-name=libcurses.so | grep -q /
if [ $? -eq 0 ]; then
echo '-lcurses'
exit
@@ -36,10 +36,13 @@ ccflags()
fi
}

-compiler=""
+# Temp file, try to clean up after us
+tmp=.lxdialog.tmp
+trap "rm -f $tmp" 0 1 2 3 15
+
# Check if we can link to ncurses
check() {
- echo "main() {}" | $cc -xc - -o /dev/null 2> /dev/null
+ echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null
if [ $? != 0 ]; then
echo " *** Unable to find the ncurses libraries." 1>&2
echo " *** make menuconfig require the ncurses libraries" 1>&2
@@ -59,6 +62,7 @@ if [ $# == 0 ]; then
exit 1
fi

+cc=""
case "$1" in
"-check")
shift
--
1.0.GIT

2006-01-19 20:12:14

by Miles Lane

[permalink] [raw]
Subject: Re: 2.6.16-rc1-git1 -- Build error "make: *** [include/linux/version.h] Error 2"

On 1/19/06, Miles Lane <[email protected]> wrote:
> I checked and /dev/null exists. I also have libncursesw5 installed.
> Oddly, I rebooted and when I ran make, the build proceeded. I quit
> and ran "make menuconfig" again. As you suggested, this did break
> my build process as before. I had to reboot in order to complete the
> build process. Any other possibilities?

Huh. Weird. Now it is all happy. I did install libncursesw5-dev
last night, but I was able to reproduce the problem afterwards.
I allowed one full build to complete, ran make (clean, menuconfig,
and all) and it is still working. Go figure.

Miles

2006-01-20 06:47:29

by Nigel Cunningham

[permalink] [raw]
Subject: Re: 2.6.16-rc1-git1 -- Build error "make: *** [include/linux/version.h] Error 2"

Hi.

On Thursday 19 January 2006 19:23, Sam Ravnborg wrote:
> This can also be a side-effect of /dev/null being damaged.

I had precisely this problem last night. No idea what caused it, but that was
the issue. Wish I'd seen your email before I wasted time finding the
cause! :)

Nigel