Thanks to visit codestin.com
Credit goes to github.com

Skip to content

1.6 build failure if pg_config output has multiple spaces between arguments #347

@yazun

Description

@yazun

In the past we had to provide extra CDEFINEs in the nar pom section in other to compile properly pljava, even when defined in pg_config output.

                       <c>
                               <defines combine.children='append'>
                               ...
                                   <define>PGXC</define>
                                   <define>__TBASE__</define>
                                   <define>XCP</define>
                               </defines>
                               ...

Now getting

                link_flags.addAll(pgxs.getPgConfigPropertyAsList(ldflags_sl));
                link_flags.addAll(pgxs.getPgConfigPropertyAsList(ldflags_ex));
                exitCode = pgxs.link(cc, link_flags, object_files, target_path);
                if (exitCode != 0)
                        return plugin.exceptionWrap("Linking failed with exit code: "
                                + exitCode, false);
                return null;
        }
        catch(e)
        {
                return plugin.exceptionWrap(e, true);
        }
}
[INFO] Using compiling/linking rules for Linux
gcc: error: : No such file or directory
gcc: error: : No such file or directory
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] PostgreSQL PL/Java ................................. SUCCESS [  1.167 s]
[INFO] PL/Java API ........................................ SUCCESS [  3.716 s]
[INFO] PL/Java backend Java code .......................... SUCCESS [  3.525 s]
[INFO] PL/Java PGXS ....................................... SUCCESS [  3.118 s]
[INFO] PL/Java backend native code ........................ FAILURE [  1.411 s]
[INFO] PL/Java Ant tasks .................................. SKIPPED
[INFO] PL/Java examples ................................... SKIPPED
[INFO] PL/Java packaging .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.067 s
[INFO] Finished at: 2021-03-29T16:07:47+02:00
[INFO] Final Memory: 36M/256M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.postgresql:pljava-pgxs:1.6-SNAPSHOT:scripted-goal (build-shared-object) on project pljava-so: Compilation failed with exit code: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.postgresql:pljava-pgxs:1.6-SNAPSHOT:scripted-goal (build-shared-object) on project pljava-so: Compilation failed with exit code: 1
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Compilation failed with exit code: 1
        at org.postgresql.pljava.pgxs.ScriptingMojo.exceptionWrap(ScriptingMojo.java:177)
        at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$47$9119$\^eval\_$cu1$restOf.execute(<eval>:297)
        at jdk.nashorn.javaadapters.org_postgresql_pljava_pgxs_GoalScript.execute(Unknown Source)
        at org.postgresql.pljava.pgxs.ScriptingMojo.execute(ScriptingMojo.java:84)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :pljava-so

and it's hard to understand what defines are really taken into account by the compiler now and where the error happens (could be related to nonstandard PG version string)
I skimmed wiki section on the custom compilation code looking for hints but could not see any.

Could you advise on how to get a more descriptive context when this error happens?

(env is centos 7, openjdk11, mvn3.5, gcc 9)

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions