Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Native compile of SWT on Linux and MacOS.... NBNBNB
Native compile of SWT on Linux and MacOS.... NBNBNB [message #450337] Thu, 10 February 2005 12:39 Go to next message
Eclipse UserFriend
Originally posted by: cyberdeth.spymac.com

Hi.

I downloaded the native code example from the IBM site. Did exactly like
they did and boom it breaks. This is on Linux slackware 10.0using gcj
3.3.4.

Then I tried SWT 3 for GTK on linux. And this is what I get.

[francoish@cyberdeth:~/src/Java/native/Hello] gcj -fjni --main=Hello
--classpath=./swt.jar:./swt-pi.jar -o Hello Hello.java
-Djava.library.path=. libswt-gtk-3063.so

/tmp/ccMQgVpF.o(.text+0x20): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to `org::eclipse::swt::widgets::Display::class$'
/tmp/ccMQgVpF.o(.text+0x33): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to
`org::eclipse::swt::widgets::Display::Display[in-charge]()'
/tmp/ccMQgVpF.o(.text+0x48): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to `org::eclipse::swt::widgets::Shell::class$'
/tmp/ccMQgVpF.o(.text+0x5f): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to
`org::eclipse::swt::widgets::Shell::Shell[in-charge](org::ec lipse::swt::widgets::Display*)'
/tmp/ccMQgVpF.o(.text+0x71): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to `org::eclipse::swt::layout::RowLayout::class$'
/tmp/ccMQgVpF.o(.text+0x84): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to
`org::eclipse::swt::layout::RowLayout::RowLayout[in-charge]( )'
/tmp/ccMQgVpF.o(.text+0xda): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to `org::eclipse::swt::widgets::Label::class$'
/tmp/ccMQgVpF.o(.text+0xf6): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to
`org::eclipse::swt::widgets::Label::Label[in-charge](org::ec lipse::swt::widgets::Composite*,
int)'
collect2: ld returned 1 exit status

I'm starting to think that this SWT + GCJ native compile is a fase and
doesn't really work. My hello world example looks like this :

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;

public class Hello {

public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
RowLayout layout = new RowLayout();
layout.justify = true;
layout.pack = true;
shell.setLayout(layout);
shell.setText("Hello, World!");
Label label = new Label(shell, SWT.CENTER);
label.setText("Hello, World!");
shell.pack();
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep ();
}
display.dispose ();
}
}

Now when compiling this with java it works great but that is not what I
want. The thing is I get the same result on MacOS, so it isn't OS
specific. Please can someone throw me a friggen bone here.

Thanks
Re: Native compile of SWT on Linux and MacOS.... NBNBNB [message #450338 is a reply to message #450337] Thu, 10 February 2005 12:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cyberdeth.spymac.com

Oh and BTW it doesn't matter whether I don't link against the libraries ie.

[francoish@cyberdeth:~/src/Java/native/Hello] gcj -fjni --main=Hello
--classpath=./swt.jar:./swt-pi.jar -o Hello Hello.java
-Djava.library.path=.

/tmp/ccEQuN5P.o(.text+0x20): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to `org::eclipse::swt::widgets::Display::class$'
/tmp/ccEQuN5P.o(.text+0x33): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to
`org::eclipse::swt::widgets::Display::Display[in-charge]()'
/tmp/ccEQuN5P.o(.text+0x48): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to `org::eclipse::swt::widgets::Shell::class$'
/tmp/ccEQuN5P.o(.text+0x5f): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to
`org::eclipse::swt::widgets::Shell::Shell[in-charge](org::ec lipse::swt::widgets::Display*)'
/tmp/ccEQuN5P.o(.text+0x71): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to `org::eclipse::swt::layout::RowLayout::class$'
/tmp/ccEQuN5P.o(.text+0x84): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to
`org::eclipse::swt::layout::RowLayout::RowLayout[in-charge]( )'
/tmp/ccEQuN5P.o(.text+0xda): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to `org::eclipse::swt::widgets::Label::class$'
/tmp/ccEQuN5P.o(.text+0xf6): In function
`Hello::main(JArray<java::lang::String*>*)':
: undefined reference to
`org::eclipse::swt::widgets::Label::Label[in-charge](org::ec lipse::swt::widgets::Composite*,
int)'
collect2: ld returned 1 exit status

As you can see I'm getting the same undefined symbols..... AAAARRRGGGHHH

Francois Hensley wrote:

> Hi.

> I downloaded the native code example from the IBM site. Did exactly like
> they did and boom it breaks. This is on Linux slackware 10.0using gcj
> 3.3.4.

> Then I tried SWT 3 for GTK on linux. And this is what I get.

> [francoish@cyberdeth:~/src/Java/native/Hello] gcj -fjni --main=Hello
> --classpath=./swt.jar:./swt-pi.jar -o Hello Hello.java
> -Djava.library.path=. libswt-gtk-3063.so

> /tmp/ccMQgVpF.o(.text+0x20): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to `org::eclipse::swt::widgets::Display::class$'
> /tmp/ccMQgVpF.o(.text+0x33): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to
> `org::eclipse::swt::widgets::Display::Display[in-charge]()'
> /tmp/ccMQgVpF.o(.text+0x48): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to `org::eclipse::swt::widgets::Shell::class$'
> /tmp/ccMQgVpF.o(.text+0x5f): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to
>
`org::eclipse::swt::widgets::Shell::Shell[in-charge](org::ec lipse::swt::widgets::Display*)'
> /tmp/ccMQgVpF.o(.text+0x71): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to `org::eclipse::swt::layout::RowLayout::class$'
> /tmp/ccMQgVpF.o(.text+0x84): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to
> `org::eclipse::swt::layout::RowLayout::RowLayout[in-charge]( )'
> /tmp/ccMQgVpF.o(.text+0xda): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to `org::eclipse::swt::widgets::Label::class$'
> /tmp/ccMQgVpF.o(.text+0xf6): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to
>
`org::eclipse::swt::widgets::Label::Label[in-charge](org::ec lipse::swt::widgets::Composite*,
> int)'
> collect2: ld returned 1 exit status

> I'm starting to think that this SWT + GCJ native compile is a fase and
> doesn't really work. My hello world example looks like this :

> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Label;
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.layout.RowLayout;

> public class Hello {

> public static void main(String[] args) {
> Display display = new Display();
> final Shell shell = new Shell(display);
> RowLayout layout = new RowLayout();
> layout.justify = true;
> layout.pack = true;
> shell.setLayout(layout);
> shell.setText("Hello, World!");
> Label label = new Label(shell, SWT.CENTER);
> label.setText("Hello, World!");
> shell.pack();
> shell.open ();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch()) display.sleep ();
> }
> display.dispose ();
> }
> }

> Now when compiling this with java it works great but that is not what I
> want. The thing is I get the same result on MacOS, so it isn't OS
> specific. Please can someone throw me a friggen bone here.

> Thanks
Re: Native compile of SWT on Linux and MacOS.... NBNBNB [message #450348 is a reply to message #450338] Thu, 10 February 2005 17:55 Go to previous messageGo to next message
Radu is currently offline RaduFriend
Messages: 44
Registered: July 2009
Member
as I've told you, for me compiling swt.jar didn't work (on windows).
on linux I've used libswt (http://libswt.sourceforge.net/).
on the other hand I frequently compile swt apps on windows using the
following distro http://thisiscool.com/gcc_mingw.htm#gcj34 and it works
like a charm, both on static and dynamic linking. It has build-in
support for swt3. An idea is to download the source code for thisiscool
distro (large file from same address) and recompile it on linux (the swt
part) if you're not happy with libswt's 2.1 version.

cheers,
Radu


Francois Hensley wrote:
> Oh and BTW it doesn't matter whether I don't link against the libraries ie.
>
> [francoish@cyberdeth:~/src/Java/native/Hello] gcj -fjni --main=Hello
> --classpath=./swt.jar:./swt-pi.jar -o Hello Hello.java
> -Djava.library.path=.
>
> /tmp/ccEQuN5P.o(.text+0x20): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to `org::eclipse::swt::widgets::Display::class$'
> /tmp/ccEQuN5P.o(.text+0x33): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to
> `org::eclipse::swt::widgets::Display::Display[in-charge]()'
> /tmp/ccEQuN5P.o(.text+0x48): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to `org::eclipse::swt::widgets::Shell::class$'
> /tmp/ccEQuN5P.o(.text+0x5f): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to
> `org::eclipse::swt::widgets::Shell::Shell[in-charge](org::ec lipse::swt::widgets::Display*)'
>
> /tmp/ccEQuN5P.o(.text+0x71): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to `org::eclipse::swt::layout::RowLayout::class$'
> /tmp/ccEQuN5P.o(.text+0x84): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to
> `org::eclipse::swt::layout::RowLayout::RowLayout[in-charge]( )'
> /tmp/ccEQuN5P.o(.text+0xda): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to `org::eclipse::swt::widgets::Label::class$'
> /tmp/ccEQuN5P.o(.text+0xf6): In function
> `Hello::main(JArray<java::lang::String*>*)':
> : undefined reference to
> `org::eclipse::swt::widgets::Label::Label[in-charge](org::ec lipse::swt::widgets::Composite*,
> int)'
> collect2: ld returned 1 exit status
>
> As you can see I'm getting the same undefined symbols..... AAAARRRGGGHHH
>
> Francois Hensley wrote:
>
>> Hi.
>
>
>> I downloaded the native code example from the IBM site. Did exactly
>> like they did and boom it breaks. This is on Linux slackware 10.0using
>> gcj 3.3.4.
>
>
>> Then I tried SWT 3 for GTK on linux. And this is what I get.
>
>
>> [francoish@cyberdeth:~/src/Java/native/Hello] gcj -fjni --main=Hello
>> --classpath=./swt.jar:./swt-pi.jar -o Hello Hello.java
>> -Djava.library.path=. libswt-gtk-3063.so
>
>
>> /tmp/ccMQgVpF.o(.text+0x20): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to `org::eclipse::swt::widgets::Display::class$'
>> /tmp/ccMQgVpF.o(.text+0x33): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to
>> `org::eclipse::swt::widgets::Display::Display[in-charge]()'
>> /tmp/ccMQgVpF.o(.text+0x48): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to `org::eclipse::swt::widgets::Shell::class$'
>> /tmp/ccMQgVpF.o(.text+0x5f): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to
>
> `org::eclipse::swt::widgets::Shell::Shell[in-charge](org::ec lipse::swt::widgets::Display*)'
>
>
>> /tmp/ccMQgVpF.o(.text+0x71): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to `org::eclipse::swt::layout::RowLayout::class$'
>> /tmp/ccMQgVpF.o(.text+0x84): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to
>> `org::eclipse::swt::layout::RowLayout::RowLayout[in-charge]( )'
>> /tmp/ccMQgVpF.o(.text+0xda): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to `org::eclipse::swt::widgets::Label::class$'
>> /tmp/ccMQgVpF.o(.text+0xf6): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to
>
> `org::eclipse::swt::widgets::Label::Label[in-charge](org::ec lipse::swt::widgets::Composite*,
>
>
>> int)'
>> collect2: ld returned 1 exit status
>
>
>> I'm starting to think that this SWT + GCJ native compile is a fase and
>> doesn't really work. My hello world example looks like this :
>
>
>> import org.eclipse.swt.widgets.Display;
>> import org.eclipse.swt.widgets.Shell;
>> import org.eclipse.swt.widgets.Label;
>> import org.eclipse.swt.SWT;
>> import org.eclipse.swt.layout.RowLayout;
>
>
>> public class Hello {
>
>
>> public static void main(String[] args) {
>> Display display = new Display();
>> final Shell shell = new Shell(display);
>> RowLayout layout = new RowLayout();
>> layout.justify = true;
>> layout.pack = true;
>> shell.setLayout(layout);
>> shell.setText("Hello, World!");
>> Label label = new Label(shell, SWT.CENTER);
>> label.setText("Hello, World!");
>> shell.pack();
>> shell.open ();
>> while (!shell.isDisposed()) {
>> if (!display.readAndDispatch()) display.sleep ();
>> }
>> display.dispose ();
>> }
>> }
>
>
>> Now when compiling this with java it works great but that is not what
>> I want. The thing is I get the same result on MacOS, so it isn't OS
>> specific. Please can someone throw me a friggen bone here.
>
>
>> Thanks
>
>
>
Re: Native compile of SWT on Linux and MacOS.... NBNBNB [message #450380 is a reply to message #450348] Fri, 11 February 2005 06:46 Go to previous message
Eclipse UserFriend
Originally posted by: cyberdeth.spymac.com

Yeah.

I resorted to using libswt. It works great on Linux, what with GTK being
on there et al, but that still doesn't fix the MacOS thingy. I did however
get some ideas from the project and I'm thinking that I might do the same
thing with SWT 3 on MacOS, ie. take the SWT carbon source code and
recompile it into a .dylib or maybe even a .a.

It will take a bit of work to get it done. Might just use a Makefile to do
it. Seems like the easiest solution.

Thanks a ton. You really helped and given me some ideas to get around this
problem.

Thanks.

Radu Racariu wrote:

> as I've told you, for me compiling swt.jar didn't work (on windows).
> on linux I've used libswt (http://libswt.sourceforge.net/).
> on the other hand I frequently compile swt apps on windows using the
> following distro http://thisiscool.com/gcc_mingw.htm#gcj34 and it works
> like a charm, both on static and dynamic linking. It has build-in
> support for swt3. An idea is to download the source code for thisiscool
> distro (large file from same address) and recompile it on linux (the swt
> part) if you're not happy with libswt's 2.1 version.

> cheers,
> Radu


> Francois Hensley wrote:
>> Oh and BTW it doesn't matter whether I don't link against the libraries ie.
>>
>> [francoish@cyberdeth:~/src/Java/native/Hello] gcj -fjni --main=Hello
>> --classpath=./swt.jar:./swt-pi.jar -o Hello Hello.java
>> -Djava.library.path=.
>>
>> /tmp/ccEQuN5P.o(.text+0x20): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to `org::eclipse::swt::widgets::Display::class$'
>> /tmp/ccEQuN5P.o(.text+0x33): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to
>> `org::eclipse::swt::widgets::Display::Display[in-charge]()'
>> /tmp/ccEQuN5P.o(.text+0x48): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to `org::eclipse::swt::widgets::Shell::class$'
>> /tmp/ccEQuN5P.o(.text+0x5f): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to
>>
`org::eclipse::swt::widgets::Shell::Shell[in-charge](org::ec lipse::swt::widgets::Display*)'
>>
>> /tmp/ccEQuN5P.o(.text+0x71): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to `org::eclipse::swt::layout::RowLayout::class$'
>> /tmp/ccEQuN5P.o(.text+0x84): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to
>> `org::eclipse::swt::layout::RowLayout::RowLayout[in-charge]( )'
>> /tmp/ccEQuN5P.o(.text+0xda): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to `org::eclipse::swt::widgets::Label::class$'
>> /tmp/ccEQuN5P.o(.text+0xf6): In function
>> `Hello::main(JArray<java::lang::String*>*)':
>> : undefined reference to
>>
`org::eclipse::swt::widgets::Label::Label[in-charge](org::ec lipse::swt::widgets::Composite*,
>> int)'
>> collect2: ld returned 1 exit status
>>
>> As you can see I'm getting the same undefined symbols..... AAAARRRGGGHHH
>>
>> Francois Hensley wrote:
>>
>>> Hi.
>>
>>
>>> I downloaded the native code example from the IBM site. Did exactly
>>> like they did and boom it breaks. This is on Linux slackware 10.0using
>>> gcj 3.3.4.
>>
>>
>>> Then I tried SWT 3 for GTK on linux. And this is what I get.
>>
>>
>>> [francoish@cyberdeth:~/src/Java/native/Hello] gcj -fjni --main=Hello
>>> --classpath=./swt.jar:./swt-pi.jar -o Hello Hello.java
>>> -Djava.library.path=. libswt-gtk-3063.so
>>
>>
>>> /tmp/ccMQgVpF.o(.text+0x20): In function
>>> `Hello::main(JArray<java::lang::String*>*)':
>>> : undefined reference to `org::eclipse::swt::widgets::Display::class$'
>>> /tmp/ccMQgVpF.o(.text+0x33): In function
>>> `Hello::main(JArray<java::lang::String*>*)':
>>> : undefined reference to
>>> `org::eclipse::swt::widgets::Display::Display[in-charge]()'
>>> /tmp/ccMQgVpF.o(.text+0x48): In function
>>> `Hello::main(JArray<java::lang::String*>*)':
>>> : undefined reference to `org::eclipse::swt::widgets::Shell::class$'
>>> /tmp/ccMQgVpF.o(.text+0x5f): In function
>>> `Hello::main(JArray<java::lang::String*>*)':
>>> : undefined reference to
>>
>>
`org::eclipse::swt::widgets::Shell::Shell[in-charge](org::ec lipse::swt::widgets::Display*)'
>>
>>
>>> /tmp/ccMQgVpF.o(.text+0x71): In function
>>> `Hello::main(JArray<java::lang::String*>*)':
>>> : undefined reference to `org::eclipse::swt::layout::RowLayout::class$'
>>> /tmp/ccMQgVpF.o(.text+0x84): In function
>>> `Hello::main(JArray<java::lang::String*>*)':
>>> : undefined reference to
>>> `org::eclipse::swt::layout::RowLayout::RowLayout[in-charge]( )'
>>> /tmp/ccMQgVpF.o(.text+0xda): In function
>>> `Hello::main(JArray<java::lang::String*>*)':
>>> : undefined reference to `org::eclipse::swt::widgets::Label::class$'
>>> /tmp/ccMQgVpF.o(.text+0xf6): In function
>>> `Hello::main(JArray<java::lang::String*>*)':
>>> : undefined reference to
>>
>>
`org::eclipse::swt::widgets::Label::Label[in-charge](org::ec lipse::swt::widgets::Composite*,
>>
>>
>>> int)'
>>> collect2: ld returned 1 exit status
>>
>>
>>> I'm starting to think that this SWT + GCJ native compile is a fase and
>>> doesn't really work. My hello world example looks like this :
>>
>>
>>> import org.eclipse.swt.widgets.Display;
>>> import org.eclipse.swt.widgets.Shell;
>>> import org.eclipse.swt.widgets.Label;
>>> import org.eclipse.swt.SWT;
>>> import org.eclipse.swt.layout.RowLayout;
>>
>>
>>> public class Hello {
>>
>>
>>> public static void main(String[] args) {
>>> Display display = new Display();
>>> final Shell shell = new Shell(display);
>>> RowLayout layout = new RowLayout();
>>> layout.justify = true;
>>> layout.pack = true;
>>> shell.setLayout(layout);
>>> shell.setText("Hello, World!");
>>> Label label = new Label(shell, SWT.CENTER);
>>> label.setText("Hello, World!");
>>> shell.pack();
>>> shell.open ();
>>> while (!shell.isDisposed()) {
>>> if (!display.readAndDispatch()) display.sleep ();
>>> }
>>> display.dispose ();
>>> }
>>> }
>>
>>
>>> Now when compiling this with java it works great but that is not what
>>> I want. The thing is I get the same result on MacOS, so it isn't OS
>>> specific. Please can someone throw me a friggen bone here.
>>
>>
>>> Thanks
>>
>>
>>
Previous Topic:CheckboxCellEditor can't toggle state
Next Topic:pocket pc dialog
Goto Forum:
  


Current Time: Tue Sep 24 07:38:04 GMT 2024

Powered by FUDForum. Page generated in 0.03647 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top