Tux Guitar

Problems

Subject Building from sources with gcj under x86_64



Author Message
Roman
Post: Dec 24th 2009 at 3:53 PM

I spent a plenty of time trying to build a native x86_64 version of tuxguitar and plugins. Well, this is not a hard task, I've just had to put swt.jar to the TuxGuitar/lib directory in the sources tree and run build.sh. Everything built well. BUT the program starts with errors: it can not load almost all plugins, only alsa, sytemray and batchconverter plugins load. I tried to compile the so-libs of plugins with and without linking with libtuxguitar.so, it didn't helped.
Then I put jar-files of plugins taken from the tuxguitar-1.2-linux-x86_64.tar.gz build. I was really surprised: plugins loaded successfully and work.
Does anybody experienced such problems with gcj-builds?


Back to Top
 
Roman
Post: Dec 24th 2009 at 4:12 PM

PS: I have no java-environment installed on my system. So I can't understand how these plugins in java byte-code are executed (not all plugins work).


Back to Top
 
Julian
Post: Dec 24th 2009 at 4:53 PM

With native plugins.. do you see any error log under a terminal ??

>> So I can't understand how these plugins in java byte-code are executed
GCJ works can build to native, but it still run as a JRE.. so it can load both.. bytecode and native code.
In other words, you could use tuxguitar bytecode version, and make it run under GCJ/GIJ without have to build it to native.

>> not all plugins work
No, there are some plugins that can't work under GCJ as default.
for tuxguitar-jsa, you could configure GCJ to make it work, but it's no so easy to explain...

tuxguitar-gervill also don't work with it, since it also uses java sound api.


Back to Top
 
Roman
Post: Dec 25th 2009 at 7:50 AM

>> With native plugins.. do you see any error log under a terminal ??
Yes, the error log is present. Here is the full output for gtp-plugin:
-----------------------------------------------------------
java.lang.NoClassDefFoundError: org.herac.tuxguitar.io.gtp.GTPPluginList
at java.lang.Class.initializeClass(natClass.cc:727)
at java.lang.Class.newInstance(Class.h:742)
at org.herac.tuxguitar.util.TGServiceReader$IteratorImpl.next(libtuxguitar.so)
at org.herac.tuxguitar.gui.system.plugins.TGPluginManager.initPlugins(libtuxguitar.so)
at org.herac.tuxguitar.gui.system.plugins.TGPluginManager.(libtuxguitar.so)
at org.herac.tuxguitar.gui.TuxGuitar.getPluginManager(libtuxguitar.so)
at org.herac.tuxguitar.gui.TuxGuitar.displayGUI(libtuxguitar.so)
at org.herac.tuxguitar.gui.TGMain.main(libtuxguitar.so)
Caused by: java.lang.NoClassDefFoundError: (Lorg.eclipse.swt.widgets.Shell;)V
at java.lang.Class.initializeClass(natClass.cc:717)
...7 more
org.herac.tuxguitar.gui.system.plugins.TGPluginException: An error ocurred when trying to init plugin
at org.herac.tuxguitar.gui.system.plugins.TGPluginManager.initPlugins(libtuxguitar.so)
at org.herac.tuxguitar.gui.system.plugins.TGPluginManager.(libtuxguitar.so)
at org.herac.tuxguitar.gui.TuxGuitar.getPluginManager(libtuxguitar.so)
at org.herac.tuxguitar.gui.TuxGuitar.displayGUI(libtuxguitar.so)
at org.herac.tuxguitar.gui.TGMain.main(libtuxguitar.so)
Caused by: java.util.NoSuchElementException
at org.herac.tuxguitar.util.TGServiceReader$IteratorImpl.next(libtuxguitar.so)
at org.herac.tuxguitar.gui.system.plugins.TGPluginManager.initPlugins(libtuxguitar.so)
...4 more
-----------------------------------------------------------

>>In other words, you could use tuxguitar bytecode version, and make it run under GCJ/GIJ without have to build it to native.
I didn't know about GIJ, well know everything became clear to me.

But it's still interesting to use the native builds of plugins that should work with gcj.


Back to Top
 
Julian
Post: Dec 25th 2009 at 2:52 PM

>> Caused by: java.lang.NoClassDefFoundError: (Lorg.eclipse.swt.widgets.Shell;)

It seems that the plugins don't find SWT library, that is supposed is included at libtuxguitar.so after built it.
in the previous post, you told:
>> without linking with libtuxguitar.so, it didn't helped
Now, doing this test.. are plugins linked with libtuxguitar.so ???

Try make a fresh build, in a new temporal folder..
just extract the sources, copy swt.jar inside TuxGuitar/lib, and run build.sh..
are you sure you don't see any error log at make time ???

Then,
On x86 version we included a script, that adds libtuxguitar.so at library path, and then run bin/tuxguitar.bin..
How are you running it ??

Unfortunatly i don't have a 64bit PC to test it or do a prebuilt package.

The last question is.. what GCJ version do you have??


Back to Top
 
Roman
Post: Dec 25th 2009 at 4:40 PM

>> It seems that the plugins don't find SWT library
Don't you know if tuxguitar-alsa and tuxguitar-converter plugins use SWT library. If not it seems like other plugins dont't find SWT, as you've said.
While compiling I didn't notice any error messages. But I'll follow your advice and try to make a fresh build but it will take some time.

>> without linking with libtuxguitar.so
The error log in this case was the same as in the case of linking with the libtuxguitar.so library i.e. "java.lang.NoClassDefFoundError..."

>>How are you running it ?
$ LD_LIBRARY_PATH=lib ./bin/tuxguitar.bin
AFAIR I use the same way as in the mentioned script of x86 version. But I tried to copy tuxguitar's files hierarchy to the /usr, the effect was the same: plugins didn't load (except alsa and converter).

>> what GCJ version do you have?
I use the 4.4.2 version of gcc built with the instructions provided at http://cblfs.cross-lfs.org/index.php/GCC. To include the eclipse I used ecj.jar taken from sourceware.org/pub/java as described at contrib/download_ecj.

>>Unfortunatly i don't have a 64bit PC to test it or do a prebuilt package.
From my side I can try to build a native x86 version.


Back to Top
 
Julian
Post: Dec 26th 2009 at 2:14 PM

>> Don't you know if tuxguitar-alsa and tuxguitar-converter plugins use SWT library
tuxguitar-alsa: No.
tuxguitar-converter: Yes

SWT (Sandard Widgets Toolkit) is the library that tuxguitar uses for widgets ( windows, graphics, etc.. )

SWT was compiled to native succesfully, because tuxguitar starts...

Some plugins uses it, because they have a configure window..
in the converter plugin case, you see a window when you go to Tools -> Converter.. it opens the window to choose input/output folders...

>>>> without linking with libtuxguitar.so
>>The error log in this case was the same as in the case of linking with
>>the libtuxguitar.so library i.e. "java.lang.NoClassDefFoundError..."

NoClassDefFoundError, is the error title, but it must be followed by the class name.. (Lorg.eclipse.swt.widgets.Shell;)

What i was asking, is that if you are complety sure, that when you pasted me the error log, you was trying with a "linked to libtuxugitar.so" version of the plugin.
then you could see NoClassDefFoundError again.. but is the classname org.eclipse.swt.widgets.Shell ??

In other words, when you tried it "without link to libtuxguitar.so" you forced an error (it will never work without link it).. so did you revert that change later ???


Back to Top
 
Julian
Post: Dec 26th 2009 at 5:09 PM

Ok, i found that this problem happens with GCJ 4.4 ( i built the package with 4.3 )
So i could reproduce it also under 32bit PC.
it seems that the libtuxguitar-*.so are not dynamically loaded at all..
It;s hard to explain.. they are loaded fine, but then they don't works with a different classloader.

if you see, tuxguitar-alsa, and converter are loaded as plugins, but they don't works because other classes inside the .so file are not working (or this happens in 32bit )

Now i could make it works by using the "-fbootstrap-classes" flag. (that uses a Bootstrap class loader to load all classes, instead of the system class loader )

You could test if it fixed the problem also for 64bit
Open the file build_gcj.sh, and replace:
export GCJFLAGS="-fsource=1.4 -fPIC"
To
export GCJFLAGS="-fbootstrap-classes -fsource=1.4 -fPIC"

And make a new build.. it worked for me..


Back to Top
 
Roman
Post: Dec 28th 2009 at 8:55 AM

I built the program with "-fbootstrap-classes" flag. Now all plugins load and work.


Back to Top
 
Jacoby
Post: Dec 18th 2011 at 5:44 AM

What a great resuroce this text is.


Back to Top
 
hlqaiot
Post: Dec 18th 2011 at 9:58 AM

UxMXQx volwpujvtrac


Back to Top