Re: [Java-gnome-developer] Making native binaries
Brought to you by:
afcowie
From: Andrew C. <an...@op...> - 2004-10-25 21:48:53
|
On Mon, 2004-10-25 at 18:32 +0200, Thomas Perl wrote: > As I don't want to require ALL users who just want to run the program > but are not motivated to download and install java-gnome, I want to > compile my java code into a native linux binary. I think you're sort of confusing objectives here. One objective is to make a native linux binary out of Java code. That's what GCJ is good for, assuming your code works with the limited subset of Java that the GNU team have managed to write. The other objective is to not have library dependencies. That's a bit strange, because with the exception of rescue systems and tiny embedded systems, virtually everything on a linux system is built with dependencies on shared libraries. What you actually said was "not to have to download and install java-gnome as a specific dependency" which is a bit different.=20 Anyone using a "modern" Linux distribution will find it has a packaging system that is able to automatically fetch (and build, if necessary) all the dependencies necessary. Since you raised the question, I assume you are using a Linux distro without these capabilities, which makes your request understandable, though I would suggest misguided. However, even assuming you statically compiled libgtk-java into your executable, you still have a very tight dependency on the underlying versions of the various GTK libraries (gtk, gdk, glib, etc). For example, if you built a statically linked java-gnome based application on your system, chances are that it won't run on my system because I probably (inevitably) have a different version of GTK than you. [Indeed, that's the whole point of a dependency based packaging system - that it takes care of expressing and resolving such things for you *especially keeping track of dependencies between libraries*, which is why I observed that this was likely a misguided effort as you're well on your way to circumventing (and thus duplicating) all the work that the distribution people do packaging libraries in the first place] > (statically > linked executable?, putting libs into the package? which libs?) I'm certain it would work well for you if you statically linked in the entire GTK library stack right down to libxml2, but that's on the order of 60 packages. Would be a rather big binary. Otherwise, there's bound to be a disconnect somewhere.=20 Oh, and you'll probably need to recompile all the libraries you're statically linking in - I recall some sort of trouble if you try to statically link libraries which were built for dynamic/shared use. [If I'm wrong, I welcome someone else to correct me] ALL THIS SAID, the eclipse team obviously manage to ship binaries which are linked against, among other things, a generic gtk API, so its obviously do-able. I would suggest you look there for details. AfC Toronto --=20 Andrew Frederick Cowie OPERATIONAL DYNAMICS Operations Consultants and Infrastructure Engineers http://www.operationaldynamics.com/ |