Undefined references for SWT

Marco Trudel mtrudel@gmx.ch
Sun Feb 11 15:33:00 GMT 2007


Harpal Grover wrote:
> I think I figured out what may be the swt,

I don't understand that....


> I guess it's because the
> the swt.jar wasn't the first jar being compiled in the command, so the
> other jar's that relied on the swt library were failing.

I don't understand that either. It would help if you could post the 
manual commands that you do step by step.


> Yeah I understand, this may be a bit difficult to read because of all
> of the parameters being defined.
> 
> All the optimization parameters are being appended to the main line as
> required at runtime (This is what it looks like without including the
> swt.jar):
> 
> mkdir -p release/resource
> gcj  -O3 -g0   --main=App -fjni release/./gface_0.9.1.jar.o    App.o

This is the command you run? Where is SWT?


> When I do include the swt.jar to compile to swt.jar.o, the compilation
> of the swt.jar seems to take forever, and does not ever compile
> (compilation was taken well over 9 hours before I decided to kill the
> process)... I really don't know what else to try at this point.

It is a known problem that compilation is very slow with recent GCJ 
versions. However, over 9 hours for swt? I think it takes about 15 
minutes on my machine with -O2. So you might run out of memory or have 
other problems.

Again, it would help to know: Which GCJ version you use, how you created 
your makefile and if you tried to compile manually and send these 
commands...


Marco


> On 2/11/07, Marco Trudel <mtrudel@gmx.ch> wrote:
>> Harpal Grover wrote:
>> > Here is my makefile, which shows all of the gcj runtime parameters
>> > (org.eclipse.swt.windgets.Control is in the swt.jar):
>> >
>> > # Generated by Eclipse GCJ Builder
>> > # http://gcjbuilder.sf.net
>> >
>> > #global targets
>> > ALL:    main
>> > all:    main
>> >
>> > #gcj variable
>> > GCJ=gcj  $(OPTLEVEL) $(DEBUGLEVEL) $(COMPILER_OPTIONS)
>> >
>> > #binary output folder
>> > BINOUT= release
>> >
>> > #compiler options
>> > COMPILER_OPTIONS=
>> >
>> > #linker options
>> > LINKER_OPTIONS=
>> >
>> > #object list
>> > OBJ=App.o
>> >
>> > #custom objects
>> > CUSTOM_OBJ=
>> >
>> > #jar objects
>> > CPOBJ=$(BINOUT)/./nebula_grid_ALPHA.jar.o
>> > $(BINOUT)/./gface_0.9.1.jar.o $(BINOUT)/./swt.jar.o
>> >
>> > #jar so
>> > CPSO=
>> >
>> > #project classpath
>> > 
>> CP="--classpath=C:/projects/java/TSCN/Desktop/lib/h2.jar;C:/projects/java/TSCN/Desktop/lib/nebula_grid_ALPHA.jar;C:/projects/java/TSCN/Desktop/lib/ktable_2.1.3.jar;gface_0.9.1.jar;C:/thisiscool-gcc/swt/win32/3218/swt.jar;./;" 
>>
>> >
>> >
>> > #main class (or so output)
>> > MAINCLASS=--main=App -fjni
>>
>> I only see -fjni here for the main compilation.
>>
>>
>> > #binary name (exe or so)
>> > BIN=$(BINOUT)/scnlm.exe
>> >
>> > #library path list
>> > LIBRARYPATH=-L$(BINOUT)
>> >
>> > #libraries (so) list
>> > LIBRARIES=
>> >
>> > #resource objects list
>> > RESOB=
>> >
>> > #compiler optimization level
>> > OPTLEVEL= -O3
>> >
>> > #compiler debug level
>> > DEBUGLEVEL= -g0
>> >
>> >
>> > #object targets
>> > %.o:    %.java
>> >     $(GCJ) $(CP)  -c $? -o $@
>>
>> Here -fjni is missing if this compiles swt to an object. But I was too
>> lazy to take a close look at this huge (in comparison to some little
>> short manual commands which would have been a good alternative)
>> makefile. So I might be wrong...
>>
>>
>> Marco
>>
>> > ##################
>> > #dummy targets (depend on config)
>> >
>> > #classpath objects target
>> > $(BINOUT)/./nebula_grid_ALPHA.jar.o
>> > :C:/projects/java/TSCN/Desktop/lib/nebula_grid_ALPHA.jar
>> >     $(GCJ) -c $(CP)
>> > C:/projects/java/TSCN/Desktop/lib/nebula_grid_ALPHA.jar
>> > -o$(BINOUT)/nebula_grid_ALPHA.jar.o
>> > $(BINOUT)/./gface_0.9.1.jar.o :gface_0.9.1.jar
>> >     $(GCJ) -c $(CP) gface_0.9.1.jar -o$(BINOUT)/gface_0.9.1.jar.o
>> > $(BINOUT)/./swt.jar.o :C:/thisiscool-gcc/swt/win32/3218/swt.jar
>> >     $(GCJ) -c $(CP) C:/thisiscool-gcc/swt/win32/3218/swt.jar
>> > -o$(BINOUT)/swt.jar.o
>> >
>> >
>> > #classpath so target
>> >
>> >
>> > #resource objects target
>> >
>> >
>> >
>> > #################
>> >
>> >
>> > #main target
>> >
>> > main: setup $(CPOBJ) $(RESOB) $(OBJ) $(CPSO)
>> >     $(GCJ) $(LINKER_OPTIONS) $(MAINCLASS) $(CPOBJ) $(CUSTOM_OBJ) 
>> $(RESOB)
>> > $(OBJ) -o$(BIN)   $(LIBRARYPATH) $(LIBRARIES) $(CPSO)
>> >
>> > #setup output folders
>> > setup:
>> >     mkdir -p $(BINOUT)/resource
>> >
>> > #clean target
>> > clean:
>> >     rm -f `find . -name "*.o"`
>> >     rm -r $(BINOUT)
>> >
>> > On 2/11/07, Andrew Haley <aph@redhat.com> wrote:
>> >> Harpal Grover writes:
>> >>  > Hi,
>> >>  >
>> >>  > I am using GCJ for MingW  GCC/GCJ 4.3 (gcj-eclipse-merge-branch).
>> >>  >
>> >>  > I am getting the following errors when I attempt to compile not 
>> only
>> >>  > my java code, but referenced jars as well:
>> >>  >
>> >>  >
>> >>  >
>> >>  > 
>> org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc28):
>> >>  > undefined reference to
>> >>  > `org::eclipse::swt::widgets::Control::isActive()'
>> >>  >
>> >>  > 
>> org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc2c):
>> >>  > undefined reference to
>> >>  > `org::eclipse::swt::widgets::Control::isEnabled()'
>> >>  >
>> >>  > 
>> org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc30):
>> >>  > undefined reference to
>> >>  > `org::eclipse::swt::widgets::Control::isFocusControl()'
>> >>  >
>> >>  > 
>> org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc34):
>> >>  > undefined reference to
>> >>  >
>> >> 
>> `org::eclipse::swt::widgets::Control::isFocusAncestor(org::eclipse::swt::widgets::Control*)' 
>>
>> >>
>> >>  >
>> >>  > 
>> org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc38):
>> >>  > undefined reference to
>> >>  > `org::eclipse::swt::widgets::Control::isReparentable()'
>> >>  >
>> >>  > 
>> org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc3c):
>> >>  > undefined reference to
>> >>  > `org::eclipse::swt::widgets::Control::isShowing()'
>> >>  > I have included the swt.jar that MingW provides in the classpath. I
>> >>  > have also used the -fjni flag. I must be missing something here. 
>> Can
>> >>  > anyone give me any pointers?
>> >>
>> >> You haven't give us enough information.  In which jar is
>> >> org.eclipse.swt.windgets.Control?  Did you compile it?  What compile
>> >> args did you use?
>> >>
>> >> Andrew.
>> >>
>> >
>> >
>>
>>
> 
> 



More information about the Java mailing list