PDA

View Full Version : Compiling Java with MingW32


TheUnforgiven
9th October 2005, 13:17
When i try to compile a basic helloworld class using this command:
gcj --main=Test Test.java -o Test

I get this error message:
c:\mingw\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -liconv
collect2: ld returned 1 exit status

Whats wrong?

Sharktooth
9th October 2005, 14:18
You need libiconv: http://www.gnu.org/software/libiconv/

TheUnforgiven
10th October 2005, 10:37
Thank you, I'll try that and report back.

TheUnforgiven
11th October 2005, 20:16
OK I got the sources. when I ran Configure it seemed successful but make gave the following errors:

$ make
builddir="`pwd`"; cd libcharset && make all && make install-lib libdir="$builddir/lib" includedir="$builddir/lib"
make[1]: Entering directory `/libiconv-1.9.1/libcharset'
if [ ! -d include ] ; then mkdir include ; fi
cp ./include/libcharset.h.in include/libcharset.h
if [ ! -d include ] ; then mkdir include ; fi
cp ./include/localcharset.h.in include/localcharset.h
cd lib && make all
make[2]: Entering directory `/libiconv-1.9.1/libcharset/lib'
/bin/sh ../libtool --mode=compile gcc -I. -I. -I.. -I./.. -I../include -g -O2 -DLIBDIR=\"/usr/local/lib\" -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"/usr/local/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libcharset_set_relocation_prefix -Drelocate=libcharset_relocate -DHAVE_CONFIG_H -c ./localcharset.c
mkdir .libs
chmod 777 .libs
gcc -I. -I. -I.. -I./.. -I../include -g -O2 -DLIBDIR=\"/usr/local/lib\" -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"/usr/local/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libcharset_set_relocation_prefix -Drelocate=libcharset_relocate -DHAVE_CONFIG_H -c ./localcharset.c -DDLL_EXPORT -DPIC -o .libs/localcharset.o
gcc -I. -I. -I.. -I./.. -I../include -g -O2 -DLIBDIR=\"/usr/local/lib\" -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"/usr/local/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libcharset_set_relocation_prefix -Drelocate=libcharset_relocate -DHAVE_CONFIG_H -c ./localcharset.c -o localcharset.o >/dev/null 2>&1
/bin/sh ../libtool --mode=compile gcc -I. -I. -I.. -I./.. -I../include -g -O2 -DLIBDIR=\"/usr/local/lib\" -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"/usr/local/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libcharset_set_relocation_prefix -Drelocate=libcharset_relocate -DHAVE_CONFIG_H -c ./relocatable.c
gcc -I. -I. -I.. -I./.. -I../include -g -O2 -DLIBDIR=\"/usr/local/lib\" -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"/usr/local/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libcharset_set_relocation_prefix -Drelocate=libcharset_relocate -DHAVE_CONFIG_H -c ./relocatable.c -DDLL_EXPORT -DPIC -o .libs/relocatable.o
./relocatable.c:278: error: syntax error before "WINAPI"
./relocatable.c:279: error: syntax error before "module_handle"
./relocatable.c: In function `DllMain':
./relocatable.c:281: error: `reserved' undeclared (first use in this function)
./relocatable.c:281: error: (Each undeclared identifier is reported only once
./relocatable.c:281: error: for each function it appears in.)
./relocatable.c:283: error: `event' undeclared (first use in this function)
./relocatable.c:283: error: `DLL_PROCESS_ATTACH' undeclared (first use in this function)
./relocatable.c:288: error: `module_handle' undeclared (first use in this function)
./relocatable.c:290: error: `FALSE' undeclared (first use in this function)
./relocatable.c:299: error: `TRUE' undeclared (first use in this function)
make[2]: *** [relocatable.lo] Error 1
make[2]: Leaving directory `/libiconv-1.9.1/libcharset/lib'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/libiconv-1.9.1/libcharset'
make: *** [lib/localcharset.h] Error 2

TheUnforgiven
11th October 2005, 20:25
I dont have msysDTK do i need it?

celtic_druid
12th October 2005, 13:08
Try v1.9.2.

TheUnforgiven
12th October 2005, 14:46
:goodpost:
1.9.2 works.
Thank you

TheUnforgiven
12th October 2005, 15:07
i compiled and ran successfully a console application, but when i try to compile a very basic swing test class (JFrame with JButton and JTextField) it compiles but wont run. i get
UIDefaults.getUIError: failed to locate UI class:JPanel
created the glasspane: javax.swing.JPanel[JPanel]
Exception in thread "main"

dimzon
12th October 2005, 15:47
i compiled and ran successfully a console application, but when i try to compile a very basic swing test class (JFrame with JButton and JTextField) it compiles but wont run. i get
UIDefaults.getUIError: failed to locate UI class:JPanel
created the glasspane: javax.swing.JPanel[JPanel]
Exception in thread "main"
Try to run it using JRE from Sun!

TheUnforgiven
12th October 2005, 19:07
but this is a native compile i am not supposed to have a JRE.
the JRE is installed anyway.