javabuildrootgnu-classpath

Unrecognized option: -o Could not create the Java virtual machine


I've got an unusual build error when using Buildroot to create an image for my Phidget SBC. It's unusual because it occurs ONLY on my development laptop and NOT on my general use laptop even though I am using EXACTLY the same Builroot environment as published by Phidgets themselves.

When I try to create my Buildroot image I get the following error when it attempts to compile GNU classpath:

Making all in tools
make[2]: Entering directory `/home/xxxx/buildroot_phidgetsbc/buildroot-phidgetsbc_1.0.4.20111028/output/build/classpath-0.98/tools'
/bin/mkdir -p classes asm 
/bin/mkdir -p ../tools/generated/gnu/classpath/tools/gjdoc/expr
java -classpath  antlr.Tool -o ../tools/generated/gnu/classpath/tools/gjdoc/expr/ \
      ./gnu/classpath/tools/gjdoc/expr/java-expression.g

Unrecognized option: -o
Could not create the Java virtual machine.
make[2]: *** [tools.zip] Error 1

The only difference I can possibly thing of is the different Linux (Ubuntu) versions I am using on each laptop. Also I cannot find a -o option documented for Java and don't understand why it works on one laptop but not the other.

Any suggestions would be helpful.

** ADDITIONAL INFO **

I took a look at the Makefile and here are what I think are the relevant lines:

ANTLR = java -classpath antlr.Tool ...

#To generate the example zip just depend on the sources and ignore #the class files. Always regenerate all .class files and remove them #immediately. And copy the template files we use to the classes dir #so they get also included.

$(TOOLS_ZIP): $(ALL_TOOLS_FILES)

@rm -rf classes asm /bin/mkdir -p classes asm /bin/mkdir -p $(gjdoc_gendir)/gnu/classpath/tools/gjdoc/expr
$(ANTLR) -o $(gjdoc_gendir)/gnu/classpath/tools/gjdoc/expr/ \
$(srcdir)/gnu/classpath/tools/gjdoc/expr/java-expression.g

You can see where the 'problem' line occurs in the last one quoted above

** ADDITIONAL INFO 2 & PROBLEM RESOLVED **

I checked the Makefile on my 'regular' machine and it is different to my 'development' laptop. I have 'antlr' installed on my 'regular' machine whereas it wasn't on my development one. I assume that when ./configure was ran it picked this up and altered the antlr command to suit except on my development machine it created an erroneous alternative. For reference, my 'regular' i.e. working makefile is:

ANTLR = runantlr ANTLR_JAR = /usr/share/java/antlr.jar

Installing antlr on my development machine resolved the issue.

Thanks for you help


Solution

  • I think the problem in that line is the -classpath option which is interpreting antlr.Tool as the class path and then trying to parse the -o option.

    The -o option is the org.antlr.Tool command line option it's not a JVM option.

    Proper way to launch antlr tool is:

    java org.antlr.Tool [options]
    

    I am curious what that line of execution looks like on the machine that works. Because the one you showed I your post is definitely incorrect.