Skip to content

Plugin fails to execute nativeBuild task on Windows () #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
miho opened this issue May 10, 2022 · 10 comments
Closed

Plugin fails to execute nativeBuild task on Windows () #232

miho opened this issue May 10, 2022 · 10 comments
Labels
bug Something isn't working gradle-plugin Related to Gradle plugin maven-plugin Related to Maven plugin

Comments

@miho
Copy link

miho commented May 10, 2022

Describe the bug

  • os:
  • plugin id: id 'org.graalvm.buildtools.native' version '0.9.11'
  • graalvm:

The plugin fails to execute the nativeBuild task and fails with

Fatal error: Unsupported OptionOrigin: C:\Users\devuser\AppData\Local\Temp\native-image4967625859144225621args

To Reproduce

Steps to reproduce the behavior:

./gradlew clean assemble nativeBuild 

Expected behavior

The task should complete without errors.

System Info (please complete the following information):

  • OS: windows 10 x86_64
  • GraalVM Version: 22.1.x
  • Java Version: 17
  • Plugin version: native-gradle-plugin:0.9.11

Additional context

@miho miho added the bug Something isn't working label May 10, 2022
@miho
Copy link
Author

miho commented May 10, 2022

Just noticed it might be related to oracle/graal#4502

@lost22git
Copy link

update to version [email protected]_2122 can resolve it

@alvarosanchez
Copy link
Member

Another option is to not use the args file, and use the old mechanism to avoid long classpath issue on Windows, described here: https://graalvm.github.io/native-build-tools/0.9.9/maven-plugin.html#long_classpath_and_shading_support

With 0.9.11+ and GraalVM 22.1.0, this would be something like the following:

<plugin>
    <groupId>org.graalvm.buildtools</groupId>
    <artifactId>native-maven-plugin</artifactId>
    <version>${native.maven.plugin.version}</version>
    <extensions>true</extensions>
    <executions>
        <execution>
            <id>build-native</id>
            <goals>
                <goal>build</goal>
            </goals>
            <phase>package</phase>
        </execution>
    </executions>
    <configuration>
        <skip>false</skip>
        <useArgFile>false</useArgFile>
        <imageName>${imageName}</imageName>
        <buildArgs>
            <buildArg>--no-fallback</buildArg>
        </buildArgs>
        <classpath>
            <param>${project.build.directory}/${project.artifactId}-${project.version}-shaded.jar</param>
        </classpath>
    </configuration>
</plugin>

@chirontt
Copy link

@alvarosanchez thanks a lot for the tip about the "useArgFile" configuration parameter; this parameter works around the problem of Unsupported OptionOrigin in Windows, and it works for both Gradle and Maven native build tools plugins, to boot.

@mstine
Copy link

mstine commented Jul 11, 2022

FWIW, the old shading mechanism doesn't work with Spring, which was one of the motivators for args file support. Any word on when we'll see a proper fix?

@lazar-mitrovic
Copy link
Collaborator

lazar-mitrovic commented Jul 14, 2022

FWIW, the old shading mechanism doesn't work with Spring, which was one of the motivators for args file support. Any word on when we'll see a proper fix?

This issue was fixed in GraalVM (see oracle/graal#4561), so it will land in the upcoming release (22.2).
Only workaround that we could implement until then would be to move argFile location to a relative directory (perhaps build/tmp/native-image4967625859144225621args) but I'm not sure if that is good idea, WDYT @melix?

@mstine
Copy link

mstine commented Jul 14, 2022

FWIW, the old shading mechanism doesn't work with Spring, which was one of the motivators for args file support. Any word on when we'll see a proper fix?

This issue was fixed in GraalVM (see oracle/graal#4561), so it will land in the upcoming release (22.2). Only workaround that we could implement until then would be to move argFile location to a relative directory (perhaps build/tmp/native-image4967625859144225621args) but I'm not sure if that is good idea, WDYT @melix?

Thanks - what's the best way to understand the timeline for GraalVM releases?

@lazar-mitrovic
Copy link
Collaborator

FWIW, the old shading mechanism doesn't work with Spring, which was one of the motivators for args file support. Any word on when we'll see a proper fix?

This issue was fixed in GraalVM (see oracle/graal#4561), so it will land in the upcoming release (22.2). Only workaround that we could implement until then would be to move argFile location to a relative directory (perhaps build/tmp/native-image4967625859144225621args) but I'm not sure if that is good idea, WDYT @melix?

Thanks - what's the best way to understand the timeline for GraalVM releases?

Version roadmap is hosted here: https://www.graalvm.org/release-notes/version-roadmap/
You can try nightly versions from here: https://github.com/graalvm/graalvm-ce-dev-builds/releases

@zingermax
Copy link

zingermax commented Jul 14, 2022

@alvarosanchez thanks a lot for the tip about the "useArgFile" configuration parameter; this parameter works around the problem of Unsupported OptionOrigin in Windows, and it works for both Gradle and Maven native build tools plugins, to boot.

setting useArgFile to false is causing build task to fail with message :
" The command line is too long."

@miho
Copy link
Author

miho commented Jul 26, 2022

With 22.2 being released, the issue has been solved for me. Thanks for looking into it.

@miho miho closed this as completed Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gradle-plugin Related to Gradle plugin maven-plugin Related to Maven plugin
Projects
None yet
Development

No branches or pull requests

7 participants