Bug 38805 - sed Unterminated `s' command
Summary: sed Unterminated `s' command
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-11 15:17 UTC by Thomas Jourdan
Modified: 2009-01-17 15:23 UTC (History)
3 users (show)

See Also:
Host: i386-pc-solaris2.11
Target: i686-nptl-linux-gnu
Build: i386-pc-solaris2.11
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Configure and build log (586.83 KB, application/octet-stream)
2009-01-13 20:50 UTC, Thomas Jourdan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Jourdan 2009-01-11 15:17:44 UTC
While configuring in the ./gcc directory, I have the following messages :

Links are now set up to build a cross-compiler
 from i386-build_pc-solaris2.11 to i686-nptl-linux-gnu.
updating cache ./config.cache
configure: creating ./config.status
config.status: creating as
sed: file ./confstatGfaGVq/subs-5.sed line 7: unterminated `s' command
config.status: creating collect-ld
sed: file ./confstatGfaGVq/subs-5.sed line 7: unterminated `s' command
config.status: creating nm
sed: file ./confstatGfaGVq/subs-5.sed line 7: unterminated `s' command
config.status: creating Makefile
sed: file ./confstatGfaGVq/subs-5.sed line 7: unterminated `s' command
config.status: creating gccbug
sed: file ./confstatGfaGVq/subs-5.sed line 7: unterminated `s' command
config.status: creating libada-mk
sed: file ./confstatGfaGVq/subs-5.sed line 7: unterminated `s' command
config.status: creating ada/Makefile
sed: file ./confstatGfaGVq/subs-5.sed line 7: unterminated `s' command
config.status: creating auto-host.h
config.status: executing default commands

Then it generates 0 byte Makefiles in the subdirectories. It seems to be related to the ac_max_sed_line variable but I can not find a correct solution to fix it. 

sed version is GNU sed 4.1.5
automake version is GNU automake 1.10.1
autoconf version is GNU autoconf 2.61
libtool version is GNU libtool 2.2.6

On my ubuntu 8.10 box it will build fine with the same options (and same programs versions).

Any hints ?
Comment 1 Thomas Jourdan 2009-01-11 15:19:16 UTC
Mistake in bug description :
host = i386-pc-solaris2.11
build = i386-pc-solaris2.11
target = i686-nptl-linux-gnu

This is a cross build
Comment 2 Andrew Pinski 2009-01-13 00:59:45 UTC
How did you invoke configure?  How did you invoke GNU make?
Comment 3 Andrew Pinski 2009-01-13 01:01:17 UTC
for ac_var in `(set) 2>&1 |
               sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do

Comment 4 Ralf Wildenhues 2009-01-13 13:05:27 UTC
(In reply to comment #3)
> for ac_var in `(set) 2>&1 |
>                sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
> 

That happens much earlier than the posted errors.

Thomas, please print the full name of the directory you are configuring in,
and the exact command line you are using to configure and build the GCC tree.

Thanks,
Ralf
Comment 5 Thomas Jourdan 2009-01-13 20:50:48 UTC
Created attachment 17093 [details]
Configure and build log

This patch contains the full build log of the cross tool chain.
Comment 6 Thomas Jourdan 2009-01-13 21:11:31 UTC
Hi all,

First of all, thanks for answering so quickly.

I am using crosstool-ng (http://ymorin.is-a-geek.org/dokuwiki/projects/crosstool) scripts to build my cross tool chain. It works greats (with the same gcc / binutils / libc configuration) under linux but I am trying to make it works on other OS. Today, this is OpenSolaris.

I attached the full (and big) log. The error is visible at line 102477. To summarize, the compiler is configured with :

CC_FOR_BUILD="i386-build_pc-solaris2.11-gcc"
CFLAGS="-pipe"
/export/home/thomas/workspace/cdk/i686/targets/src/gcc-4.3.2/configure 
    --build=i386-build_pc-solaris2.11 
    --host=i386-build_pc-solaris2.11 
    --target=i686-nptl-linux-gnu 
    --prefix=/export/home/thomas/workspace/cdk/i686/targets/i686-nptl-linux-gnu/build/gcc-core-static 
    --with-local-prefix=/export/home/thomas/x-tools/i686-nptl-linux-gnu/i686-nptl-linux-gnu/sys-root 
    --disable-multilib 
    --with-sysroot=/export/home/thomas/x-tools/i686-nptl-linux-gnu/i686-nptl-linux-gnu/sys-root 
    --with-newlib 
    --enable-threads=no 
    --disable-shared 
    --with-arch=i686 
    --with-gmp=/export/home/thomas/x-tools/i686-nptl-linux-gnu 
    --with-mpfr=/export/home/thomas/x-tools/i686-nptl-linux-gnu 
    --enable-__cxa_atexit 
    --disable-nls 
    --enable-symvers=gnu 
    --enable-languages=c 
    --enable-target-optspace
make all-gcc
make install-gcc

The configure goes fine but make all-gcc will run the configure fragment in the gcc subdirectory. You can see the problem by running make configure-host instead of make all-gcc.

The same thing works fine on my ubuntu box.
Comment 7 Ralf Wildenhues 2009-01-14 18:02:10 UTC
Please go into the gcc directory in the build tree and confirm that
  ./config.status

reproduces the errors (ignore further errors).  If yes, then please show
the output of
  ./config.status -d
  wc confstat*/*

If any of the sed scripts are longer than roughly 6KB, or have line lengths
over 4000 bytes, then try /usr/xpg4/bin/sed (put /usr/xpg4/bin early in PATH).
Or try GNU sed.  Solaris' seds are rather limited, although the configure
scripts should usually work around most known issues.  The @gcc_config_arguments@ substitution line could be rather long in your case.

If all sed programs show the same error, then please post the sed script
that causes it (the 'config.status -d' left it behind in that temporary
subdir).


BTW, your build log shows that you are patching the GCC sources quite a bit:

...
[DEBUG]    Applying patch '/export/home/thomas/workspace/ct-ng/trunk/patches/gcc/4.3.2/130-cross-compile.patch'
[DEBUG]    ==> Executing: 'patch -g0 -F1 -p1 -f'
[ALL  ]    patching file gcc/configure
[ALL  ]    patching file gcc/configure.ac
...
[DEBUG]    Applying patch '/export/home/thomas/workspace/ct-ng/trunk/patches/gcc/4.3.2/250-sh-pr24836.patch'
[DEBUG]    ==> Executing: 'patch -g0 -F1 -p1 -f'
[ALL  ]    patching file gcc/configure
[ALL  ]    patching file gcc/configure.ac
...

Please prove that none of the several dozen patches are relevant to this issue.
Comment 8 Thomas Jourdan 2009-01-14 20:45:38 UTC
Hi all

I did my homework tonight and I found the problem, thanks to your help. For other purposes, I had to export a function in my shell this way :

---8<---
function install() { ginstall "$@"; }
export -f install
---8<---

To fool a configure script (not related to gcc) which needed GNU install instead of SunOS install.

I had no knowledge of `config.status -d`, but this helped me a lot. I've been able to see the confstat temporary files and figure out the problem. Thanks for pointing this out, this will help me a lot to debug ct-ng and cross tool chain building.

Thanks again for your help and sorry for the false alarm !

Regards,
Thomas
Comment 9 Ralf Wildenhues 2009-01-15 07:16:33 UTC
> I had no knowledge of `config.status -d`, but this helped me a lot. I've been
> able to see the confstat temporary files and figure out the problem. Thanks for
> pointing this out, this will help me a lot to debug ct-ng and cross tool chain
> building.

Would you be so nice and show the actual problem and the fix you used,
so that others can profit, too?
Comment 10 Thomas Jourdan 2009-01-17 15:23:39 UTC
Hi

My mistake was to export a function in the bash to fool a shell script. But then I configured GCC without removing it.

I did :

function install() { ginstall "$@"; }
export -f install

Then I configured GCC, which led to the problem. Thanks to Ralf :

./config.status -d
config.status: creating as
sed: file ./confstatg0aq6N/subs-5.sed line 7: unterminated `s' command
config.status: creating collect-ld
sed: file ./confstatg0aq6N/subs-5.sed line 7: unterminated `s' command
config.status: creating nm
sed: file ./confstatg0aq6N/subs-5.sed line 7: unterminated `s' command
config.status: creating Makefile
sed: file ./confstatg0aq6N/subs-5.sed line 7: unterminated `s' command
config.status: creating gccbug
sed: file ./confstatg0aq6N/subs-5.sed line 7: unterminated `s' command
config.status: creating libada-mk
sed: file ./confstatg0aq6N/subs-5.sed line 7: unterminated `s' command
config.status: creating ada/Makefile
sed: file ./confstatg0aq6N/subs-5.sed line 7: unterminated `s' command
config.status: creating auto-host.h
config.status: auto-host.h is unchanged
config.status: executing default commands

Then we can see the output file :

cat confstatg0aq6N/subs-5.sed 
:t
  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s,@host_xm_file_list@, auto-host.h $(srcdir)/../include/ansidecl.h,;t t
s,@host_xm_include_list@, auto-host.h ansidecl.h,;t t
s,@host_xm_defines@,,;t t
s,@out_host_hook_obj@,host-solaris.o,;t t
s,@install@,() {  ginstall "$@"
},;t t
s,@lang_opt_files@, /export/home/thomas/workspace/cdk/i686/targets/src/gcc-4.3.2/gcc/ada/lang.opt /export/home/thomas/workspace/cdk/i686/targets/src/gcc-4.3.2/gcc/fortran/lang.opt /export/home/thomas/workspace/cdk/i686/targets/src/gcc-4.3.2/gcc/java/lang.opt /export/home/thomas/workspace/cdk/i686/targets/src/gcc-4.3.2/gcc/treelang/lang.opt,;t t
s,@lang_specs_files@,,;t t
s,@lang_tree_files@, /export/home/thomas/workspace/cdk/i686/targets/src/gcc-4.3.2/gcc/ada/ada-tree.def /export/home/thomas/workspace/cdk/i686/targets/src/gcc-4.3.2/gcc/cp/cp-tree.def /export/home/thomas/workspace/cdk/i686/targets/src/gcc-4.3.2/gcc/java/java-tree.def /export/home/thomas/workspace/cdk/i686/targets/src/gcc-4.3.2/gcc/objc/objc-tree.def,;t t
s,@local_prefix@,/export/home/thomas/x-tools/i686-nptl-linux-gnu/i686-nptl-linux-gnu/sys-root,;t t
s,@md_file@,i386/i386.md,;t t
s,@objc_boehm_gc@,,;t t
s,@out_file@,i386/i386.c,;t t
s,@out_object_file@,i386.o,;t t
s,@thread_file@,single,;t t
s,@tm_file_list@,options.h $(srcdir)/config/i386/i386.h $(srcdir)/config/i386/unix.h $(srcdir)/config/i386/att.h $(srcdir)/config/dbxelf.h $(srcdir)/config/elfos.h $(srcdir)/config/svr4.h $(srcdir)/config/linux.h $(srcdir)/config/i386/linux.h $(srcdir)/defaults.h,;t t
s,@tm_include_list@,options.h config/i386/i386.h config/i386/unix.h config/i386/att.h config/dbxelf.h config/elfos.h config/svr4.h config/linux.h config/i386/linux.h defaults.h,;t t
s,@tm_defines@, UCLIBC_DEFAULT=0,;t t
s,@tm_p_file_list@, $(srcdir)/config/i386/i386-protos.h tm-preds.h,;t t
s,@tm_p_include_list@, config/i386/i386-protos.h tm-preds.h,;t t
s,@xm_file_list@, auto-host.h $(srcdir)/../include/ansidecl.h,;t t
s,@xm_include_list@, auto-host.h ansidecl.h,;t t
s,@xm_defines@,,;t t
s,@c_target_objs@,,;t t
s,@cxx_target_objs@,,;t t
s,@target_cpu_default@,,;t t
s,@GMPLIBS@,-L/export/home/thomas/x-tools/i686-nptl-linux-gnu/lib -L/export/home/thomas/x-tools/i686-nptl-linux-gnu/lib -lmpfr -lgmp,;t t
s,@GMPINC@,-I/export/home/thomas/x-tools/i686-nptl-linux-gnu/include -I/export/home/thomas/x-tools/i686-nptl-linux-gnu/include,;t t
s,@LIBOBJS@,,;t t
s,@LTLIBOBJS@,,;t t
/@language_hooks@/r Make-hooks
s,@language_hooks@,,;t t

And as you can see, you find my install function replaced. This makes sed unhappy.

Regards,
Thomas