[Bug java/30448] New: libjava configure script mix up with .c / .java using gcj /gcc

rob1weld at aol dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 12 17:12:00 GMT 2007


When running "make bootstrap" make gets to the target configure-target-libjava
and seems to be creating conftest.java files with "c" code in them. These are
compiled with gcj. This causes some of the tests in configure to pass when "c"
code is compiled with gcc) and some of the tests in configure to fail when "c"
code is compiled with gcj). 

Here is part of configure's output:

First getting
checking command to parse /cygdrive/c/gcc-4_2-branch-build/./gcc/nm output...
ok

Later getting:
checking command to parse /cygdrive/c/gcc-4_2-branch-build/./gcc/nm output...
failed


I am not an expert on java, I am just trying to compile _all_ of gcc-4_2. I do
not know that these tests failing will hurt the java compile (in fact it seems
to compile "reasonably well" according to the result of running "make check").
I do not see the purpose of sending "c" code (with a .java extension) to the
gcj compiler to test if it works and is able to use "nm". Perhaps the
conftest.java files should be re-named with the .c extension, or perhaps the
conftest files should have java in them - maybe these tests should be skipped -
I don't know enough about java to have an opinion, just filing a bug report.


The problem _seems_ to be that configure is using ltconfig to call
gcc-4_2-branch-build/gcc/gcj to compile files with the extension .java but
containing "c" code. Gcj is failing when it tries to process the "#ifdef"
statements. The result is that configure thinks it's tests are failing (whereas
if it had called gcc instead of gcj they would pass).

Line 6589 of /gcc-4_2-branch/libjava/configure contains this:
AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \

Shortly after it tries to run this command:
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
...


I may not understand what is trying to be done here but it seems that configure
is trying to get libtool to check if it can use the gcj tool chain (java) in
place of the gcc tool chain ("c") to compile "c" programs with the extension of
.java . The partial output of running "make configure-target-libjava" (part of
having typed "make bootstrap) is as follows:


loading cache ./config.cache within ltconfig
checking host system type... i686-pc-cygwin
checking build system type... i686-pc-cygwin
checking for objdir... .libs
checking for /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc option to produce
PIC... -DDLL_EXPORT -DPIC
checking if /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc PIC flag -DDLL_EXPORT
-DPIC works... yes
checking if /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc static flag -static
works... yes
finding the maximum length of command line arguments... (cached) 8192
checking if /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc supports -c -o
file.o... (cached) yes
checking if /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc supports -fno-rtti
-fno-exceptions ... yes
checking whether the linker (/cygdrive/c/gcc-4_2-branch-build/./gcc/collect-ld)
supports shared libraries... no
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... Win32 ld.exe
checking command to parse /cygdrive/c/gcc-4_2-branch-build/./gcc/nm output...
ok
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
appending configuration tag "CXX" to libtool
checking for gcj... /cygdrive/c/gcc-4_2-branch-build/gcc/gcj
-B/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/
-B/cygdrive/c/gcc-4_2-branch-build/gcc/
checking dependency style of /cygdrive/c/gcc-4_2-branch-build/gcc/gcj
-B/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/
-B/cygdrive/c/gcc-4_2-branch-build/gcc/... gcc3
loading cache ./config.cache within ltconfig
checking host system type... i686-pc-cygwin
checking build system type... i686-pc-cygwin
checking for objdir... .libs
checking for /cygdrive/c/gcc-4_2-branch-build/gcc/gcj option to produce PIC...
-DDLL_EXPORT
checking if /cygdrive/c/gcc-4_2-branch-build/gcc/gcj PIC flag -DDLL_EXPORT
works... (cached) yes
checking if /cygdrive/c/gcc-4_2-branch-build/gcc/gcj static flag -static
works... (cached) yes
finding the maximum length of command line arguments... (cached) 8192
checking if /cygdrive/c/gcc-4_2-branch-build/gcc/gcj supports -c -o file.o...
(cached) yes
checking if /cygdrive/c/gcc-4_2-branch-build/gcc/gcj supports -fno-rtti
-fno-exceptions ... no
checking whether the linker (/cygdrive/c/gcc-4_2-branch-build/./gcc/collect-ld)
supports shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... Win32 ld.exe
checking command to parse /cygdrive/c/gcc-4_2-branch-build/./gcc/nm output...
failed
checking if libtool supports shared libraries... yes
checking if package supports dlls... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
appending configuration tag "GCJ" to libtool


My complaint is that one line above reads:
checking command to parse /cygdrive/c/gcc-4_2-branch-build/./gcc/nm output...
ok

Then 21 lines later we get:
checking command to parse /cygdrive/c/gcc-4_2-branch-build/./gcc/nm output...
failed

A portion of the config.log is as follows:

configure:6283: result:  /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc
-shared-libgcc -B/cygdrive/c/gcc-4_2-branch-build/./gcc -nostdinc++
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src/.libs
-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 -E
configure:6307:  /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc -shared-libgcc
-B/cygdrive/c/gcc-4_2-branch-build/./gcc -nostdinc++
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src/.libs
-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 -E 
conftest.cc
configure:6313: $? = 0
configure:6345:  /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc -shared-libgcc
-B/cygdrive/c/gcc-4_2-branch-build/./gcc -nostdinc++
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src/.libs
-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 -E 
conftest.cc
conftest.cc:17:28: error: ac_nonexistent.h: No such file or directory
configure:6351: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "libjava"
| #define PACKAGE_TARNAME "libjava"
| #define PACKAGE_VERSION "version-unused"
| #define PACKAGE_STRING "libjava version-unused"
| #define PACKAGE_BUGREPORT ""
| #ifdef __cplusplus
| extern "C" void exit (int);
| #endif
| #define PACKAGE "libjava"
| #define VERSION "version-unused"
| #define LTDL_SHLIBPATH_VAR "PATH"
| #define DEBUG 1
| #define USE_LTDL 1
| /* end confdefs.h.  */
| #include <ac_nonexistent.h>
 /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc -shared-libgcc
-B/cygdrive/c/gcc-4_2-branch-build/./gcc -nostdinc++
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src/.libs
-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 -E
conftest.cc
ltconfig:678:checking for /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc option to
produce PIC
ltconfig:687:checking that /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc PIC flag
-DDLL_EXPORT -DPIC works.
ltconfig:697:  /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc -shared-libgcc
-B/cygdrive/c/gcc-4_2-branch-build/./gcc -nostdinc++
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src/.libs
-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 -c -g -O2 
-DDLL_EXPORT -DPIC -DPIC  conftest.cc 1>&5
ltconfig:749: checking if /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc static
flag -static works
ltconfig:758:  /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc -shared-libgcc
-B/cygdrive/c/gcc-4_2-branch-build/./gcc -nostdinc++
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src/.libs
-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
conftest -g -O2    -static conftest.cc  1>&5
ltconfig:780: finding the maximum length of command line arguments
ltconfig:@lineno@: result: 8192
ltconfig:887: checking if /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc supports
-fno-rtti -fno-exceptions
ltconfig:888:  /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc -shared-libgcc
-B/cygdrive/c/gcc-4_2-branch-build/./gcc -nostdinc++
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src/.libs
-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 -c -g -O2 
-fno-rtti -fno-exceptions -c conftest.cc  conftest.cc 1>&5
ltconfig:1431: checking if global_symbol_pipe works
ltconfig:1432:  /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc -shared-libgcc
-B/cygdrive/c/gcc-4_2-branch-build/./gcc -nostdinc++
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src/.libs
-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 -c -g -O2 
 conftest.cc 1>&5
ltconfig:1435: eval "/cygdrive/c/gcc-4_2-branch-build/./gcc/nm conftest.o | sed
-n -e 's/^.*[   ]\([ABCDGISTW][ABCDGISTW]*\)[   ][     
]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p' > conftest.nm"
cannot find nm_test_var in conftest.nm
ltconfig:1431: checking if global_symbol_pipe works
ltconfig:1432:  /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc -shared-libgcc
-B/cygdrive/c/gcc-4_2-branch-build/./gcc -nostdinc++
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src/.libs
-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 -c -g -O2 
 conftest.cc 1>&5
ltconfig:1435: eval "/cygdrive/c/gcc-4_2-branch-build/./gcc/nm conftest.o | sed
-n -e 's/^.*[   ]\([ABCDGISTW][ABCDGISTW]*\)[   ][     
]*\(_\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p' > conftest.nm"
ltconfig:1487:  /cygdrive/c/gcc-4_2-branch-build/./gcc/xgcc -shared-libgcc
-B/cygdrive/c/gcc-4_2-branch-build/./gcc -nostdinc++
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libstdc++-v3/src/.libs
-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
conftest -g -O2  -fno-builtin -fno-rtti -fno-exceptions   conftest.cc
conftstm.o 1>&5
configure:6428: checking for gcj
configure:6454: result: /cygdrive/c/gcc-4_2-branch-build/gcc/gcj
-B/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/
-B/cygdrive/c/gcc-4_2-branch-build/gcc/
configure:6475: checking dependency style of
/cygdrive/c/gcc-4_2-branch-build/gcc/gcj
-B/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/
-B/cygdrive/c/gcc-4_2-branch-build/gcc/
configure:6565: result: gcc3
ltconfig:678:checking for /cygdrive/c/gcc-4_2-branch-build/gcc/gcj option to
produce PIC
ltconfig:687:checking that /cygdrive/c/gcc-4_2-branch-build/gcc/gcj PIC flag
-DDLL_EXPORT works.
ltconfig:749: checking if /cygdrive/c/gcc-4_2-branch-build/gcc/gcj static flag
-static works
ltconfig:780: finding the maximum length of command line arguments
ltconfig:@lineno@: result: 8192
ltconfig:887: checking if /cygdrive/c/gcc-4_2-branch-build/gcc/gcj supports
-fno-rtti -fno-exceptions
ltconfig:888: /cygdrive/c/gcc-4_2-branch-build/gcc/gcj
-B/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/
-B/cygdrive/c/gcc-4_2-branch-build/gcc/ -c -g -O2 -fno-rtti -fno-exceptions -c
conftest.java  conftest.java 1>&5
jc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not
for Java
conftest.java:1: internal compiler error: in uses_jv_markobj_p, at
java/boehm.c:245
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
jc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not
for Java
conftest.java:1: internal compiler error: in uses_jv_markobj_p, at
java/boehm.c:245
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
ltconfig:1431: checking if global_symbol_pipe works
ltconfig:1432: /cygdrive/c/gcc-4_2-branch-build/gcc/gcj
-B/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/
-B/cygdrive/c/gcc-4_2-branch-build/gcc/ -c -g -O2  conftest.java 1>&5
conftest.java:1: error: Invalid character '#' in input.
#ifdef __cplusplus
   ^
1 error
ltconfig: failed program was:
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}
ltconfig:1431: checking if global_symbol_pipe works
ltconfig:1432: /cygdrive/c/gcc-4_2-branch-build/gcc/gcj
-B/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/
-B/cygdrive/c/gcc-4_2-branch-build/gcc/ -c -g -O2  conftest.java 1>&5
conftest.java:1: error: Invalid character '#' in input.
#ifdef __cplusplus
   ^
1 error
ltconfig: failed program was:
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}
configure:6609: checking whether /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 and cc understand -c and -o together
configure:6639: /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 -c conftest.c -o conftest.o >&5
configure:6642: $? = 0
configure:6644: /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 -c conftest.c -o conftest.o >&5
configure:6647: $? = 0
configure:6654: cc -c conftest.c >&5
configure:6657: $? = 0
configure:6660: cc -c conftest.c -o conftest.o >&5
configure:6663: $? = 0
configure:6665: cc -c conftest.c -o conftest.o >&5
configure:6668: $? = 0
configure:6686: result: yes
configure:6867: checking for exception model to use
configure:6926: result: sjlj
configure:7075: checking how to run the C preprocessor
configure:7110: /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 -E  conftest.c
configure:7116: $? = 0
configure:7148: /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 -E  conftest.c
conftest.c:22:28: error: ac_nonexistent.h: No such file or directory
configure:7154: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "libjava"
| #define PACKAGE_TARNAME "libjava"
| #define PACKAGE_VERSION "version-unused"
| #define PACKAGE_STRING "libjava version-unused"
| #define PACKAGE_BUGREPORT ""
| #ifdef __cplusplus
| extern "C" void exit (int);
| #endif
| #define PACKAGE "libjava"
| #define VERSION "version-unused"
| #define LTDL_SHLIBPATH_VAR "PATH"
| #define DEBUG 1
| #define USE_LTDL 1
| #define LIBGCJ_GC_DEBUG 1
| #define INTERPRETER 1
| #define SJLJ_EXCEPTIONS 1
| #define USE_LIBFFI 1
| #define ENABLE_JVMPI 1
| /* end confdefs.h.  */
| #include <ac_nonexistent.h>
configure:7193: result: /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 -E
configure:7217: /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 -E  conftest.c
configure:7223: $? = 0


I'll leave this in the capable hands of someone more knowledgable than I am;
about what they are trying to accomplish in this part of the configure and how
best to do it. I am still able to compile java with this problem present.

Thanks for reading this and fixing it,
Rob


-- 
           Summary: libjava configure script mix up with .c / .java using
                    gcj /gcc
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
        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=30448



More information about the Java-prs mailing list