-
Notifications
You must be signed in to change notification settings - Fork 80
Build tips
Some typical issues encountered when building PL/Java can be listed here, along with tips for resolving them.
Please do carefully read the build instructions, especially the "software prerequisites" section, and the "special topics" section for any that apply to the platform where you are building.
Also be sure to review the "troubleshooting the build" section at the end of the build instructions page.
If you review the mailing list archive and the issues list, you may find a report of a situation like your own. (On the issues list, it is possible someone reported an issue, a solution was found, and the issue was closed, so look at recent closed issues too.)
By itself, Fatal error compiling
isn't very helpful. Use Maven's -e
option to get full exception stack traces.
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal ...:compile (default-compile) on project pljava-api: Fatal error compiling
...
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
...
Caused by: org.codehaus.plexus.compiler.CompilerException: invalid flag: --release
...
Caused by: java.lang.IllegalArgumentException: invalid flag: --release
at com.sun.tools.javac.api.JavacTool.processOptions
...
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess
If you see a stack trace like this building the PL/Java 1.6 series or later, you simply have Maven running on a Java version that is too old. PL/Java 1.6.x requires Java 9 or later.
It can be possible to have the environment set up so that simple command
javac --version
at the shell will find the javac
that you want on the PATH
and report
that version, but the mvn
command finds a different installed Java version
and uses it to run Maven. Because Maven does Java compilation in-process,
the PL/Java code ends up being compiled by whatever Java version is running
Maven itself. If that version is not at least Java 9, this error results.
The command
mvn --version
is useful because it does not show only the version of Maven, but also the version of Java that Maven has found to run with.
The JAVA_HOME
variable can be set in the environment to ensure Maven
runs on the needed version of Java.
The most common cause of reported failures building pljava-so
is a
missing required file. Sometimes your distribution's packaging system will
have chosen to organize a prerequisite piece of software into more than
one package, for example, one that contains only library files, and another
with a name ending in -dev
or -devel
that contains the necessary .h
files. Some distributions take this further than others; see the "special
topics" section for Ubuntu for an example where even libraries built as
part of PostgreSQL itself are split up into multiple separate packages.
The solution is simple: look over the error messages from the pljava-so
section of the build output to find any that refer to a file that could not
be found. Usually it will be a .h
file or a library (.so
, .dll
, .dylib
,
etc.).
Find out the name of the package, according to the OS or package distribution you are using, that contains the missing file, install that package, and you have probably solved the whole problem.
Further tip: Finding the error message that really mattered is easier
if you follow the "troubleshooting the build" tip about the -Pwnosign
option, to cut down the number of other messages that do not matter, if
that option works on your platform.
Please describe the issue you are facing on the mailing list.