Skip to contentSkip to conversation

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

DISCUSSION Miles Lane 4 participants 9 messages Jan 19, 2006 – Jan 20, 2006 Kconfig

lore
Share & tools
lore

Miles Lane

author
#0 lore raw

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

#1 lore raw
Quoted 13 lines · Miles Lane

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

Quoted 8 lines

\\* 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

author
#2 lore raw
Quoted 22 lines · Sam Ravnborg
Quoted 13 lines · Miles Lane

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

Quoted 8 lines

\\* 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

Quoted 7 lines

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

#3 lore raw
Quoted 10 lines · Miles Lane

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

#4 lore raw

Hi.

Quoted 1 line · Sam Ravnborg

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

#5 lore raw
In reply to Miles Lane
Quoted 8 lines · Miles Lane

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.

Signature · 3 lines
Pacific Internet (Australia) Pty Ltd
Business card: http://www.luyer.net/bc.html
Important notice: http://www.pacific.net.au/disclaimer/
author
#6 lore raw
Quoted 18 lines · David Luyer
Quoted 8 lines · Miles Lane

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
Quoted 7 lines

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

#7 lore raw
Quoted 5 lines · Miles Lane

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.

---

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

ec29b10f689f292accf9af0bc1c00e7815f6be7b

scripts/kconfig/lxdialog/Makefile +5 -2
index fae3e29..bbf4887 100644
@@ -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 
 
scripts/kconfig/lxdialog/check-lxdialog.sh +9 -5
index 448e353..120d624 100644
@@ -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
Signature · 1 line
1.0.GIT
author
#8 lore raw
In reply to Miles Lane
Quoted 5 lines · Miles Lane

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