public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/31910]  New: Trouble with libtool and libjava/classpath/native/jni/gtk-peer/Makefile
@ 2007-05-13  4:41 rob1weld at aol dot com
  2007-05-15  4:54 ` [Bug libgcj/31910] " rob1weld at aol dot com
  0 siblings, 1 reply; 2+ messages in thread
From: rob1weld at aol dot com @ 2007-05-13  4:41 UTC (permalink / raw)
  To: java-prs

$/cygdrive/c/gcc-4_2-branch-build/gcc/xgcc -v
Using built-in specs.
Target: i686-pc-cygwin
Configured with: /cygdrive/C/makecygwin/gcc-4_2-branch/configure --verbose
--enable-languages=c,ada,c++,fortran,java,objc,obj-c++ --with-tune=athlon-xp
--prefix=/usr --enable-objc-gc --enable-concept-checks --disable-multilib
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/4.2 --enable-libstdcxx-debug
--enable-static --enable-shared --enable-initfini-array --enable-__cxa_atexit
--enable-threads=posix --enable-version-specific-runtime-libs --enable-libssp
--enable-libmudflap --enable-libgomp --disable-werror --enable-nls
--without-included-gettext --enable-decimal-float --with-long-double-128
--enable-debug --enable-java-gc=boehm --with-x --x-includes=/usr/X11R6/include
--x-libraries=/usr/X11R6/lib --enable-java-awt=gtk,xlib --enable-gtk-cairo
--enable-qt-peer --enable-xmlj --enable-gconf-peer --enable-tool-wrappers
--enable-portable-native-sync --enable-libgcj-multifile --enable-libgcj
--with-stabs --enable-hash-synchronization --enable-gc-debug
--enable-interpreter --with-system-zlib --enable-libada --with-tls
--enable-win32-registry --with-cpu=athlon-xp --with-arch=athlon-xp
--disable-checking
Thread model: posix
gcc version 4.2.0 20070508 (prerelease)


$pkg-config --modversion gtk+-2.0
2.10.11



I do NOT have this problem with the i686-pc-linux-gnu target, only on the
Cygwin platform. 

There is a problem with "libtool" (the one that gcc-4_2-branch SVN creates, NOT
the one that is downloaded and installed from cygwin.com). The specific
"libtool" script is at: 
/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/classpath/libtool

GCC's Makefile's create various "libtool"s (different contents and lengths) in
many directories (but each seem to have this same problem). These "libtool"s
create "impgen.c" with a ZERO byte length.

Since I have a working impgen.exe (for cygwin) and even a working impgen.c
(which I can copy over the ZERO byte length version and then compile that), I
am able to work through this problem.


To double-check what the problem was, I ran "make" on my Linux platform but
used the "-f" command to specify the Makefile on on my WinXP partition (to use
the created "Cygwin Makefile). I don't imagine everyone (reading this) can do
that (run a Makefile from a Windows directory on Linux) so I'll stick with the
Cygwin commands.


For those that _do_ have their WinXP drive "c:\" mounted in Linux as
"/mnt/windows/" and their build directory is called "gcc-4_2-branch-build" you
can type this (in your Linux shell, not your Cygwin shell):

make -f
/mnt/windows/gcc-4_2-branch-build/i686-pc-cygwin/libjava/classpath/native/jni/gtk-peer/Makefile
libgtkpeer.la



In cygwin type (something similar) to this to get to the directory in question:
cd
/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/classpath/native/jni/gtk-peer


Now you can type "make libgtkpeer.la" to see the problems.


The first problem is that libtool complains that there are no "--tag"'s in the
Makefile. 

I am not very familiar with libtool but I added "--tag=CC" to each libtool
command in the Makefile and that worked. Fortunately all the files are "C" and
there is no "C++" (or other languages), a "$(variable)" instead of hardcoding
"--tag=CC" may be a more correct fix.


make -i -k libgtkpeer.la

/bin/sh ../../../libtool --mode=link --tag=CC
/cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc
-B/cygdrive/c/gcc-4_2-branch-build/./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 -W -Wall -Wmissing-declarations
-Wwrite-strings -Wmissing-prototypes -Wno-long-long -DXTHREADS
-DXUSE_MTSAFE_API -D_REENTRANT -I/usr/include/gtk-2.0
-I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0
-I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include   -I/usr/include/freetype2  
-I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/X11R6/include -O2 -g -O2  -module
-version-info 0:0:0 -no-undefined -L/gtk/2.0/bin/ -L/usr/X11R6/lib
-lgtk-x11-2.0 -lgthread-2.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -latk-1.0
-lpangoxft-1.0 -lXft -lfreetype -lz -lXrender -lXext -lfontconfig -lpangox-1.0
-lX11 -lpango-1.0 -lm -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv  
-lfreetype -lz -lpangoft2-1.0 -lfontconfig -lfreetype -lz -lpango-1.0 -lm
-lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv    -lSM -lICE 
-L/usr/X11R6/lib  -lXrender -lXrandr  -lX11 -lXtst  -o libgtkpeer.la -rpath
/usr/lib/gcj-4.2.0 -avoid-version gnu_java_awt_peer_gtk_CairoSurface.lo
gnu_java_awt_peer_gtk_CairoGraphics2D.lo
gnu_java_awt_peer_gtk_ComponentGraphics.lo
gnu_java_awt_peer_gtk_ComponentGraphicsCopy.lo
gnu_java_awt_peer_gtk_FreetypeGlyphVector.lo
gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.lo
gnu_java_awt_peer_gtk_GdkFontPeer.lo
gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo
gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo gnu_java_awt_peer_gtk_GdkRobotPeer.lo
gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.lo
gnu_java_awt_peer_gtk_GtkButtonPeer.lo gnu_java_awt_peer_gtk_GtkCanvasPeer.lo
gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.lo
gnu_java_awt_peer_gtk_GtkCheckboxPeer.lo gnu_java_awt_peer_gtk_GtkChoicePeer.lo
gnu_java_awt_peer_gtk_GtkClipboard.lo gnu_java_awt_peer_gtk_GtkComponentPeer.lo
gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.lo
gnu_java_awt_peer_gtk_GtkFileDialogPeer.lo
gnu_java_awt_peer_gtk_GtkFramePeer.lo gnu_java_awt_peer_gtk_GtkGenericPeer.lo
gnu_java_awt_peer_gtk_GtkImage.lo gnu_java_awt_peer_gtk_GtkLabelPeer.lo
gnu_java_awt_peer_gtk_GtkListPeer.lo gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo
gnu_java_awt_peer_gtk_GtkMenuComponentPeer.lo
gnu_java_awt_peer_gtk_GtkMenuItemPeer.lo gnu_java_awt_peer_gtk_GtkMenuPeer.lo
gnu_java_awt_peer_gtk_GtkPanelPeer.lo gnu_java_awt_peer_gtk_GtkPopupMenuPeer.lo
gnu_java_awt_peer_gtk_GtkScrollbarPeer.lo
gnu_java_awt_peer_gtk_GtkScrollPanePeer.lo
gnu_java_awt_peer_gtk_GtkSelection.lo gnu_java_awt_peer_gtk_GtkTextAreaPeer.lo
gnu_java_awt_peer_gtk_GtkTextFieldPeer.lo gnu_java_awt_peer_gtk_GtkToolkit.lo
gnu_java_awt_peer_gtk_GtkWindowPeer.lo
gnu_java_awt_peer_gtk_GtkVolatileImage.lo GtkDragSourceContextPeer.lo
gthread-jni.lo gtk_jawt.lo ../../../native/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 && \
/cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc
-B/cygdrive/c/gcc-4_2-branch-build/./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)
../../../libtool: eval: line 2680: syntax error near unexpected token `fi'
../../../libtool: eval: line 2680: ` test -f .libs/impgen.exe || (cd .libs && \
/cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc
-B/cygdrive/c/gcc-4_2-branch-build/./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)'
make: [libgtkpeer.la] Error 1 (ignored)


Even using "-i -k" doesn't get us past this problem - to see what we could type
by hand.


The second problem (not gcc-4_2-branch's fault) is that the file _might_ not be
called "cyggtk-x11-2.0-0.dll" if you use a package from somewhere other than
Cygwin.com's setup.exe -- which you _MUST_ do since gcc-4_2-branch _requires_
gtk to be version 2.8 (or newer) and the Cygwin.com website doesn't have that a
version that current (only version 2.6).

That second problem is simply fixed by renaming the files on your drive and
double-checking your ".pc" files.



The section of libtool where the problem shown above occurs is here:

            # If the library has no export list, then create one now
            if test -f "$output_objdir/$soname-def"; then :
            else
              $show "extracting exported symbol list from \`$soname'"
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
              cmds=$extract_expsyms_cmds
              for cmd in $cmds; do
                IFS="$save_ifs"
                eval cmd=\"$cmd\"
                $show "$cmd"
                $run eval "$cmd" || exit $?     # This is line 2680
              done
              IFS="$save_ifs"
            fi



So I used the above "make" command on my Linux system to run the "Makefile" on
my WinXP system and looked at what was on the screen. After changing the
".so"'s to ".dll.a" and fixing some paths I came up with this:


$/cygdrive/c/gcc-4_2-branch-build/gcc/xgcc
-B/cygdrive/c/gcc-4_2-branch-build/gcc/ -B/usr/i686-pc-linux-gnu/bin/
-B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem
/usr/i686-pc-linux-gnu/sys-include -shared 
gnu_java_awt_peer_gtk_CairoSurface.o gnu_java_awt_peer_gtk_CairoGraphics2D.o
gnu_java_awt_peer_gtk_ComponentGraphics.o
gnu_java_awt_peer_gtk_ComponentGraphicsCopy.o
gnu_java_awt_peer_gtk_FreetypeGlyphVector.o
gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.o
gnu_java_awt_peer_gtk_GdkFontPeer.o
gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.o
gnu_java_awt_peer_gtk_GdkPixbufDecoder.o gnu_java_awt_peer_gtk_GdkRobotPeer.o
gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.o
gnu_java_awt_peer_gtk_GtkButtonPeer.o gnu_java_awt_peer_gtk_GtkCanvasPeer.o
gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.o
gnu_java_awt_peer_gtk_GtkCheckboxPeer.o gnu_java_awt_peer_gtk_GtkChoicePeer.o
gnu_java_awt_peer_gtk_GtkClipboard.o gnu_java_awt_peer_gtk_GtkComponentPeer.o
gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.o
gnu_java_awt_peer_gtk_GtkFileDialogPeer.o gnu_java_awt_peer_gtk_GtkFramePeer.o
gnu_java_awt_peer_gtk_GtkGenericPeer.o gnu_java_awt_peer_gtk_GtkImage.o
gnu_java_awt_peer_gtk_GtkLabelPeer.o gnu_java_awt_peer_gtk_GtkListPeer.o
gnu_java_awt_peer_gtk_GtkMenuBarPeer.o
gnu_java_awt_peer_gtk_GtkMenuComponentPeer.o
gnu_java_awt_peer_gtk_GtkMenuItemPeer.o gnu_java_awt_peer_gtk_GtkMenuPeer.o
gnu_java_awt_peer_gtk_GtkPanelPeer.o gnu_java_awt_peer_gtk_GtkPopupMenuPeer.o
gnu_java_awt_peer_gtk_GtkScrollbarPeer.o
gnu_java_awt_peer_gtk_GtkScrollPanePeer.o gnu_java_awt_peer_gtk_GtkSelection.o
gnu_java_awt_peer_gtk_GtkTextAreaPeer.o
gnu_java_awt_peer_gtk_GtkTextFieldPeer.o gnu_java_awt_peer_gtk_GtkToolkit.o
gnu_java_awt_peer_gtk_GtkWindowPeer.o gnu_java_awt_peer_gtk_GtkVolatileImage.o
GtkDragSourceContextPeer.o gthread-jni.o gtk_jawt.o
../../../native/jni/classpath/native_state.o
../../../native/jni/classpath/jcl.o  -L/gtk/2.0/bin/ -L/usr/X11R6/lib
/usr/lib/libgtk-x11-2.0.dll.a -L/usr/lib /usr/lib/libgthread-2.0.dll.a
/usr/lib/libgdk-x11-2.0.dll.a /usr/lib/libgdk_pixbuf-2.0.dll.a
/usr/lib/libatk-1.0.dll.a /usr/lib/libpangoxft-1.0.dll.a -lXft -lz -lXrender
-lXext -lfontconfig /usr/lib/libpangox-1.0.dll.a -lX11 -lm -lintl -liconv -lz
/usr/lib/libpangoft2-1.0.dll.a -lfontconfig /usr/lib/libfreetype.dll.a -lz
/usr/lib/libpango-1.0.dll.a -lm /usr/lib/libgobject-2.0.dll.a
/usr/lib/libgmodule-2.0.dll.a /usr/lib/libglib-2.0.dll.a -lintl -liconv -lSM
-lICE -lXrender -lXrandr -lX11 -lXtst  -Wl,-soname -Wl,libgtkpeer.dll.a -o
.libs/libgtkpeer.dll.a

Info: resolving _gdk_display by linking to __imp__gdk_display (auto-import)
gnu_java_awt_peer_gtk_CairoSurface.o: In function
`Java_gnu_java_awt_peer_gtk_CairoSurface_nativeNewCairoContext':
/cygdrive/C/makecygwin/gcc-4_2-branch/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c:256:
undefined reference to `_cairo_create'
gnu_java_awt_peer_gtk_CairoSurface.o: In function
`Java_gnu_java_awt_peer_gtk_CairoSurface_nativeDrawSurface':
/cygdrive/C/makecygwin/gcc-4_2-branch/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c:200:
undefined reference to `_cairo_matrix_init_identity'
/cygdrive/C/makecygwin/gcc-4_2-branch/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c:201:
undefined reference to `_cairo_matrix_init'
/cygdrive/C/makecygwin/gcc-4_2-branch/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c:206:
undefined reference to `_cairo_pattern_create_for_surface'
/cygdrive/C/makecygwin/gcc-4_2-branch/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c:207:
undefined reference to `_cairo_pattern_set_matrix'
...(many more errors)


The problem was that the command was missing "-lcairo", so I added that.
Since it works on Linux it _might_ be that I need to re-check my ".pc" files
to see _if_ they need "cairo" tossed in there somewhere _OR_ it _might_ be the
"Makefile"'s fault that it needs "-lcairo" (on the Cygwin platform).


Here is a working command:

$/cygdrive/c/gcc-4_2-branch-build/gcc/xgcc
-B/cygdrive/c/gcc-4_2-branch-build/gcc/ -B/usr/i686-pc-linux-gnu/bin/
-B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem
/usr/i686-pc-linux-gnu/sys-include -shared 
gnu_java_awt_peer_gtk_CairoSurface.o gnu_java_awt_peer_gtk_CairoGraphics2D.o
gnu_java_awt_peer_gtk_ComponentGraphics.o
gnu_java_awt_peer_gtk_ComponentGraphicsCopy.o
gnu_java_awt_peer_gtk_FreetypeGlyphVector.o
gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.o
gnu_java_awt_peer_gtk_GdkFontPeer.o
gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.o
gnu_java_awt_peer_gtk_GdkPixbufDecoder.o gnu_java_awt_peer_gtk_GdkRobotPeer.o
gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.o
gnu_java_awt_peer_gtk_GtkButtonPeer.o gnu_java_awt_peer_gtk_GtkCanvasPeer.o
gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.o
gnu_java_awt_peer_gtk_GtkCheckboxPeer.o gnu_java_awt_peer_gtk_GtkChoicePeer.o
gnu_java_awt_peer_gtk_GtkClipboard.o gnu_java_awt_peer_gtk_GtkComponentPeer.o
gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.o
gnu_java_awt_peer_gtk_GtkFileDialogPeer.o gnu_java_awt_peer_gtk_GtkFramePeer.o
gnu_java_awt_peer_gtk_GtkGenericPeer.o gnu_java_awt_peer_gtk_GtkImage.o
gnu_java_awt_peer_gtk_GtkLabelPeer.o gnu_java_awt_peer_gtk_GtkListPeer.o
gnu_java_awt_peer_gtk_GtkMenuBarPeer.o
gnu_java_awt_peer_gtk_GtkMenuComponentPeer.o
gnu_java_awt_peer_gtk_GtkMenuItemPeer.o gnu_java_awt_peer_gtk_GtkMenuPeer.o
gnu_java_awt_peer_gtk_GtkPanelPeer.o gnu_java_awt_peer_gtk_GtkPopupMenuPeer.o
gnu_java_awt_peer_gtk_GtkScrollbarPeer.o
gnu_java_awt_peer_gtk_GtkScrollPanePeer.o gnu_java_awt_peer_gtk_GtkSelection.o
gnu_java_awt_peer_gtk_GtkTextAreaPeer.o
gnu_java_awt_peer_gtk_GtkTextFieldPeer.o gnu_java_awt_peer_gtk_GtkToolkit.o
gnu_java_awt_peer_gtk_GtkWindowPeer.o gnu_java_awt_peer_gtk_GtkVolatileImage.o
GtkDragSourceContextPeer.o gthread-jni.o gtk_jawt.o
../../../native/jni/classpath/native_state.o
../../../native/jni/classpath/jcl.o  -L/gtk/2.0/bin/ -L/usr/X11R6/lib
/usr/lib/libgtk-x11-2.0.dll.a -L/usr/lib /usr/lib/libgthread-2.0.dll.a
/usr/lib/libgdk-x11-2.0.dll.a /usr/lib/libgdk_pixbuf-2.0.dll.a
/usr/lib/libatk-1.0.dll.a /usr/lib/libpangoxft-1.0.dll.a -lXft -lz -lXrender
-lXext -lfontconfig /usr/lib/libpangox-1.0.dll.a -lX11 -lm -lintl -liconv -lz
/usr/lib/libpangoft2-1.0.dll.a -lfontconfig /usr/lib/libfreetype.dll.a -lz
/usr/lib/libpango-1.0.dll.a -lm /usr/lib/libgobject-2.0.dll.a
/usr/lib/libgmodule-2.0.dll.a /usr/lib/libglib-2.0.dll.a -lintl -liconv -lSM
-lICE -lXrender -lXrandr -lX11 -lXtst -lcairo -Wl,-soname -Wl,libgtkpeer.dll.a
-o .libs/libgtkpeer.dll.a


Typing that produces _only_ an "information message" (no errors or warnings!),
which is normal:
Info: resolving _gdk_display by linking to __imp__gdk_display (auto-import)


$ls -l
/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/classpath/native/jni/gtk-peer/.libs/libgtkpeer.dll.a
-rwxr-xr-x 1 HP_Administrator None 1340108 May 12 19:31 libgtkpeer.dll.a


So all the messing around worked, the file is created and correct. I can go on 
to make in the next directory. :^(


---

The specific bug complaint is that the Makefile creates "libtool"'s which have
a broken pipe and produce ZERO byte length impgen.c files. These (obviously)
can not be compiled and cause an error for xgcc when it tries to compile them.
That breaks the make.

Simply copying a 'known good' impgen.c (or .exe), and "touch"ing it doesn't
work since the Makefile insists on re-creating the impgen.c file (it's not
checking the timestamp).

Running the commands by hand is annoying but provides working libraries
(".dll.a") and other files (".dll-def") that the Makefile needs to "see" in
each directory so it can continue on to the next step. 

The gcc-4_2-branch "./configure"s and subsequent "Makefile"s are not creating a
"libtool" that works well enough with the broken Makefile - so it is hard to
know where to begin fixing.


It would be great if (on the cygwin platform) we could avoid the "impgen"ing
steps (Linux does not do it, it simply uses ".so" files). On Cygwin we could
use ".dll" files instead of ".dll.a" files since GCC (and even xgcc) knows to
pass them to the linker. We may not need the ".dll-def" files that impgen
creates either. 

Someone came up with this scheme of doing things this way (and I can see it
working) but it needs some maintenance. I imagine the ".a" files are needed
with the export lists (the ".dll-def" files) so something, somewhere, can know
what functions are available without having to use a seperate list for each gtk
version. For some reason this scheme is NOT used on the i686-pc-linux-gnu
target.

I do have every language compiled and "make -i check" tested on the
i686-pc-linux-gnu target and it is working reasonably well (very few errors).

It had been some months since I upgraded my gtk (and since gcc-4_2-branch wants
> 2.8) I decided to upgrade cygwin to the newest gtk 2.10.11 - and thus need to
'impgen it' again.

Without this working better it is tough to get Java working on WinXP.

Since the method used on the Cygwin target is very different from the method
used on the Linux target it is tough to convert one way of doing things to the
other way (and makes maintaining it tough - this is why it works on Linux and
not on cygwin).

It _could_ work on both platforms better and would be easier to maintain if we
homogenized the make scheme to adopt one way of doing it and chose between
".so", ".dll" or ".a" based on whether we where building "static" or "shared"
(and if testing if shared libraries were suffixed with ".so" or ".dll"). The
GCC make scheme does NOT have this complexity in other areas, this bi-polar
scheme is making me bi-polar :)


-- 
           Summary: Trouble with libtool and
                    libjava/classpath/native/jni/gtk-peer/Makefile
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rob1weld at aol dot com
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31910


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libgcj/31910] Trouble with libtool and libjava/classpath/native/jni/gtk-peer/Makefile
  2007-05-13  4:41 [Bug libgcj/31910] New: Trouble with libtool and libjava/classpath/native/jni/gtk-peer/Makefile rob1weld at aol dot com
@ 2007-05-15  4:54 ` rob1weld at aol dot com
  0 siblings, 0 replies; 2+ messages in thread
From: rob1weld at aol dot com @ 2007-05-15  4:54 UTC (permalink / raw)
  To: java-prs



------- 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  <neroden@gcc.gnu.org>
        * 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  <neroden@gcc.gnu.org>
        * 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-15  4:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-13  4:41 [Bug libgcj/31910] New: Trouble with libtool and libjava/classpath/native/jni/gtk-peer/Makefile rob1weld at aol dot com
2007-05-15  4:54 ` [Bug libgcj/31910] " rob1weld at aol dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).