Reply
Thread Tools
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#1
Hi,

as Java "kind of" works (http://talk.maemo.org/showthread.php?t=37405) it would be great to have also SWT running.

One option would be to build SWT in Scratchbox on the ARMEL target. Though afaik building SWT requires Java and here unfortunately both JDK's fail to run under Scartchbox with similar errors:
[sbox-FREMANTLE_ARMEL: ~] > java/openjdk/camswl/j2sdk-image/bin/java
qemu: Unsupported syscall: 242
qemu: Unsupported syscall: 242
*** glibc detected *** java/openjdk/camswl/j2sdk-image/bin/java: double free or corruption (!prev): 0x0001fab0 ***

[sbox-FREMANTLE_ARMEL: ~] > java/sun_ejre/ejre1.6.0_10/bin/java
qemu: Unsupported syscall: 242
qemu: Unsupported syscall: 242
*** glibc detected *** java/sun_ejre/ejre1.6.0_10/bin/java: double free or corruption (!prev): 0x0001df80 ***
What other options are there to get SWT for Fremantle?
Is it feasible to get the required files from debian packages or is the whole task a bigger endeavor?
At least the guys from Jalimo also got SWT packaged for their Java port.

Any comments are highly appreciated.


Best regards

Wonko

Last edited by Wonko; 2010-01-16 at 11:54. Reason: Changed title
 
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#2
Allright it works!

Just managed to build SWT and run the first example application on my N900.

The short story:
As Java does not run under Scratchbox i built SWT in two steps. The first was to build the native libraries in Scratchbox and the second to build the Java part on the N900 itself.

You can find the patches etc. at the project garage site: https://garage.maemo.org/projects/swt-hildon/

I'll also add another post where i'll explain the details of building SWT later on.

In order to test the whole stuff i used the "SimpleSwtSample" example from http://wiki.evolvis.org/jalimo/index.php/Maemo.
Compile the example as follows (note: i am using the openjdk downloaded from http://www.camswl.com/openjdk):
Code:
CLASSPATH="path_to_swt/swt.jar" /home/user/java/openjdk/camswl/j2sdk-image/bin/javac SimpleSwtSample.java
And run as follows:
Code:
CLASSPATH=.:path_to_swt/swt.jar /home/user/java/openjdk/camswl/j2sdk-image/bin/java -Djava.library.path=path_to_swt/ SimpleSwtSample
I only tested the results with openjdk so far.


Best regards

Wonko

Last edited by Wonko; 2011-04-17 at 18:54.
 

The Following 4 Users Say Thank You to Wonko For This Useful Post:
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#3
Here are the detailed steps used for building SWT.

The following is executed in Scratchbox (in the armel target of course):
Code:
#!/bin/sh
N900_IP=192.168.0.125
N900_SWT_DIR=/home/user/swt

#Optionally build support for mozilla and xulrunner
#cd ${HOME}
#mkdir xulrunner_dev
#cd xulrunner_dev
#wget http://security.debian.org/debian-security/pool/updates/main/x/xulrunner/xulrunner-dev_1.9.0.18-1_armel.deb
#dpkg -x xulrunner-dev_1.9.0.18-1_armel.deb .
#wget http://ftp.de.debian.org/debian/pool/main/n/nspr/libnspr4-dev_4.7.1-5_armel.deb
#dpkg -x libnspr4-dev_4.7.1-5_armel.deb .
#wget http://moff.mozilla.com/maemo/en-US/dists/chinook/release/binary-armel/xulrunner_1.9.2.1+rc1_armel.deb
#dpkg -x xulrunner_1.9.2.1+rc1_armel.deb .
#cp opt/mozilla/xulrunner-1.9.2.1/lib* usr/lib/xulrunner-devel-1.9/lib

apt-get install icedtea6
export JAVA_HOME=/opt/icedtea6
export AWT_LIB_PATH=$JAVA_HOME/jre/lib/arm

cd $HOME
mkdir swt
cd swt

wget http://download.eclipse.org/eclipse/downloads/drops/R-3.6.2-201102101200/swt-3.6.2-gtk-linux-x86.zip

unzip swt-3.6.2-gtk-linux-x86.zip
unzip src.zip -d swt_src

#get swt-3.6.2-hildon-cumulative.patch
cd swt_src
patch -p1 < ../swt-3.6.2-hildon-cumulative.patch

make -j1 -f make_linux.mak NO_STRIP=y CC=gcc CXX=g++ make_awt
make -j1 -f make_linux.mak NO_STRIP=y CC=gcc CXX=g++ make_swt
make -j1 -f make_linux.mak NO_STRIP=y CC=gcc CXX=g++ make_atk
make -j1 -f make_linux.mak NO_STRIP=y CC=gcc CXX=g++ make_cairo
#make -j1 -f make_linux.mak NO_STRIP=y CC=gcc CXX=g++ make_mozilla
#make -j1 -f make_linux.mak NO_STRIP=y CC=gcc CXX=g++ make_xulrunner

cd ..
ssh root@$N900_IP mkdir $N900_SWT_DIR
scp -r swt_src root@$N900_IP:$N900_SWT_DIR
ssh root@$N900_IP chown -R user:users $N900_SWT_DIR
Then switch back to your "normal" system.
Code:
mkdir swt
cd swt
cp -r /opt/scratchbox/users/<your user>/home/<your user>/swt/swt_src .
cd swt_src
#Get the modified build.xml from the repository.
#Finally, run ant.
ant
That's it.

Last edited by Wonko; 2011-03-12 at 21:13. Reason: Update instructions to SWT version 3.6.2
 

The Following 5 Users Say Thank You to Wonko For This Useful Post:
Posts: 1 | Thanked: 0 times | Joined on Jan 2010
#4
java.lang.UnsatisfiedLinkError : no swt-gtk-3555 or swt-gtk in swt.library.path? or jar file etc.
Please help.

JRE 1.6.0.10
 
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#5
Originally Posted by midday View Post
java.lang.UnsatisfiedLinkError : no swt-gtk-3555 or swt-gtk in swt.library.path? or jar file etc.
Please help.
JRE 1.6.0.10
One option is to tell java where it can find the native libraries.
You do this by setting the "-Djava.library.path" "option" as follows:
Code:
CLASSPATH=./swt.jar java -Djava.library.path=path_to_swt/ SimpleSwtSample
"path_to_swt/" is a directory in which you place the native libraries.

Another option would be to copy the native libs to /usr/lib or (better, if you want this solution) copy the libs to /opt/maemo/usr/lib and then place symlinks to /usr/lib.

If you are just playing around i think the first option (setting "-Djava.library.path") is best.

Last edited by Wonko; 2010-01-29 at 19:01.
 

The Following 2 Users Say Thank You to Wonko For This Useful Post:
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#6
Alright,

i adapted the patch from http://wiki.evolvis.org/jalimo/index.php/Maemo (namely: http://evolvis.org/plugins/scmsvn/vi...20&root=jalimo) to work with the current SWT version and Fremantle.

The patch can be downloaded from: http://user.fh-frankfurt.de/~rc9000/...t-hildon.patch
Also the build instructions above have been updated to make use of the patch.

Edit: And of course the downloads at http://user.fh-frankfurt.de/~rc9000/maemo_swt have also been updated
 

The Following 2 Users Say Thank You to Wonko For This Useful Post:
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#7
I added a patch which enables scrolling via the touch UI for org.eclipse.swt.widgets.Tree and Table instead of using scrollbars.
The patch can be found at: http://user.fh-frankfurt.de/~rc9000/...ee-table.patch

A compiled version of SWT with this patch applied can be downloaded from http://user.fh-frankfurt.de/~rc9000/...t/experimental
So far everything worked nicely here.
Please let me know if this works also well for you.
 

The Following 4 Users Say Thank You to Wonko For This Useful Post:
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#8
I added two more patches.

The first simply adds native methods for using hildon buttons and file dialog chooser and (most important) cleans a little bit up the code.
I.e. the methods flagged with "no_gen" have been moved into os_custom.c. This should improve the maintainability.

The second patch changes org.eclipse.swt.widgets.FileDialog to make use of HildonFileChooserDialog.

Again the patches are in the usual place and a compiled version has been uploaded to experimental.
 

The Following 3 Users Say Thank You to Wonko For This Useful Post:
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#9
Added another patch which enables pop-up menus.
Note: This is only provided for compatibility reasons as, according to the documentation (http://wiki.maemo.org/Documentation/...s#Context_menu) pop-up or context menus should not be used.

Patch and compiled binaries are at the usual locations.
 

The Following 2 Users Say Thank You to Wonko For This Useful Post:
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#10
Alright, had some time to update the patches etc. to SWT-3.5.2.
As usual patches and compiled versions can be found at http://user.fh-frankfurt.de/~rc9000/maemo_swt/

The swt.jar now also includes the *.so libraries. An additional jar is available without the *.so files.


Best regards

Wonko
 

The Following 5 Users Say Thank You to Wonko For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 16:01.