------- Comment #1 from rob1weld at aol dot com 2007-05-15 05:54 ------- I did some hacking to push the make through and find all occurances of the problem, then I rebuild from a fresh directory and condensed my changes.
It came down to a few problems all interacting together - changes and updates were made to the code over time but were not tested on all platforms. The breakage on the Cygwin platform became imense. This probably affects other platforms supported by gcc-4.2 that use .dlls - EG: arm-none-symbian --- Problem 1): The variable BUILD_CC is not defined for this portion of /gcc-4_2-branch-build/i686-pc-cygwin/libjava/classpath/libtool # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds="test -f \$output_objdir/impgen.c || \\\\ sed -e \\\"/^# \\\\/\\\\* impgen\\\\.c starts here \\\\*\\\\//,/^# \\\\/\\\\* impgen.c ends here \\\\*\\\\// { s/^# //; p; }\\\" -e d < \$0 > \$output_objdir/impgen.c~ test -f \$output_objdir/impgen.exe || (cd \$output_objdir && \\\\ if test \\\"x\$BUILD_CC\\\" != \\\"x\\\" ; then \$BUILD_CC -o impgen impgen.c ; \\\\ else \$CC -o impgen impgen.c ; fi)~ \$output_objdir/impgen \$dir/\$soroot > \$output_objdir/\$soname-def" Check the build directory - here are two potential problems: $ grep -r BUILD_CC /cygdrive/c/gcc-4_2-branch-build-9b/i686-pc-cygwin/libjava/* /cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/classpath/libtool: if test \\\"x\$BUILD_CC\\\" != \\\"x\\\" ; then \$BUILD_CC -o impgen impgen.c ; \\\\ /cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/libtool: if test \\\"x\$BUILD_CC\\\" != \\\"x\\\" ; then \$BUILD_CC -o impgen impgen.c ; \\\\ Check the source directory - here is the answer: $ grep -r BUILD_CC /cygdrive/c/gcc-4_2-branch/* /cygdrive/c/gcc-4_2-branch/ChangeLog: note known problems; set CONFIG_SHELL; don't set BUILD_CC; relocate /cygdrive/c/gcc-4_2-branch/ChangeLog: * Makefile.tpl: Remove BUILD_CC stuff. /cygdrive/c/gcc-4_2-branch/gcc/ChangeLog-1998: * configure.in: Use CC_FOR_BUILD, not BUILD_CC. /cygdrive/c/gcc-4_2-branch/gcc/ChangeLog-2003: * configure.in: Replace BUILD_CC references with CC_FOR_BUILD. /cygdrive/c/gcc-4_2-branch/gcc/ChangeLog-2003: * Makefile.in: Replace BUILD_CC references with CC_FOR_BUILD. /cygdrive/c/gcc-4_2-branch/gcc/ChangeLog-2003: Set BUILD_CC to the same as CC. /cygdrive/c/gcc-4_2-branch/libjava/classpath/ltcf-c.sh: if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \ /cygdrive/c/gcc-4_2-branch/libjava/classpath/ltcf-gcj.sh: if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \ /cygdrive/c/gcc-4_2-branch/ltcf-c.sh: if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \ /cygdrive/c/gcc-4_2-branch/ltcf-gcj.sh: if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \ /cygdrive/c/gcc-4_2-branch/ChangeLog 2004-03-22 Nathanael Nerode <[EMAIL PROTECTED]> * Makefile.tpl: Clean up experimental top level bootstrap support: note known problems; set CONFIG_SHELL; don't set BUILD_CC; relocate prev-gcc in configure- targets as well as all- targets. * Makefile.in: Regenerate. 2003-06-18 Nathanael Nerode <[EMAIL PROTECTED]> * Makefile.tpl: Remove BUILD_CC stuff. * Makefile.in: Regenerate. It would seem that "BUILD_CC" was removed some time ago but there are still 4 files using it. Temp fix C:\gcc-4_2-branch-build\i686-pc-cygwin\libjava\classpath\libtool by adding this near top of file: BUILD_CC=gcc Problem 2): The error above ("../../../libtool: eval: line 2680: syntax error near unexpected token `fi'") is caused by this command being used (even _after_ fixing BUILD_CC there is more): $ (cd .libs && \ if test "xgcc" != "x" ; then gcc -o impgen impgen.c ; \ else /cygdrive/c/gcc-4_2-branch-build-9b/./gcc/xgcc -B/cygdrive/c/gcc-4_2-branch-build-9b/./gcc/ -B/usr/i686-pc-cygwin/bin/ -B/usr/i686-pc-cygwin/lib/ -isystem /usr/i686-pc-cygwin/include -isystem /usr/i686-pc-cygwin/sys-include -o impgen impgen.c ; fi) -bash: syntax error near unexpected token `then' Remove all the "\"'s and try again: $ (cd .libs && if test "xgcc" != "x" ; then gcc -o impgen impgen.c ; else /cygdrive/c/gcc-4_2-branch-build-9b/./gcc/xgcc -B/cygdrive/c/gcc-4_2-branch-build-9b/./gcc/ -B/usr/i686-pc-cygwin/bin/ -B/usr/i686-pc-cygwin/lib/ -isystem /usr/i686-pc-cygwin/include -isystem /usr/i686-pc-cygwin/sys-include -o impgen impgen.c ; fi) That worked - so here is the change for libtool (alter "\\\\" to "\" on three lines): ## The commands to extract the exported symbol list from a shared archive. #extract_expsyms_cmds="test -f \$output_objdir/impgen.c || \\\\ # sed -e \\\"/^# \\\\/\\\\* impgen\\\\.c starts here \\\\*\\\\//,/^# \\\\/\\\\* impgen.c ends here \\\\*\\\\// { s/^# //; p; }\\\" -e d < \$0 > \$output_objdir/impgen.c~ # test -f \$output_objdir/impgen.exe || (cd \$output_objdir && \\\\ # if test \\\"x\$BUILD_CC\\\" != \\\"x\\\" ; then \$BUILD_CC -o impgen impgen.c ; \\\\ # else \$CC -o impgen impgen.c ; fi)~ # \$output_objdir/impgen \$dir/\$soroot > \$output_objdir/\$soname-def" # Added # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds="test -f \$output_objdir/impgen.c || \ sed -e \\\"/^# \\\\/\\\\* impgen\\\\.c starts here \\\\*\\\\//,/^# \\\\/\\\\* impgen.c ends here \\\\*\\\\// { s/^# //; p; }\\\" -e d < \$0 > \$output_objdir/impgen.c~ test -f \$output_objdir/impgen.exe || (cd \$output_objdir && \ if test \\\"x\$BUILD_CC\\\" != \\\"x\\\" ; then \$BUILD_CC -o impgen impgen.c ; \ else \$CC -o impgen impgen.c ; fi)~ \$output_objdir/impgen \$dir/\$soroot > \$output_objdir/\$soname-def" Now we get this sort of output (working): $ make -i -k libgtkpeer.la /bin/sh ../../../libtool --mode=link --tag=CC /cygdrive/c/gcc-4_2-branch-build-9b/./gcc/xgcc -B/cygdrive/c/gcc-4_2-branch-build-9b/./gcc/ -B/usr/i686-pc-cygwin/bin/ -B/usr/i686-pc-cygwin/lib/ -isystem /usr/i686-pc-cygwin/include -isystem /usr/i686-pc-cygwin/sys-include -pedantic ... /jni/classpath/native_state.lo ../../../native/jni/classpath/jcl.lo extracting exported symbol list from `cyggtk-x11-2.0-0.dll' test -f .libs/impgen.c || \ sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < ../../../libtool > .libs/impgen.c test -f .libs/impgen.exe || (cd .libs && if test "xgcc" != "x" ; then gcc -o impgen impgen.c ; else /cygdrive/c/gcc-4_2-branch-build-9b/./gcc/xgcc -B/cygdrive/c/gcc-4_2-branch-build-9b/./gcc/ -B/usr/i686-pc-cygwin/bin/ -B/usr/i686-pc-cygwin/lib/ -isystem /usr/i686-pc-cygwin/include -isystem /usr/i686-pc-cygwin/sys-include -o impgen impgen.c ; fi) .libs/impgen /usr/lib/../bin/cyggtk-x11-2.0-0.dll > .libs/cyggtk-x11-2.0-0.dll-def generating import library for `cyggtk-x11-2.0-0.dll' /usr/i686-pc-cygwin/bin/dlltool --as=/cygdrive/c/gcc-4_2-branch-build-9b/./gcc/as --dllname cyggtk-x11-2.0-0.dll --def .libs/cyggtk-x11-2.0-0.dll-def --output-lib .libs/libimp-cyggtk-x11-2.0-0.a extracting exported symbol list from `cyggthread-2.0-0.dll' test -f .libs/impgen.c || \ sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < ../../../libtool > .libs/impgen.c test -f .libs/impgen.exe || (cd .libs && if test "xgcc" != "x" ; then gcc -o impgen impgen.c ; else /cygdrive/c/gcc-4_2-branch-build-9b/./gcc/xgcc -B/cygdrive/c/gcc-4_2-branch-build-9b/./gcc/ -B/usr/i686-pc-cygwin/bin/ -B/usr/i686-pc-cygwin/lib/ -isystem /usr/i686-pc-cygwin/include -isystem /usr/i686-pc-cygwin/sys-include -o impgen impgen.c ; fi) .libs/impgen /usr/lib/../bin/cyggthread-2.0-0.dll > .libs/cyggthread-2.0-0.dll-def generating import library for `cyggthread-2.0-0.dll' /usr/i686-pc-cygwin/bin/dlltool --as=/cygdrive/c/gcc-4_2-branch-build-9b/./gcc/as --dllname cyggthread-2.0-0.dll --def .libs/cyggthread-2.0-0.dll-def --output-lib .libs/libimp-cyggthread-2.0-0.a extracting exported symbol list from `cyggdk-x11-2.0-0.dll' (keeps on working OK)... The neccesary fixes for i686-pc-cygwin\libjava\classpath\libtool were: 1): Add BUILD_CC=gcc 2): Alter "\\\\" to "\" on the three lines shown above. This _might_ be accomplished by changing /gcc-4_2-branch/libjava/classpath/configure - lines 6009 and 6285 #Old # Actually configure libtool. ac_aux_dir is where install-sh is found. AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ #New # Actually configure libtool. ac_aux_dir is where install-sh is found. AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" BUILD_CC=gcc \ #Old LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" lt_save_CC="$CC" lt_save_CFLAGS="$CFLAGS" AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ #New LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" lt_save_CC="$CC" lt_save_CFLAGS="$CFLAGS" AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" BUILD_CC=gcc \ This _might_ be accomplished by changing /gcc-4_2-branch/libjava/classpath/ltcf-c.sh in this area: cygwin* | mingw*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=yes extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~ test -f $output_objdir/impgen.exe || (cd $output_objdir && \ if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \ else $CC -o impgen impgen.c ; fi)~ $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' The above is doing this (excess "\"'s): $ (cd .libs && \ if test "xgcc" != "x" ; then gcc -o impgen impgen.c ; \ else /cygdrive/c/gcc-4_2-branch-build-9b/./gcc/xgcc -B/cygdrive/c/gcc-4_2-branch-build-9b/./gcc/ -B/usr/i686-pc-cygwin/bin/ -B/usr/i686-pc-cygwin/lib/ -isystem /usr/i686-pc-cygwin/include -isystem /usr/i686-pc-cygwin/sys-include -o impgen impgen.c ; fi) This is the output we need: $ (cd .libs && if test "xgcc" != "x" ; then gcc -o impgen impgen.c ; else /cygdrive/c/gcc-4_2-branch-build-9b/./gcc/xgcc -B/cygdrive/c/gcc-4_2-branch-build-9b/./gcc/ -B/usr/i686-pc-cygwin/bin/ -B/usr/i686-pc-cygwin/lib/ -isystem /usr/i686-pc-cygwin/include -isystem /usr/i686-pc-cygwin/sys-include -o impgen impgen.c ; fi) That would suggest we can change /gcc-4_2-branch/libjava/classpath/ltcf-c.sh: extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~ test -f $output_objdir/impgen.exe || (cd $output_objdir && \ if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \ else $CC -o impgen impgen.c ; fi)~ $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' to extract_expsyms_cmds='test -f $output_objdir/impgen.c || sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~ test -f $output_objdir/impgen.exe || (cd $output_objdir && if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; else $CC -o impgen impgen.c ; fi)~ $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' and it should work. The file ltcf-cxx.sh does not have the same section but there is an identical section in ltcf-gcj.sh that probably should be fixed too. I have not seen the file "ltcf-gcj.sh" ever get called and invoke the section in question, and thus cause the fault, but this problem is waiting to happen in the future. The reason I say "might" and "should" in the above text is that I am still testing to make sure this works. I need to run through it once to catch all the broken points and then re-do the whole make from a clean directory to be certain it will work. This takes days. Here is the "make -i check" for libjava (using the old GTK, and the "broken libjava testsuite" - subject of a different bugreport): === libjava Summary === # of expected passes 5325 # of unexpected failures 832 # of expected failures 12 # of untested testcases 823 A "reasonable" result. Newer GTK may well get more features working, and thus more passes, but the "broken libjava testsuite" (subject of a different bugreport) needs fixing. The testsuite is only "broken" under Cygwin - (needs "--classpath ." ?). Concern ( / Problem?) 3): It is unfortunate that each of the classpath/* directories have a ./.libs directory that contains a _HUGE_ list of files: #ls -lrt /cygdrive/c/gcc-4_2-branch-build-9b/i686-pc-cygwin/libjava/classpath/native/jni/gtk-peer/.libs total 21143 -rw-r--r-- 1 HP_Administrator None 106038 May 13 12:32 cyggtk-x11-2.0-0.dll-def -rw-r--r-- 1 HP_Administrator None 2322868 May 13 12:33 libimp-cyggtk-x11-2.0-0.a -rw-r--r-- 1 HP_Administrator None 74 May 13 12:33 cyggthread-2.0-0.dll-def -rw-r--r-- 1 HP_Administrator None 3212 May 13 12:33 libimp-cyggthread-2.0-0.a -rw-r--r-- 1 HP_Administrator None 20493 May 13 12:33 cyggdk-x11-2.0-0.dll-def ... -rw-r--r-- 1 HP_Administrator None 5172 May 13 12:33 cygpangoft2-1.0-0.dll-def -rw-r--r-- 1 HP_Administrator None 129502 May 13 12:33 libimp-cygpangoft2-1.0-0.a -rw-r--r-- 1 HP_Administrator None 13340828 May 13 12:34 libgtkpeer.a -rw-r--r-- 1 HP_Administrator None 1404 May 13 12:34 libgtkpeer.lai lrwxrwxrwx 1 HP_Administrator None 16 May 13 12:34 libgtkpeer.la -> ../libgtkpeer.la It would be better to have a common directory for all the ".dll-def" and ".a" files as it would save a lot of space and the effort of re-building them all the time. Just keep the last three files in their seperate ./.libs and put the rest all in "i686-pc-cygwin/libjava/classpath/.libs" . If those two (or three) changes were incorporated this bug would be resolved. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31910