0

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

Community
  • 1
  • 1
D-Dᴙum
  • 7,689
  • 8
  • 58
  • 97

1 Answers1

3

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.

Strelok
  • 50,229
  • 9
  • 102
  • 115
  • 2
    +1. I think you're right. Do you see the two spaces between `-classpath` and `antlr.Tool`? I'm betting that there's some variable being expanded in there, and for some reason the variable is empty/undefined. That is, instead of `java -classpath[space]VARIABLE[space]antlr.Tool ...`, it's just `java -classpath[space][space]antlr.Tool ...`, causing the problem you describe. – ruakh Nov 12 '11 at 03:04
  • @ruakh, yep I think you are right, that second space definitely looks suspicious. I think if Kerubu can show us that log line from the working machine it would reveal what's wrong. – Strelok Nov 12 '11 at 03:09
  • Thanks Strelok. I haven't had chance to check the two Buildroots but I've quoted the relevant Makefile lines from the 'ptoblem' machine and it does look to be incorrect as you suggest. Just why it would work on one machine and not the other is a mystery but I will investigate and report further. – D-Dᴙum Nov 12 '11 at 08:50
  • As ruakh said, there is probably an environment variable that is not being expanded properly. See that line from the machine that works and the problem will be revealed. – Strelok Nov 12 '11 at 08:55
  • I am stumped at why would it be different on 2 machines. But can you try and change the make file the line for ANTLR to ANTLR = java org.antlr.Tool and see what happens? – Strelok Nov 12 '11 at 09:02
  • Resolved the issue now. the Makefiles were indeed different as I've stated in the additional info above. I didn't try altering the incorrect line in the Makefile but instead installed the missing antlr package. Thanls for your help – D-Dᴙum Nov 12 '11 at 17:27