jextract build fails on windows

Daniel Jarabek jarabekit at gmail.com
Fri Apr 15 13:42:01 UTC 2022


Hi,

Unfortunately even after the PR [1], the build still fails for me on 
Windows. I did some digging and found what I believe to be the cause. On 
Windows, argv arguments are parsed for quotes before being passed to the 
application (in the case of the JVM this parsing is actually implemented 
in the launcher as far as I can tell, but that shouldn't really be 
relevant here). My previously proposed fix of adding an escaped 
backslash to the argument (so it looks like '\\"') seems to be the best 
option currently. Unfortunately, I was incorrect about this fix not 
affecting other Operating Systems in my last email. While it builds 
successfully, when attempting to run the built image it fails with 
`Unrecognized option: \--enable-native-access=org.openjdk.jextract\`, 
since the extra back slashes were not consumed by the build process. My 
new proposed fix it to conditionally add the extra backslashes on 
Windows, for example by defining an escapedQuote variable based on the 
current Operating System.

-DJ

[1] - https://github.com/openjdk/jextract/pull/18

On 4/11/2022 2:14 AM, Sundararajan Athijegannathan wrote:
> Hi,
> 
> Jorn Vernee reported same issue (and same fix) internally. Not sure why 
> that double quoting is needed on Windows (perhaps shell issues).  I 
> think Jorn Vernee will file a PR.
> 
> Thanks,
> -Sundar
> ------------------------------------------------------------------------
> *From:* jextract-dev <jextract-dev-retn at openjdk.java.net> on behalf of 
> Daniel Jarabek <jarabekit at gmail.com>
> *Sent:* 10 April 2022 04:04
> *To:* jextract-dev at openjdk.java.net <jextract-dev at openjdk.java.net>
> *Subject:* jextract build fails on windows
> Hi,
> 
> After the changes in [1], the jextractapp gradle task fails on Windows
> with the error `Error: no value given for --add-options`. While I'm not
> exactly sure what is happening here, wrapping the escaped quotes at [2]
> in another level of escaping (so they look like `\\\"`) resolves the
> issue. After this fix, the task still works successfully on linux (and
> presumably mac). I would make a pull request to fix this but I am unsure
> if this is the best (or even a valid) solution and due to my OCA
> currently being under review, the merging would be blocked anyways.
> 
> -DJ
> 
> [1] - https://github.com/openjdk/jextract/pull/11 
> <https://github.com/openjdk/jextract/pull/11>
> [2] -
> https://github.com/openjdk/jextract/blob/e184943f15e8df68c6122b8f7e49c0a910a3b773/build.gradle#L113 
> <https://github.com/openjdk/jextract/blob/e184943f15e8df68c6122b8f7e49c0a910a3b773/build.gradle#L113>


More information about the jextract-dev mailing list