1 |
[1] |
2 |
|
3 |
On Thu, 2005-21-07 at 17:48 +0200, Karl Trygve Kalleberg wrote: |
4 |
|
5 |
> The fact that gcj will keep duplicates of many of the gcc headers, |
6 |
> libraries and programs, is indeed an ugly technical problem. |
7 |
|
8 |
Well, it's only a technical problem if you try and install to /usr |
9 |
alongside another [system] GCC. And even less so, because GCC *is* |
10 |
capable of being parallel installed (c.f. `gcc-config`). So it's not so |
11 |
much a technical problem as it is a "you'd better know what you're |
12 |
doing" problem. |
13 |
|
14 |
> One thing |
15 |
> is that it eats disk space. |
16 |
|
17 |
<shrug> |
18 |
|
19 |
> Another is the libraries now required by gcj-compiled packages. Will |
20 |
> they have rpaths pointing to /opt in them? |
21 |
|
22 |
For semantics, if nothing else, I'd like to be careful to distinguish |
23 |
between: |
24 |
|
25 |
a) using `gcj -C` as a (more or less) javac replacement, and gij |
26 |
+ libgcj[.jar] as a GNU Classpath based java replacement JRE, |
27 |
and |
28 |
|
29 |
b) and using gcj to compile to native executables. |
30 |
|
31 |
In the former case, just using GCJ as a JDK/JRE, there's no reason not |
32 |
to drop it out in /opt and carry on just we do with anything else that |
33 |
`java-config` initializes. |
34 |
|
35 |
I would note that Red Hat are shipping something called java-gcj-compat |
36 |
which basically provides command line compatible wrappers `java` and |
37 |
`javac` around `gij` and `gcj -C` respectively. Recent patches to `gcj` |
38 |
have made it *almost* command line compatible, but the fact that it |
39 |
doesn't compile recursively like javac does is something you need to be |
40 |
aware of. Also see [2]. |
41 |
|
42 |
> If not, how do we know they |
43 |
> work with whatever version of gcc is in /usr? If they do indeed point to |
44 |
> /opt, and somebody uninstalls (or upgrades gcj to an ABI-incompatible |
45 |
> version), all gcj-compiled apps could break, right? |
46 |
|
47 |
In the latter case, well, they will only have rpaths pointing |
48 |
at /opt/gcj-whatever if the [upstream] package using GCJ to build a |
49 |
native library or executable took the effort to know where it's libgcj |
50 |
is, and to embed that path. Doing so may or may not be necessary (see |
51 |
the blog post I mentioned). But definitely, libgcj.so is a |
52 |
versioned .so, so as long as the linker can find the right one, you're |
53 |
fine. Of course, if /opt/gcj-whatever *isn't* on the rpath, (and it |
54 |
certainly isn't on the system (sic) LD_LIBRARY_PATH or ld.so.conf path) |
55 |
then yes, if you upgrade that package then you could well be in linker |
56 |
trouble. |
57 |
|
58 |
Gentoo is tremendously smart by usually just whacking all libraries |
59 |
into /usr/lib, where things will subsequently "just work", as opposed |
60 |
to, say, Debian, putting JNI .sos into /usr/lib/jni and wreaking havoc |
61 |
with things like Eclipse as a result. |
62 |
|
63 |
But as Karl and I have been discussing in this thread, we would have to |
64 |
be very cautious about putting anything from our bleeding edge /opt GCJ |
65 |
install into /usr. |
66 |
|
67 |
++ |
68 |
|
69 |
Incidentally, one solution might just well be to install a "bleeding |
70 |
edge GCJ" to /usr (being careful NOT to install the /usr/bin/{gcc,g |
71 |
++,gcj,etc} front ends) and then do the Fedora inspired compat thing out |
72 |
in /opt/gcj-jdk-4.1.0/bin/{java,javac,jar}, configurable with |
73 |
`java-config`. |
74 |
|
75 |
For compiling to native, binary name `/usr/bin/gcj-4.1.0` would be ok, |
76 |
though I think `/opt/gcj-jdk/bin/gcj` would be better. |
77 |
|
78 |
++ |
79 |
<opinion> |
80 |
|
81 |
For those who have actually bothered to read this far, I will |
82 |
close with an opinion: compiling to native with gcj is *not* |
83 |
trivial. It's not hard, but the commands you run need to be |
84 |
carefully crafted. |
85 |
|
86 |
That does NOT mean you should immediately run screaming to |
87 |
something else to do your crafting for you. As people who know |
88 |
me are familiar, I detest automake and libtool. I've also heard |
89 |
people mumble that ant may someday have tasks to get you to |
90 |
native. I don't think that (yet, anyway) such things are |
91 |
appropriate because they over-complicate and obscure the finesse |
92 |
necessary to "get it right". |
93 |
|
94 |
With the possible exception of certain branches of |
95 |
openoffice-2.0, I am aware of practically zero upstream packages |
96 |
that use it properly (if at all). So whenever you see an IRC or |
97 |
mailing list question that says like "GCJ is cool. I want to |
98 |
immediately compile all my pure Java class only applications to |
99 |
natives because that sounds l33t. It's not working. Why not?" |
100 |
The answer is that GCJ-to-*native* is NOT a drop in replacement |
101 |
for a JDK/JRE. It's *different*. |
102 |
|
103 |
If you want to see some implemented commands to use gcj to |
104 |
builds something to native along side building to traditional |
105 |
bytecode class files, see the Makefile in xseq [2]. |
106 |
|
107 |
Finally, running GCJ is indeed cool, but god the stack traces |
108 |
are hideous. If you're actually developing or debugging, use |
109 |
jikes or ecj to compile and a traditional java VM. There's |
110 |
something to be said for readability in error text... |
111 |
|
112 |
</opinion> |
113 |
|
114 |
AfC |
115 |
Sydney |
116 |
|
117 |
[1]: If this message makes no sense, it's because I'm listening to |
118 |
LugRadio as I'm writing this :) Oh well, having to deal with competition |
119 |
for mindshare is the nature of voluntary contribution to community |
120 |
causes. |
121 |
|
122 |
[2]: http://research.operationaldynamics.com/projects/xseq/ |
123 |
|
124 |
-- |
125 |
Andrew Frederick Cowie |
126 |
|
127 |
Technology strategy, managing change, establishing procedures, |
128 |
and executing successful upgrades to mission critical business |
129 |
infrastructure. |
130 |
|
131 |
http://www.operationaldynamics.com/ |
132 |
|
133 |
Sydney New York Toronto London |
134 |
|
135 |
-- |
136 |
gentoo-java@g.o mailing list |