Compiling of GCJ and SWT under MacOS X [message #450168] |
Wed, 09 February 2005 08:17 |
Eclipse User |
|
|
|
Originally posted by: cyberdeth.spymac.com
Hi.
I have downloaded gnu gcc 3.4.3 and compiled it with the following
command line
parameters :
configure --prefix=/usr --enable-languages=c,c++,java,f77,objc
--enable-threads=posix --enable-shared
make bootstrap
make install
Now this compiles everything fine under MacOS X.3 using the gcc compiler
that
comes with the Developer Tools ie. gcc 3.3
When I compile a Hello World program using gcj, like so :
gcj Test.java -o Test --classpath
/usr/share/java/libgcjxxx.jar:$CLASSPATH
--main=Test -lgcj
Then it compiles fine and the output from the program is as expected.
But. When I try to link against the libswt-carbon-xxxx.jnilib all hell
breaks loose. I
have tried to make a symlink from *.jnilib to *.dylib and even to .a.
When I do a file
on the jnilib it says it's a bundle.
I have tried to copy the jnilib files
into /System/Library/Frameworks/JavaVM.framework/Libraries and linking
the
program as follows.
gcj Test.java -o Test --classpath
/usr/share/java/libgcjxxx.jar:$CLASSPATH
--main=Test -lgcj -framework JavaVM
which fails.
When I do an ld style
ld Test.o -o Test -lgcj -framework JavaVM then it gives me an error that
no __main is
found hence the --main=Test option.
when doing a gcj Test.o -o Test -lgcj libswt-carbon-xxxx.jnilib it fails
as well telling
me that i can't call a static link editor using a dynamic link editor or
something like
this. And this is where I'm struggling with.
I mean if I link against any other jnilib in the JavaVM framework it
compiles
correctly. Maybe the jnilibs shouldn't be bundles ???
My long winded questions is :
1) Is my gcc configuration flags correct ?
2) How do you compile a program natively using the
swt-carbon-xxxx.jnilib's ? If
you have a MacOS specific example could you please supply me with it.
I have been struggling with it for over a week now and I'm lost....
PLEASE....... Help me.
Francois Hensley
|
|
|
Re: Compiling of GCJ and SWT under MacOS X [message #450272 is a reply to message #450168] |
Wed, 09 February 2005 09:12 |
Radu Messages: 44 Registered: July 2009 |
Member |
|
|
Hi Francois,
you have to link against swt.jar, which uses internally
libswt.
Compile statement should look like this:
gcj -fjni Test.java swt.jar -o Test --classpath=swt.jar --main=Test
I would recommend reading
http://www-106.ibm.com/developerworks/java/library/j-nativeg ui2/
Don't know if you can compile the swt.jar directly, it has some
dependencys on JVM, gcj is still incomplete vs. JVM.
A starting point is http://libswt.sourceforge.net/
Take care,
Radu
Francois Hensley wrote:
> Hi.
> I have downloaded gnu gcc 3.4.3 and compiled it with the following
> command line parameters :
> configure --prefix=/usr --enable-languages=c,c++,java,f77,objc
> --enable-threads=posix --enable-shared
> make bootstrap
> make install
> Now this compiles everything fine under MacOS X.3 using the gcc compiler
> that comes with the Developer Tools ie. gcc 3.3
> When I compile a Hello World program using gcj, like so :
> gcj Test.java -o Test --classpath
> /usr/share/java/libgcjxxx.jar:$CLASSPATH --main=Test -lgcj
> Then it compiles fine and the output from the program is as expected.
> But. When I try to link against the libswt-carbon-xxxx.jnilib all hell
> breaks loose. I have tried to make a symlink from *.jnilib to *.dylib
> and even to .a. When I do a file on the jnilib it says it's a bundle.
> I have tried to copy the jnilib files into
> /System/Library/Frameworks/JavaVM.framework/Libraries and linking the
> program as follows.
> gcj Test.java -o Test --classpath
> /usr/share/java/libgcjxxx.jar:$CLASSPATH --main=Test -lgcj -framework
> JavaVM
> which fails.
> When I do an ld style
> ld Test.o -o Test -lgcj -framework JavaVM then it gives me an error that
> no __main is found hence the --main=Test option.
> when doing a gcj Test.o -o Test -lgcj libswt-carbon-xxxx.jnilib it fails
> as well telling me that i can't call a static link editor using a
> dynamic link editor or something like this. And this is where I'm
> struggling with.
> I mean if I link against any other jnilib in the JavaVM framework it
> compiles correctly. Maybe the jnilibs shouldn't be bundles ???
>
> My long winded questions is :
> 1) Is my gcc configuration flags correct ? 2) How do you compile a
> program natively using the swt-carbon-xxxx.jnilib's ? If you have a
> MacOS specific example could you please supply me with it.
> I have been struggling with it for over a week now and I'm lost....
>
> PLEASE....... Help me.
>
> Francois Hensley
|
|
|
Re: Compiling of GCJ and SWT under MacOS X [message #450273 is a reply to message #450272] |
Wed, 09 February 2005 09:26 |
Eclipse User |
|
|
|
Originally posted by: cyberdeth.spymac.com
Hi.
Thanks for the reply. I'll try this tonight. But surely it has to link
against some or other library to create the executable to resolve any
symbols, right ? So would this approach work on linux as well ? then I can
test it at work while i'm in front of my linux box....
Thanks a million.
Francois Hensley
Radu Racariu wrote:
> Hi Francois,
> you have to link against swt.jar, which uses internally
> libswt.
> Compile statement should look like this:
> gcj -fjni Test.java swt.jar -o Test --classpath=swt.jar --main=Test
> I would recommend reading
> http://www-106.ibm.com/developerworks/java/library/j-nativeg ui2/
> Don't know if you can compile the swt.jar directly, it has some
> dependencys on JVM, gcj is still incomplete vs. JVM.
> A starting point is http://libswt.sourceforge.net/
> Take care,
> Radu
> Francois Hensley wrote:
>> Hi.
>> I have downloaded gnu gcc 3.4.3 and compiled it with the following
>> command line parameters :
>> configure --prefix=/usr --enable-languages=c,c++,java,f77,objc
>> --enable-threads=posix --enable-shared
>> make bootstrap
>> make install
>> Now this compiles everything fine under MacOS X.3 using the gcc compiler
>> that comes with the Developer Tools ie. gcc 3.3
>> When I compile a Hello World program using gcj, like so :
>> gcj Test.java -o Test --classpath
>> /usr/share/java/libgcjxxx.jar:$CLASSPATH --main=Test -lgcj
>> Then it compiles fine and the output from the program is as expected.
>> But. When I try to link against the libswt-carbon-xxxx.jnilib all hell
>> breaks loose. I have tried to make a symlink from *.jnilib to *.dylib
>> and even to .a. When I do a file on the jnilib it says it's a bundle.
>> I have tried to copy the jnilib files into
>> /System/Library/Frameworks/JavaVM.framework/Libraries and linking the
>> program as follows.
>> gcj Test.java -o Test --classpath
>> /usr/share/java/libgcjxxx.jar:$CLASSPATH --main=Test -lgcj -framework
>> JavaVM
>> which fails.
>> When I do an ld style
>> ld Test.o -o Test -lgcj -framework JavaVM then it gives me an error that
>> no __main is found hence the --main=Test option.
>> when doing a gcj Test.o -o Test -lgcj libswt-carbon-xxxx.jnilib it fails
>> as well telling me that i can't call a static link editor using a
>> dynamic link editor or something like this. And this is where I'm
>> struggling with.
>> I mean if I link against any other jnilib in the JavaVM framework it
>> compiles correctly. Maybe the jnilibs shouldn't be bundles ???
>>
>> My long winded questions is :
>> 1) Is my gcc configuration flags correct ? 2) How do you compile a
>> program natively using the swt-carbon-xxxx.jnilib's ? If you have a
>> MacOS specific example could you please supply me with it.
>> I have been struggling with it for over a week now and I'm lost....
>>
>> PLEASE....... Help me.
>>
>> Francois Hensley
|
|
|
Re: Compiling of GCJ and SWT under MacOS X [message #450274 is a reply to message #450273] |
Wed, 09 February 2005 10:51 |
Radu Messages: 44 Registered: July 2009 |
Member |
|
|
works on windows also.
I've just gave you the outline mostly on static compiling.
Your app will link only with the swt.jar, as swt.jar has internal deps
via jni to the shared object (libswt).
for linux just try http://libswt.sourceforge.net/, toght a 2.1 version
is a simple configure/make lib; so you'll be up'n'running quickly.
just remember that compiling directly from swt.jar might not work, at
least on windows gcj 3.4 it doesn't.
cheers
Francois Hensley wrote:
> Hi.
>
> Thanks for the reply. I'll try this tonight. But surely it has to link
> against some or other library to create the executable to resolve any
> symbols, right ? So would this approach work on linux as well ? then I
> can test it at work while i'm in front of my linux box....
>
>
> Thanks a million.
>
> Francois Hensley
>
> Radu Racariu wrote:
>
>> Hi Francois,
>> you have to link against swt.jar, which uses internally
>> libswt.
>> Compile statement should look like this:
>> gcj -fjni Test.java swt.jar -o Test --classpath=swt.jar --main=Test
>
>
>> I would recommend reading
>> http://www-106.ibm.com/developerworks/java/library/j-nativeg ui2/
>
>
>> Don't know if you can compile the swt.jar directly, it has some
>> dependencys on JVM, gcj is still incomplete vs. JVM.
>
>
>> A starting point is http://libswt.sourceforge.net/
>
>
>> Take care,
>> Radu
>
>
>
>> Francois Hensley wrote:
>>
>>> Hi.
>>> I have downloaded gnu gcc 3.4.3 and compiled it with the following
>>> command line parameters :
>>> configure --prefix=/usr --enable-languages=c,c++,java,f77,objc
>>> --enable-threads=posix --enable-shared
>>> make bootstrap
>>> make install
>>> Now this compiles everything fine under MacOS X.3 using the gcc
>>> compiler that comes with the Developer Tools ie. gcc 3.3
>>> When I compile a Hello World program using gcj, like so :
>>> gcj Test.java -o Test --classpath
>>> /usr/share/java/libgcjxxx.jar:$CLASSPATH --main=Test -lgcj
>>> Then it compiles fine and the output from the program is as expected.
>>> But. When I try to link against the libswt-carbon-xxxx.jnilib all
>>> hell breaks loose. I have tried to make a symlink from *.jnilib to
>>> *.dylib and even to .a. When I do a file on the jnilib it says it's a
>>> bundle.
>>> I have tried to copy the jnilib files into
>>> /System/Library/Frameworks/JavaVM.framework/Libraries and linking the
>>> program as follows.
>>> gcj Test.java -o Test --classpath
>>> /usr/share/java/libgcjxxx.jar:$CLASSPATH --main=Test -lgcj -framework
>>> JavaVM
>>> which fails.
>>> When I do an ld style
>>> ld Test.o -o Test -lgcj -framework JavaVM then it gives me an error
>>> that no __main is found hence the --main=Test option.
>>> when doing a gcj Test.o -o Test -lgcj libswt-carbon-xxxx.jnilib it
>>> fails as well telling me that i can't call a static link editor using
>>> a dynamic link editor or something like this. And this is where I'm
>>> struggling with.
>>> I mean if I link against any other jnilib in the JavaVM framework it
>>> compiles correctly. Maybe the jnilibs shouldn't be bundles ???
>>>
>>> My long winded questions is :
>>> 1) Is my gcc configuration flags correct ? 2) How do you compile a
>>> program natively using the swt-carbon-xxxx.jnilib's ? If you have a
>>> MacOS specific example could you please supply me with it.
>>> I have been struggling with it for over a week now and I'm lost....
>>>
>>> PLEASE....... Help me.
>>>
>>> Francois Hensley
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.01798 seconds