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