Skip to content

Conversation

@olpaw
Copy link
Member

@olpaw olpaw commented Jun 22, 2020

fixes #2151

@graalvmbot graalvmbot merged commit 231d9d9 into oracle:master Jun 23, 2020
@jonenst
Copy link

jonenst commented Nov 19, 2020

Hi @pejovica @olpaw
What is this PR supposed to fix ?

I think this pr breaks my build (links to public builds that show the problem at the end).
[INFO] Executing: C:\hostedtoolcache\windows\jdk\11.0.0\x64\bin\native-image.cmd -cp [... many many jars ] --no-fallback --allow-incomplete-classpath -H:Class=com.powsybl.tools.Main -H:Name=olf
The command line is too long.

The only change I see in the log is that native-image.exe is changed to native-image.cmd.

The command line generated by native-image-maven-plugin in my case is about 15k characters (all the jars).

I read that
""A little bit of google later, and I learn that Windows has a 32767 character command line limit. That limit is even less, 8191, if trying to execute the process from within cmd.exe.""

I'm not a windows user so I don't know much about limits, but maybe switching from .exe to .cmd reduced the max command line length ?

Thanks,

builds:
https://github.com/powsybl/powsybl-open-loadflow/runs/1414612072 (KO) (using native-image-maven-plugin 20.3)
https://github.com/powsybl/powsybl-open-loadflow/runs/1414671494 (OK) (using native-image-maven-plugin 20.1)

@olpaw
Copy link
Member Author

olpaw commented Nov 19, 2020

The GraalVM directory layout was changed on Windows to be in line with other platforms (Linux & Darwin). Thus

getMojoJavaHome().resolve("bin").resolve("native-image" + (OS.WINDOWS.isCurrent() ? ".cmd" : ""));

now points to a "link" (in the case of Windows, a batch script because we cannot use symlinks on Windows) that forwards to the real location of the native-image executable. Note that this is the same for other GraalVM applications in $GRAALVM_HOME/bin (ployglot.cmd, js.cmd, gu.cmd, ...).

As you observed this has the unpleasant side effect that now because of going through a batch-file the Windows character command line size hits us even harder. Please open a ticket for this.

As a workaround you could create an uberjar out of all theses jars (e.g. with maven-shade-plugin) that then gets feed into native-image-maven-plugin. In this case the command line should be much shorter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native-image-maven-plugin does not work in Windows

4 participants