tags:

views:

163

answers:

6

EDIT

The original reasoning for this question was a pretty serious case of bad timing, and has therefore hidden away in the editing history. In short, fop 1.0 is imminent, so the motivation is largely gone. Besides, the real motivation was mostly frustration anyway.

Nevertheless, there is a reasonable question here - how practical is the GCC native Java compiler GCJ for building real-world open-source Java projects such as FOP? How hard is it likely to be, and what kinds of problems are likely to occur?

For example, I now understand that gcj implements the JDK 1.2 language and is "largely compatible" with the JDK 1.2 libraries - a long way behind Java 6/1.6. Also, libgcj is missing a lot of libraries, particularly GUI related. AWT is missing which, in the case of FOP, means the GUI viewer is a problem. Though to be honest, what's wrong with generating a .ps or .pdf or whatever and viewing that?

+1  A: 

The Fedora Project has used it to compile quite a few libraries and apps for a while now. You may want to look towards their efforts/successes.

Ignacio Vazquez-Abrams
Seems like a good tip. I'm still struggling to Google a good starting point, but still worth +1.
Steve314
https://admin.fedoraproject.org/mailman/listinfo/java-devel
Ignacio Vazquez-Abrams
@Ignacio - you got me - I'm allergic to mailing lists. The archive - yes, but I still need to find the relevant threads. I'm starting to get somewhere, though - just not sure where. e.g. on the one hand, the worst problems seem to happen with GUI apps, which FOP isn't. Except that it does rely on some GUI-related libraries, e.g. for SVG rendering. Internet access may be an issue - on the one hand part of the mission is to bypass that anyway, but on the other hand cutting it out completely is unlikely to a either simple or reasonable.
Steve314
+3  A: 

I'm very much in the camp that still doesn't understand how Java 1.5 and Java 1.6 can be more recent than Java 2 (or are they variants of Java 2?).

Blame Sun for this inconsistency.

There are two version numbering systems. The original JVM versioning system goes 1.0, 1.1, 1.2.x, 1.3.x, 1.4.x, 1.5, 1.6. The "marketing driven" number system (which Sun uses in their published material) goes Java 2, Java 2 1.3.x, Java 2 1.4.x, Java 5.0, Java 6. So the numbers "1.2" and "Java 2" mean the same thing, "1.3.x" and "Java 2 1.3.x" mean the same thing, and so on.

It happened because the Sun business folks decided that they had to have a Java 2.0, because Java 1.2 looked (to IT journalists, etc) like just a minor release. Of course, this contradicted the established meaning of the major release number which was that it would only change for a release of Java that majorly broke backwards compatibility.

The end result is a confusing dual version numbering, that only sense if you realize that there are two version numbers for the later Java releases. (And the SE/EE/ME qualification ... in its various manifestations ... just adds to the confusion.) Just learn to live with it.

(But hey, if you think this is crazy, look at Microsoft's numbering of Windows releases!)

Stephen C
The marketing numbers are even more confusing: 1.0, 1.1, Java 2, Java 2 1.3.x, Java 2 1.4.x, Java 5.0, Java 6
nhnb
I'll take your word for it. I guess it depends which version of the marketing blurb you read. The point is that there is a mapping between the two sets of numbers ... and once you realize that, it is not really confusing at all.
Stephen C
@Stephen - assuming you follow Java enough to know what the mapping is.
Steve314
@Steve314 - no. You simply need to know that there *is* a mapping. You can then look it up in (for example) Wikipedia.
Stephen C
@Stephen - that assumes that you care enough to spend those few minutes reading up on (and memorizing for ready for the next news story or whatever) an issue which (if you don't follow Java much) you really aren't likely to care that much about. Just because I added the extra bit of ranting to the middle of my ranting, yada yada. Besides, by that logic, even if I couldn't guess that there's some kind of logic to the numbers, I only need to check...
Steve314
@Steve314 - I don't see the point of your response. The information is out there. You can check it out for yourself, or you can ignore it. It's your choice.
Stephen C
+1  A: 

The issues you might find are mostly related to non-implemented APIs in GCJ, or buggy library implementations. There are also some language features that are not well supported such as reflection.
Why don't you just use Java ?

Romain Hippeau
I may do, or I may not need to. If I had decided for certain, there wouldn't be much point asking the question.
Steve314
@Steve314 I just put that there to let you know how I feel about the best cause of action. Of course it is just an opinion. It seems like it might be risky, and you might have some issues that will be very hard to track down and sink a lot of effort.
Romain Hippeau
@Romain - true, and I already have several projects on the go ATM, each competing to distract me from the others.
Steve314
+1  A: 

In a situation where you are trying to use some project that hasn't released for a long time, it is worth looking at the project mailing lists.

Here's an archive for the "fop-dev" mailing list. First, note that the mailing list is active. Lots of postings. Second, if you look at the mails for July 2010, you will see that they have voted to accept the FOP 1.0 release branch. I'm not exactly sure what this means, but I suspect it means that 1.0 is going to be released really soon.

On your general question as to whether to use the GCC native compiler, there is no particular reason not to. But there is also no particular need to do so, and no particular reason to suspect that it would help. I personally prefer to use Sun's JVMs. And it sounds like you might be making life difficult for yourself by trying to get rid of runtime dependencies on a Sun installation.

EDIT

I'm not convinced that the "dependency hell" is that bad. On the one hand, you (as the primary developer) should be able to figure out certain combinations of versions of the components that work. Then you say "these are the versions that we recommend / support". If people want to use different combinations that is their responsibility.

On the other hand, if you use Maven as your build framework, then the dependencies are explicitly declared in the project POM files. If you make sure you publish to a public repository, and that your published artifacts only depend on properly released / published 3rd-party artifacts, then your customers should not have any difficulty either building your software directly, or downloading via the Maven repositories. And if they want to tinker with the dependencies, they can do that.

EDIT 2

Using GCJ as a way to prevent users from screwing up the dependencies is (IMO) a bad idea. By using GCJ to hard-wiring the dependencies into the binary distribution you limit the user's ability to "tinker". And with FOP-based applications, the ability to tinker seems to be rather important.

(And the fact that GCJ apparently causes FOP to break is yet another pragmatic reason to just use a regular Sun Java.)

Stephen C
Good news about 1.0. But it isn't just about avoiding Suns JVMs. When I have my user hat on, I don't want dependency hell just to do some obvious standard job. When you want to process a DocBook document, you can't just download a process-a-DocBook-document tool. It's all this-is-your-choice-of-schema-validators and this-is-your-choice-of-XSLT-processors and this-is-your-choice-of-XSL-FO-processors and now-you-need-the-DTDs-and-stylesheets ... It's like needing a car, and having to mix-and-match hopefully compatible parts and assemble them yourself.
Steve314
I should be clear that fop is at least *less* like this, since it can do the XSLT and XSL-FO processing in one step and includes some other related tools. My experience shows end users can still run into serious problems though.
Steve314
WRT limiting the tinkering, (1) there are a lot of people who just want their tools to work, (2) nothing prevents anyone downloading the real fop etc to play with, and (3) creating e.g. Linux distros never prevented anyone tinkering - it just gave people an easy starting point for the tinkering. Packaging things up to just automatically work doesn't necessarily imply locking everything in place. Anyway, unfairly, you're not getting the acceptance - your "fop 1.0 is nearly here" answer was the most useful, but not in a programming sense. Sorry.
Steve314
Finally - what's Maven? What are POM files? Not serious questions - I can Google as well as anyone. The point is I've been trying to get DocBook working on-and-off for months and never heard of these things. In those circumstances, hardly surprising they aren't magicing away my problems. And it kind of sounds like your telling me that if only I'd known about this yet-another-separate-thing and the infrastructure that goes with it... ie its another bit of dependency hell.
Steve314
@Steve314 - It is entirely up to you how you try to solve this problem. I've given you my advice, but I'm not going to argue with you.
Stephen C
What's the argument? FOP is nearly here and it doesn't make any sense for me to go on a packaging mission at all. The question, nonetheless, was valid when asked. BTW - on Maven - I should have realised on reading your post, but my point on "dependency hell" was about *using* DocBook, not about developing or packaging. With a programmer hat on, dependencies are just part of the job - better to be resolving that than writing the components yourself. With a user hat on, a single job should be handled by a single tool that just works. Package management is fine, confusion is not.
Steve314
As I said above, it is entirely up to you how you solve this problem. I've given my advice: take it or leave it.
Stephen C
A: 

See this bug report. It's 4 years old, but it's tagged as fop 1.0dev, so I guess it's still relevant. Looks like you won't be able to compile it with gcj without black magic.

tulskiy
A: 

As this appears to be a "I need a prepackaged version of FOP and I essentially never want to hear a bug report" as opposed to "We need FOP as part of another product which will have developer attention for quite long and it is essential that this works properly", I will strongly advise you to go the mainstream way and create a traditional bytecode based package which requires the Sun JVM to run.

You will most likely find the "executable jar" concept interesting as it allows you to boil down the startup script to "java -jar .../myfop.jar". The Eclipse "Export" function names this as a "runnable jar".


EDIT: After reading the various comments, I understand that what you actually want is a DocBook authoring environment. I believe the shortest amount of developer time spent to get there, would be writing the glue needed for the XML tools in Eclipse to talk to FOP, i.e. an Eclipse plugin.

Thorbjørn Ravn Andersen