Gentoo Archives: gentoo-java

From: Andrew Cowie <andrew@×××××××××××××××××××.com>
To: Karl Trygve Kalleberg <karltk@g.o>
Cc: gentoo-java <gentoo-java@l.g.o>
Subject: [gentoo-java] Re: Gentoo GCJ package
Date: Thu, 07 Jul 2005 12:06:49
Message-Id: 1120737977.7696.18.camel@sirius.syd.operationaldynamics.com
1 On Sun, 2005-03-07 at 21:08 +0200, Karl Trygve Kalleberg wrote:
2 > I was wondering if I you had any thoughts about how best to approach
3 > creating a separate dev-java/gcj package?
4
5 Don't know if you saw my blog posting around the time of GUADEC, but I
6 mentioned that I was working (obliquely) towards this.
7 http://research.operationaldynamics.com/blogs/andrew/software/java-gnome/gcj-4.0.0-linking-problem.html
8
9
10 > We've discussed this before: We want to be able to natively compile Java
11 > applications, but not be tied to the release cycle for gcc. Also, since
12 > we can't do USE-based deps, it's very difficult to depend on gcc in a
13 > way which results in it having gcj in the first place.
14
15 So I *have* looked into this. High time I reported.
16
17 1) Modules required:
18
19 You need core, g++, and java. Trying to build with gcc-core and gcc-java
20 only will result in an obscure error 21 minutes into your compile. I
21 recalled that GCC Java support is a subset of compiling C++, and so
22 tried grabbing that, and ta-da.
23
24
25 2) build location
26
27 Building GCC is a bit unusual (you MUST build from a tmpdir location,
28 not from the tree which you unpacked). So, whereas I unpacked my three
29 modules in ~/src/open/gcc-4.0-20050526, I changed director
30 to /tmp/gcj-build before issuing:
31
32 $ ~/src/open/gcc-4.0-20050526/configure --prefix=/opt/gcj-4
33 --with-language=java --enable-java-awt=gtk --enable-threads=posix
34 $ make
35 $ make install
36
37 I'm pretty sure those args are mandatory (ie, you'd better pick a thread
38 model)
39
40
41 3) x86 specificness
42
43 So obviously the above is Linux specific, and I did it on an x86 box.
44 Yes, I realize that there are gcc and toolchain eclasses. I looked at
45 them, and was totally mystified by them. So I said, "forget it" and just
46 did the above manually. Taken together, this would actually be a bloody
47 simple ebuild to write.
48
49
50 4) the BIG problem.
51
52 So far so good. Until you run into 2 big problems. The first is the fact
53 that your new GCJ has a new version of classpath, libgcj.so.6, which is
54 incompatible with libgcj.so.5 of gcj-3.4. So, anything you've built
55 previously with gcj-3.4 will need to be rebuilt. Ok, no huge deal.
56
57 But there's a bigger issue. In Gentoo, the principal way that everything
58 works so nicely together is that java-config sticks
59 the /opt/whatever-jdk-1.4.2/bin directory onto PATH. Great! Except that
60 the above install also copied a little file named gcc to /opt/gcj-4/bin.
61 How about that, huh! Guess what that would do to your system if on PATH?
62
63 I did some preliminary experiments and it seems that you don't actually
64 need that gcc executable there. (or rather, gcc is pretty good about
65 understanding where it was installed and where to look for its own
66 pieces). But that would definitely need some cleansing.
67
68
69 > I've not seen what the redhat guys do with this yet, as time has not
70 > permitted me:/
71
72 They've done something I don't thing we should - they've created a
73 package called java-gcj-compat which provides wrappers called java and
74 javac around gij and gcj. Cute, but I don't think it's a good idea - if
75 you're using GCJ, you *really* need to be aware of the fact you're
76 playing with fire. GCJ-4 is excellent, and working well, but it's not a
77 drop in replacement - see the configure and makefile for xseq.
78
79 ++
80
81 Like I said, given all this, it shouldn't be a hard ebuild to write. I'm
82 tempted.
83
84 AfC
85 Sydney
86
87 --
88 Andrew Frederick Cowie
89
90 Technology strategy, managing change, establishing procedures,
91 and executing successful upgrades to mission critical business
92 infrastructure.
93
94 http://www.operationaldynamics.com/
95
96 Sydney New York Toronto London
97
98 --
99 gentoo-java@g.o mailing list

Replies

Subject Author
Re: [gentoo-java] Re: Gentoo GCJ package Karl Trygve Kalleberg <karltk@g.o>