This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: linux audio software using gcj&swt!


On Thu, 2003-10-23 at 16:12, Anthony Green wrote:
> On Thu, 2003-10-23 at 07:00, Anthony Green wrote:
> > My solution was to hack SWT to _not_ load the native library (just look
> > for the System.loadLibrary call), and link the native libs into the
> > static executable with the following:
> > 
> > -Wl,--whole-archive,libswt-gtk-2135.a,libswt-pi-gtk-2135.a,--no-whole-archive
> 
> I should have added that you may need to use -Wl,--export-dynamic as
> well.
> 
> AG


thanks! that worked!

i got the libswt-sources from 
http://libswt.sourceforge.net/ (they have makefiles for gcj)

... struggled with the gcj-include path (solution: ./configure
--with-includes="/usr/include/libgcj/ /usr/include/") and built the *.a
archives successfully.

(it would be nice if there were rpms of this libswt)

after millions of undefined references i finally got my makefile right:

--------------------

#
# trick for not existing switch -static-libgcj: rename libgcj.so!
#
#   mv /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/libgcj.so
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/libgcj.so_off
#

SWTJAR=/usr/local/lib/libswt-gtk2.jar

GTKDEPS_LIBS = -Wl,--export-dynamic -lgtk-x11-2.0 -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lgthread-2.0


monolith: mono_1 mono_2 mono_3

mono_1:
find src | grep .java >filelist.gcj
gcj --classpath=$(SWTJAR) -g -c @filelist.gcj -o bin/radiocap.o

mono_2:
gcj -c -fjni -o bin/swt_gtk2.o \
$(SWTJAR)

mono_3:
gcj  -s -DNO_DYNAMIC_SWTLIB \
-static-libgcc \
$(GTKDEPS_LIBS) \
-o bin/radiocap_bin_static \
--main=app.radiocap.MainWindow -L. \
-L/usr/local/lib \
-L/usr/lib \
-Wl,--Bstatic,--whole-archive,-lswt-gtk-2135,-lswt-pi-gtk-2135,--no-whole-archive,--Bdynamic \
bin/radiocap.o \
bin/swt_gtk2.o

--------------

i changed org.eclipse.swt.internal.Library to switch the
System.loadLibrary() on/off...

diff Library.java ./orig/Library.java
83,89d82
<
<       // Hack for support of static linking!
<       if (System.getProperty("NO_DYNAMIC_SWTLIB")!=null) {
<               System.err.println("NO_DYNAMIC_SWTLIB!");
<               return;
<       }
<

if you want to try this statically-linked swt-app:
http://www.scheinwelt.at/~norbertf/radiocap_homepage/files/

regards,

norbert




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]