原文:http://www.linuxquestions.org/questions/linux-from-scratch-13/gcc-error-in-chapter-5-a-632919/
/[^
mawk: scripts/gen-sorted.awk: line 19: syntax error at or near ]
mawk: scripts/gen-sorted.awk: line 19: runaway regular expression /, "", subd ...
make[1]: Leaving directory `/mnt/lfs/sources/glibc-2.5.1'
make[1]: Entering directory `/mnt/lfs/sources/glibc-2.5.1'
mawk -f scripts/gen-sorted.awk /
-v subdirs='csu assert ctype locale intl catgets math setjmp signal stdlib stdio-common libio malloc string wcsmbs time dirent grp pwd posix io termios resource misc socket sysvipc gmon gnulib iconv iconvdata wctype manual shadow po argp crypt nss localedata timezone rt conform debug dlfcn elf' /
-v srcpfx='' /
nptl/sysdeps/pthread/Subdirs sysdeps/unix/inet/Subdirs sysdeps/unix/Subdirs assert/Depend intl/Depend catgets/Depend stdlib/Depend stdio-common/Depend libio/Depend malloc/Depend string/Depend wcsmbs/Depend time/Depend posix/Depend iconvdata/Depend nss/Depend localedata/Depend rt/Depend debug/Depend > /mnt/lfs/sources/glibc-build/sysd-sorted-tmp
mawk: scripts/gen-sorted.awk: line 19: regular expression compile failed (bad class -- [], [^] or [)
/[^
mawk: scripts/gen-sorted.awk: line 19: syntax error at or near ]
mawk: scripts/gen-sorted.awk: line 19: runaway regular expression /, "", subd ...
rm -f /mnt/lfs/sources/glibc-build/stamp.o; > /mnt/lfs/sources/glibc-build/stamp.o
rm -f /mnt/lfs/sources/glibc-build/stamp.os; > /mnt/lfs/sources/glibc-build/stamp.os
rm -f /mnt/lfs/sources/glibc-build/stamp.oS; > /mnt/lfs/sources/glibc-build/stamp.oS
cd /mnt/lfs/sources/glibc-build && /tools/bin/ar cruv libc.a `cat stamp.o`
: /mnt/lfs/sources/glibc-build/libc.a
cd /mnt/lfs/sources/glibc-build && /tools/bin/ar cruv libc_pic.a `cat stamp.os`
: /mnt/lfs/sources/glibc-build/libc_pic.a
cd /mnt/lfs/sources/glibc-build && /tools/bin/ar cruv libc_nonshared.a `cat stamp.oS`
: /mnt/lfs/sources/glibc-build/libc_nonshared.a
make[1]: *** No rule to make target `/mnt/lfs/sources/glibc-build/Versions.all', needed by `/mnt/lfs/sources/glibc-build/abi-versions.h'. Stop.
make[1]: Leaving directory `/mnt/lfs/sources/glibc-2.5.1'
make: *** [all] Error 2
lfs@ameya-desktop:/mnt/lfs/sources/glibc-build$
解决方法:
I don't know if you have found an answer yet or not, but here is what worked for me:
I modified line 19 of the scripts/gen-sorted.awk from sub(///[^/]+$/, "", subdir); to sub(///[^//]+$/, "", subdir); it seems that the forward-slash within the square brackets needs to be escaped. This issue will crop up 2 more times in the script, around lines 60 and 64. After those modifications, the make command worked fine.
I'm building LFS 6.3 on an eMac (PPC) running Ubuntu 7.04 kernel 2.6.20-16-powerpc
说明:
实际上是scripts/gen-sorted.awk脚本写的不严谨导致的,更新版本的gawk或者mawk上对语法检查更严格导致出错。