Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 270712 - dev-java/lucene-2.4.0 cannot be built with non-Sun-javac
Summary: dev-java/lucene-2.4.0 cannot be built with non-Sun-javac
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-21 12:47 UTC by Nico R.
Modified: 2009-09-09 23:56 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
portage log file (dev-java:lucene-2.4.0:20090608-212722.log,4.10 KB, text/plain)
2009-06-08 21:42 UTC, Nico R.
Details
use sed to take out -Xmax compiler options in common-build.xml so ecj can be used (lucene-ebuild-ecj.patch,487 bytes, patch)
2009-06-15 07:55 UTC, cmuelle8
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nico R. 2009-05-21 12:47:33 UTC
It is not possible to emerge dev-java/lucene-2.4.0 if the system uses a Java compiler which is not javac from Sun.


Snippet from the log file:

common.compile-core:
    [mkdir] Created dir: /var/tmp/portage/dev-java/lucene-2.4.0/work/lucene-2.4.0/build/classes/java
    [javac] Compiling 330 source files to /var/tmp/portage/dev-java/lucene-2.4.0/work/lucene-2.4.0/build/classes/java
    [javac] Unrecognized option : 10000000

BUILD FAILED
/var/tmp/portage/dev-java/lucene-2.4.0/work/lucene-2.4.0/common-build.xml:183: The following error occurred while executing this line:
/var/tmp/portage/dev-java/lucene-2.4.0/work/lucene-2.4.0/common-build.xml:409: Compile failed; see the compiler error output for details.




On my system, this happened as preferences are set to use ecj for compilation:
$ cat /etc/java-config-2/build/compilers.conf
COMPILERS="ecj-3.4 jikes javac"


Cause:
In common-build.xml:
        <compilerarg line="-Xmaxwarns 10000000" ></compilerarg>
        <compilerarg line="-Xmaxerrs 10000000" ></compilerarg>

ecj-3.4 does not know that some of the -X options take parameters (in fact, no compiler can know that, but only apply a heuristic or the Sun javac should be fixed to use ‘-Xfoo=bar’ instead of ‘-Xfoo bar’.)


Suggested fix:
Remove the parameters from common-build.xml if a Java compiler which is not Sun javac is used.
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-05-22 01:12:02 UTC
lucene-2.4 builds perfectly with the IBM JDK, v1.4 thru 1.6 tested.

Can you please show me your -X output for ecj and jikes?
Comment 2 Serkan Kaba (RETIRED) gentoo-dev 2009-05-22 05:15:07 UTC
Reproduced with ecj-3.4 as compiler.
Comment 3 Petteri Räty (RETIRED) gentoo-dev 2009-05-22 18:36:50 UTC
(In reply to comment #1)
> lucene-2.4 builds perfectly with the IBM JDK, v1.4 thru 1.6 tested.
> 
> Can you please show me your -X output for ecj and jikes?
> 

IBM code base is probably just the Sun code base ported to work with PPC.
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-05-22 23:02:22 UTC
I'd still like the -X output for ecj...
Comment 5 Nico R. 2009-06-08 21:40:23 UTC
$ echo 'class Test {}' > Test.java


ecj:

$ ecj -version
Eclipse Java Compiler 0.883_R34x, 3.4.1 release, Copyright IBM Corp 2000, 2008. All rights reserved.
$ ecj -Xmaxwarns 10000000 -Xmaxerrs 10000000 Test.java
Unrecognized option : 10000000
$ echo $?
255


jikes:

$ jikes -version
Jikes Compiler - Version 1.22 - 3 October 2004
Copyright (C) IBM Corporation 1997-2003, 2004.
- Licensed Materials - Program Property of IBM - All Rights Reserved.
Originally written by Philippe Charles and David Shields of IBM Research,
Jikes is now maintained and refined by the Jikes Project at:
<http://ibm.com/developerworks/opensource/jikes>
Please consult this URL for more information and for reporting problems.
$ jikes -Xmaxwarns 10000000 -Xmaxerrs 10000000 Test.java
Error: The option "-Xmaxwarns" is unsupported in this build.
Error: The option "-Xmaxerrs" is unsupported in this build.
use: jikes [options] [@files] file.java...
For more help, try -help or -version.
$ echo $?
2


Sun javac:

$ javac -version
javac 1.6.0_14
$ javac -fullversion
javac full version "1.6.0_14-b08"
$ javac -Xmaxwarns 10000000 -Xmaxerrs 10000000 Test.java
$ echo $?
0
Comment 6 Nico R. 2009-06-08 21:42:38 UTC
Created attachment 193941 [details]
portage log file
Comment 7 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-06-08 22:32:50 UTC
n-roeser:
That's still not it.

just run:
$ ecj -X
$ jikes -X
$ javac -X
Comment 8 Nico R. 2009-06-09 06:43:49 UTC
$ ecj -X
Eclipse Java Compiler 0.883_R34x, 3.4.1 release
Copyright IBM Corp 2000, 2008. All rights reserved.

 Usage: <options> <source files | directories>
 If directories are specified, then their source contents are compiled.
 Possible options are listed below. Options enabled by default are prefixed
 with '+'.

 Classpath options:
    -cp -classpath <directories and ZIP archives separated by :>
                       specify location for application classes and sources.
                       Each directory or file can specify access rules for
                       types between '[' and ']' (e.g. [-X] to forbid
                       access to type X, [~X] to discourage access to type X,
                       [+p/X:-p/*] to forbid access to all types in package p
                       but allow access to p/X)
    -bootclasspath <directories and ZIP archives separated by :>
                       specify location for system classes. Each directory or
                       file can specify access rules for types between '['
                       and ']'
    -sourcepath <directories and ZIP archives separated by :>
                       specify location for application sources. Each directory
                       or file can specify access rules for types between '['
                       and ']'. Each directory can further specify a specific
                       destination directory using a '-d' option between '['
                       and ']'; this overrides the general '-d' option.
                       .class files created from source files contained in a
                       jar file are put in the user.dir folder in case no
                       general '-d' option is specified. ZIP archives cannot
                       override the general '-d' option
    -extdirs <directories separated by :>
                       specify location for extension ZIP archives
    -endorseddirs <directories separated by :>
                       specify location for endorsed ZIP archives
    -d <dir>           destination directory (if omitted, no directory is
                       created); this option can be overridden per source
                       directory
    -d none            generate no .class files
    -encoding <enc>    specify custom encoding for all sources. Each
                       file/directory can override it when suffixed with
                       '['<enc>']' (e.g. X.java[utf8])

 Compliance options:
    -1.3               use 1.3 compliance (-source 1.3 -target 1.1)
    -1.4             + use 1.4 compliance (-source 1.3 -target 1.2)
    -1.5 -5 -5.0       use 1.5 compliance (-source 1.5 -target 1.5)
    -1.6 -6 -6.0       use 1.6 compliance (-source 1.6 -target 1.6)
    -1.7 -7 -7.0       use 1.7 compliance (-source 1.7 -target 1.7)
    -source <version>  set source level: 1.3 to 1.7 (or 5, 5.0, etc)
    -target <version>  set classfile target: 1.1 to 1.7 (or 5, 5.0, etc)
                       cldc1.1 can also be used to generate the StackMap
                       attribute

 Warning options:
    -deprecation     + deprecation outside deprecated code (equivalent to
                       -warn:+deprecation)
    -nowarn -warn:none disable all warnings
    -?:warn -help:warn display advanced warning options

 Debug options:  
    -g[:lines,vars,source] custom debug info
    -g:lines,source  + both lines table and source debug info
    -g                 all debug info
    -g:none            no debug info
    -preserveAllLocals preserve unused local vars for debug purpose

 Annotation processing options:
   These options are meaningful only in a 1.6 environment.
    -Akey[=value]        options that are passed to annotation processors
    -processorpath <directories and ZIP archives separated by :>
                         specify locations where to find annotation processors.
                         If this option is not used, the classpath will be
                         searched for processors
    -processor <class1[,class2,...]>
                         qualified names of the annotation processors to run.
                         This bypasses the default annotation discovery process
    -proc:only           run annotation processors, but do not compile
    -proc:none           perform compilation but do not run annotation
                         processors
    -s <dir>             destination directory for generated source files
    -XprintProcessorInfo print information about which annotations and elements
                         a processor is asked to process
    -XprintRounds        print information about annotation processing rounds
    -classNames <className1[,className2,...]>
                         qualified names of binary classes to process

 Advanced options:
    @<file>            read command line arguments from file
    -maxProblems <n>   max number of problems per compilation unit (100 by
                       default)
    -log <file>        log to a file. If the file extension is '.xml', then
                       the log will be a xml file.
    -proceedOnError    do not stop at first error, dumping class files with
                       problem methods
    -verbose           enable verbose output
    -referenceInfo     compute reference info
    -progress          show progress (only in -log mode)
    -time              display speed information
    -noExit            do not call System.exit(n) at end of compilation (n==0
                       if no error)
    -repeat <n>        repeat compilation process <n> times for perf analysis
    -inlineJSR         inline JSR bytecode (implicit if target >= 1.5)
    -enableJavadoc     consider references in javadoc
    -Xemacs            used to enable emacs-style output in the console.
                       It does not affect the xml log output

    -? -help           print this help message
    -v -version        print compiler version
    -showversion       print compiler version and continue

 Ignored options:
    -J<option>         pass option to virtual machine (ignored)
    -X<option>         specify non-standard option (ignored
                       except for listed -X options)
    -X                 print non-standard options and exit (ignored)
    -O                 optimize for execution time (ignored)

$ jikes -X
Error: The option "-X" is unsupported in this build.
use: jikes [options] [@files] file.java...
For more help, try -help or -version.
$ javac -X
  -Xlint                     Enable recommended warnings
  -Xlint:{all,cast,deprecation,divzero,empty,unchecked,fallthrough,path,serial,finally,overrides,-cast,-deprecation,-divzero,-empty,-unchecked,-fallthrough,-path,-serial,-finally,-overrides,none}Enable or disable specific warnings
  -Xbootclasspath/p:<path>   Prepend to the bootstrap class path
  -Xbootclasspath/a:<path>   Append to the bootstrap class path
  -Xbootclasspath:<path>     Override location of bootstrap class files
  -Djava.ext.dirs=<dirs>     Override location of installed extensions
  -Djava.endorsed.dirs=<dirs>Override location of endorsed standards path
  -Xmaxerrs <number>         Set the maximum number of errors to print
  -Xmaxwarns <number>        Set the maximum number of warnings to print
  -Xstdout <filename>        Redirect standard output
  -Xprint                    Print out a textual representation of specified types
  -XprintRounds              Print information about rounds of annotation processing
  -XprintProcessorInfo       Print information about which annotations a processor is asked to process
  -Xprefer:{source,newer}    Specify which file to read when both a source file and class file are found for an implicitly compiled class

These options are non-standard and subject to change without notice.




I hope, I got it right this time. :-)


Here is some additional information for jikes (as it does not print the available ‘-X’ options with ‘jikes -X’, but tells the user to use the ‘-help’ option for more help):

$ jikes -help
Jikes Compiler - Version 1.22 - 3 October 2004
Copyright (C) IBM Corporation 1997-2003, 2004.
- Licensed Materials - Program Property of IBM - All Rights Reserved.
use: jikes [options] [@files] file.java...

        Regular options:
-bootclasspath path location of system classes [default '']
-classpath path     location of user classes and source files [default .]
-d dir              write class files in directory dir [default .]
-debug              no effect (ignored for compatibility)
-depend | -Xdepend  recompile all used classes
-deprecation        report uses of deprecated features
-encoding encoding  use specified encoding to read source files
                      [default is system and locale dependent]
-extdirs path       location of zip/jar files with platform extensions
                      [default '']
-g | -g:none | -g:{lines,vars,source}
                      control level of debug information in class files
                      [default lines,source]
-J...               no effect (ignored for compatibility)
-nowarn             javac-compatible equivalent of +Z0
-nowrite            do not write any class files, useful with -verbose
-O                  optimize bytecode (presently does nothing)
-source release     interpret source by Java SDK release rules
                      [default to max(target, 1.4)]
-sourcepath path    location of user source files [default '']
-target release     output bytecode for Java SDK release rules
                      [default to source if specified, else 1.4.2]
-verbose            list files read and written
-Werror             javac-compatible equivalent of +Z2
-Xstdout            redirect output listings to stdout
-Xswitchcheck       warn about fallthrough between switch statement cases
        Enhanced options:
++                  compile in incremental mode
+a                  omit assert statements from class files
+B                  do not invoke bytecode generator
+D                  report errors immediately in emacs-form without buffering
+DR=filename        generate dependence report in filename
+E                  list errors in emacs-form
+F                  do full dependence check except for Zip and Jar files
+Kname=TypeKeyWord  map name to type keyword
+M                  generate makefile dependencies
+OLDCSO             perform original Jikes classpath order for compatibility
+P                  pedantic compilation - issues lots of warnings
                      some warnings can be turned on or off independently:
+P[no-]modifier-order warn about modifiers appearing out of order
+P[no-]redundant-modifiers
                      warn about modifiers which are implied
+P[no-]serial         warn about serialization warnings
+P[no-]shadow         warn about shadowed and hidden fields
                      (on by default)
+P[no-]switchcheck    warn about fallthrough between switch statement cases
                      (on by default)
+P[no-]naming-convention
                      warn about names which differ from standard convention
+P[no-]effective-java warn about practices warned about in "Effective Java"
+P[no-]unused-type-imports
                      warn about unused single-type import statements
+P[no-]unused-package-imports
                      warn about unused package import statements
+T=n                set value of tab to n spaces, defaults to 8
+U                  do full dependence check including Zip and Jar files
+Z0                 do not issue warning messages
+Z1                 treat cautions as errors
+Z2                 treat both warnings and cautions as errors
+Z                  equivalent to +Z1
        Miscellaneous options:
-help | --help      display this message and exit
-version | --version  display version and contact information, and exit
Comment 9 cmuelle8 2009-06-15 07:55:29 UTC
Created attachment 194739 [details, diff]
use sed to take out -Xmax compiler options in common-build.xml so ecj can be used

tested and works..


cheers
Comment 10 Nico R. 2009-06-17 08:55:15 UTC
Confirmed, it now builds fine with ecj-3.4.
Thanks! :-)

This should go into the main portage tree.
Comment 11 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-09-09 23:56:10 UTC
InCVS.