public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/33085]  New: liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT'  is wrong
@ 2007-08-16 10:30 dannysmith at users dot sourceforge dot net
  2008-02-07 17:15 ` [Bug libgcj/33085] " rondesot at yahoo dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2007-08-16 10:30 UTC (permalink / raw)
  To: java-prs

Bug reported by Ross Ridge to mingw users list 

When building libgcj for windows targets, libtool puts -DDLL_EXPORT in compiler
flag:

    mingw* | cygwin* | pw32* | os2*)
      # This hack is so that the source file can tell whether it is being
      # built for inclusion in a dll (and should export symbols for example).
      # Although the cygwin gcc ignores -fPIC, still need this for old-style
      # (--disable-auto-import) libraries
      lt_prog_compiler_pic='-DDLL_EXPORT'
      ;;


However that -D is a preprocessor flag (not a proper compiler switch)  gcj
gives -D a different meaning:

from jvspec.c:lang_specific_driver

  if (saw_D && ! main_class_name)
    fatal ("can't specify '-D' without '--main'\n");

As a result, libtool build of shared  libgcj  fails with:

bin/bash ./libtool --tag=GCJ --mode=compile /src/gcc/obj/gcc/gcj
-B/src/gcc/obj/mingw32/libjava/ -B/src/gcc/obj/gcc/ -ffloat-store
-fomit-frame-pointer -Usun -fno-omit-frame-pointer -fclasspath=
-fbootclasspath=../../../gcc/libjava/classpath/lib --encoding=UTF-8
-Wno-deprecated -fbootstrap-classes -g -O2 -c -o java/lang/Object.lo
-fsource-filename=../../../gcc/libjava/java/lang/Object.java
../../../gcc/libjava/classpath/lib/java/lang/Object.class
libtool: compile: /src/gcc/obj/gcc/gcj -B/src/gcc/obj/mingw32/libjava/
-B/src/gcc/obj/gcc/ -ffloat-store -fomit-frame-pointer -Usun
-fno-omit-frame-pointer -fclasspath=
-fbootclasspath=../../../gcc/libjava/classpath/lib --encoding=UTF-8
-Wno-deprecated -fbootstrap-classes -g -O2 -c
-fsource-filename=../../../gcc/libjava/java/lang/Object.java
../../../gcc/libjava/classpath/lib/java/lang/Object.class -DDLL_EXPORT -o
java/lang/.libs/Object.o
gcj.exe: can't specify '-D' without '--main'


-- 
           Summary: liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT'  is wrong
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dannysmith at users dot sourceforge dot net


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


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

* [Bug libgcj/33085] liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT'  is wrong
  2007-08-16 10:30 [Bug libgcj/33085] New: liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT' is wrong dannysmith at users dot sourceforge dot net
@ 2008-02-07 17:15 ` rondesot at yahoo dot com
  2008-02-07 17:25 ` Ralf dot Wildenhues at gmx dot de
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rondesot at yahoo dot com @ 2008-02-07 17:15 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from rondesot at yahoo dot com  2008-02-07 17:15 -------
I would like to confirm this bug and discuss a work around that I used.

This bug seems to be the only thing that keeps gcc 4.3 with java from
completing a native build under mingw.

With the two patches below, I was able to build snapshot gcc-4.3-20080118.

The gcj.exe created with this change works a little, about what you would
expect from an early snapshot of a new revision. Simple .java files that have
already been converted into .class files can be compiled into Windows
executables. On the other hand, .java files cannot be compiled directly into
executables because the ecj1.exe program does not seem to work.

Using Sun's javac to compile a simple HelloWorld.java into a .class file then
using gcj to get an .exe. created a working executable.

I could also compile .java files directly by replacing the ecj1.exe file
created by my native build with ecj1.exe from Mohan Embar's GCC/GCJ 4.3
(gcj-eclipse-merge-branch).

More complex programs, i.e. the building an Eclipse SWT Library, do not work.

PATCHES

In gcc\java\jvspec.c, I changed the test for arguments beginning with 'D'

FROM

else if (argv[i][1] == 'D')
  saw_D = 1;

TO

else if (argv[i][1] == 'D' && strcmp (argv[i], "-DDLL_EXPORT") != 0) 
   saw_D = 1;



In gcc\java\jvgenmain.c, I changed the handling of arguments 
beginning with 'D' to treat "-DDL_EXPORT" as it would a non "-D" argument.

FROM

for (i = 1; i < argc; ++i)
  {
    if (! strncmp (argv[i], "-D", 2))
      {
        /* Handled later.  */
      }
    else
      break;
  }


TO

for (i = 1; i < argc; ++i)
  {
    if (! strncmp (argv[i], "-D", 2) || strcmp (argv[i], "-DDLL_EXPORT") == 0)
      {
        /* Handled later.  */
      }
    else
      break;
  }

The second patch may not be doing exactly what is needed. There are several
places within gcc\java\jvgenmain.c where the test for -DDLL_EXPORT can be done.
As this directive should be handled like a non "-D' would be, I guessed that
the test for it should be made as early in the program as possible.

I welcome any help that I can get to improve on this.


-- 

rondesot at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|liblt_prog_compiler_pic_GCJ=|liblt_prog_compiler_pic_GCJ=
                   |'-DDLL_EXPORT'  is wrong    |'-DDLL_EXPORT'  is wrong


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


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

* [Bug libgcj/33085] liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT'  is wrong
  2007-08-16 10:30 [Bug libgcj/33085] New: liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT' is wrong dannysmith at users dot sourceforge dot net
  2008-02-07 17:15 ` [Bug libgcj/33085] " rondesot at yahoo dot com
@ 2008-02-07 17:25 ` Ralf dot Wildenhues at gmx dot de
  2008-02-15  6:13 ` rwild at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ralf dot Wildenhues at gmx dot de @ 2008-02-07 17:25 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from Ralf dot Wildenhues at gmx dot de  2008-02-07 17:25 -------
Argh.  Why doesn't GCC import the fix in libtool instead of hacking around
it downstream?
<http://lists.gnu.org/archive/html/libtool-patches/2007-08/msg00006.html>


-- 

Ralf dot Wildenhues at gmx dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Ralf dot Wildenhues at gmx
                   |                            |dot de


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


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

* [Bug libgcj/33085] liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT'  is wrong
  2007-08-16 10:30 [Bug libgcj/33085] New: liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT' is wrong dannysmith at users dot sourceforge dot net
  2008-02-07 17:15 ` [Bug libgcj/33085] " rondesot at yahoo dot com
  2008-02-07 17:25 ` Ralf dot Wildenhues at gmx dot de
@ 2008-02-15  6:13 ` rwild at gcc dot gnu dot org
  2008-02-16  3:58 ` rwild at gcc dot gnu dot org
  2008-02-16  4:00 ` rwild at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: rwild at gcc dot gnu dot org @ 2008-02-15  6:13 UTC (permalink / raw)
  To: java-prs



------- Comment #3 from rwild at gcc dot gnu dot org  2008-02-15 06:13 -------
Patch posted: <http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00533.html>


-- 

rwild at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-15 06:13:50
               date|                            |


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


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

* [Bug libgcj/33085] liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT'  is wrong
  2007-08-16 10:30 [Bug libgcj/33085] New: liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT' is wrong dannysmith at users dot sourceforge dot net
                   ` (2 preceding siblings ...)
  2008-02-15  6:13 ` rwild at gcc dot gnu dot org
@ 2008-02-16  3:58 ` rwild at gcc dot gnu dot org
  2008-02-16  4:00 ` rwild at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: rwild at gcc dot gnu dot org @ 2008-02-16  3:58 UTC (permalink / raw)
  To: java-prs



------- Comment #4 from rwild at gcc dot gnu dot org  2008-02-16 03:58 -------
Subject: Bug 33085

Author: rwild
Date: Sat Feb 16 03:57:53 2008
New Revision: 132362

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132362
Log:
PR libgcj/33085
* libtool.m4 (_LT_COMPILER_PIC) [ mingw, cygwin ] <GCJ>:
Do not use -DDLL_EXPORT.  Backport from upstream.

libjava/
PR libgcj/33085
* configure: Regenerate.

Modified:
    trunk/ChangeLog
    trunk/libjava/ChangeLog
    trunk/libjava/configure
    trunk/libtool.m4


-- 


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


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

* [Bug libgcj/33085] liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT'  is wrong
  2007-08-16 10:30 [Bug libgcj/33085] New: liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT' is wrong dannysmith at users dot sourceforge dot net
                   ` (3 preceding siblings ...)
  2008-02-16  3:58 ` rwild at gcc dot gnu dot org
@ 2008-02-16  4:00 ` rwild at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: rwild at gcc dot gnu dot org @ 2008-02-16  4:00 UTC (permalink / raw)
  To: java-prs



------- Comment #5 from rwild at gcc dot gnu dot org  2008-02-16 04:00 -------
Fixed.


-- 

rwild at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-02-16  4:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-16 10:30 [Bug libgcj/33085] New: liblt_prog_compiler_pic_GCJ='-DDLL_EXPORT' is wrong dannysmith at users dot sourceforge dot net
2008-02-07 17:15 ` [Bug libgcj/33085] " rondesot at yahoo dot com
2008-02-07 17:25 ` Ralf dot Wildenhues at gmx dot de
2008-02-15  6:13 ` rwild at gcc dot gnu dot org
2008-02-16  3:58 ` rwild at gcc dot gnu dot org
2008-02-16  4:00 ` rwild at gcc dot gnu dot org

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).