Trying to build j-extract on Linux throws "java.lang.module.FindException: Module jdk.compiler not found"
Gavin Ray
ray.gavin97 at gmail.com
Wed Sep 21 16:38:45 UTC 2022
Well the above worked for JDK 19, though now I am trying to build from the
"panama" branch which includes API changes from JDK 20
I built Panama OpenJDK from source, and got the same issue. It's very
strange:
[user at MSI ]$ /home/user/downloads/jdk-20-panama-sourcebuilt/jdk/bin/jlink \
--module-path=/home/user/projects/jextract-panama-upstream/build/jmods \
--add-modules=org.openjdk.jextract,jdk.compiler,jdk.zipfs \
--output=/home/user/projects/jextract-panama-upstream/build/jextract \
--launcher=jextract=org.openjdk.jextract/org.openjdk.jextract.JextractTool \
--add-options '"--enable-native-access=org.openjdk.jextract"
"--enable-preview"'
Error: Module jdk.compiler not found
java.lang.module.FindException: Module jdk.compiler not found
at java.base/java.lang.module.Resolver.findFail(Resolver.java:892)
at...
[user at MSI ]$ /home/user/downloads/jdk-20-panama-sourcebuilt/jdk/bin/java
--list-modules | grep jdk.compiler
jdk.compiler
file:///home/user/downloads/jdk-20-panama-sourcebuilt/jdk/modules/jdk.compiler/
On Tue, Sep 20, 2022 at 11:53 PM Gavin Ray <ray.gavin97 at gmail.com> wrote:
> Thanks for the swift reply Sundararajan,
>
> Running this seems to produce one output, it looks like something is there:
>
> [user at MSI] $
> /usr/lib/jvm/java-19-openjdk-19.0.0.0.36-2.rolling.fc38.x86_64/bin/java
> --list-modules | grep jdk.compiler
> jdk.compiler at 19
>
> Where the output line is "jdk.compiler at 19"
>
> [image: image.png]
>
> It's not so much a big deal, I installed JDK 17 and used that as the
> Gradle compiler and it worked
> Probably it is something I am doing wrong and not worth investing time into
>
> I have written a Dockerfile that builds jextract from source and allows
> you to use it without installing anything
> It is late here so I haven't had time to test it yet, but I will
> double-check it tomorrow and submit it as a PR to repo so folks can use
> this if they want:
>
> https://gist.github.com/GavinRay97/45365bf3b7d49ae335c525ffd51605c4
>
> Then anyone can run jextract like:
> docker run --rm -it jextract:v0.x <flags>
>
> =)
>
>
> On Tue, Sep 20, 2022 at 11:36 PM Sundararajan Athijegannathan <
> sundararajan.athijegannathan at oracle.com> wrote:
>
>> Hi,
>>
>> I just checked with Oracle jdk19 installation + jextract repo's master
>> branch. Build/verify worked as expected on mac.
>>
>> From the error message you posted, it seems "jdk.compiler" module is
>> missing in your jdk19 installation. jextract needs jdk.compiler module to
>> compile the extracted Java sources to produce .class files.
>>
>> Will you please check if the following command prints "jdk.compiler"?
>>
>> /usr/lib/jvm/java-19-openjdk-19.0.0.0.36-2.rolling.fc38.x86_64/bin/java
>> --list-modules | grep jdk.compiler
>>
>> For example, in my case
>>
>> $ /Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home/bin/java \
>>
>> > --list-modules | grep jdk.compiler
>>
>> jdk.compiler at 19
>>
>>
>> If not, that installation may be missing compiler module (perhaps
>> generated by jlink invocation). Solution is to install a full JDK 19.
>>
>>
>> Hope this helps,
>>
>> -Sundar
>>
>>
>>
>>
>> ------------------------------
>> *From:* panama-dev <panama-dev-retn at openjdk.org> on behalf of Gavin Ray <
>> ray.gavin97 at gmail.com>
>> *Sent:* 21 September 2022 07:35
>> *To:* panama-dev at openjdk.org <panama-dev at openjdk.org>
>> *Subject:* Trying to build j-extract on Linux throws
>> "java.lang.module.FindException: Module jdk.compiler not found"
>>
>> Hello all,
>>
>> I'm trying to generate jextract types for io_uring (I didn't find any
>> non-JNI/JNA libraries to use it from JVM)
>> Unfortunately, following the instructions I've hit a snag.
>>
>> Building it with JDK 19, I get:
>> =============================================
>> [user at MSI jextract]$ sh ./gradlew \
>> -Pjdk19_home=/usr/lib/jvm/java-19-openjdk-19.0.0.0.36-2.rolling.fc38.x86_64
>> \
>> -Pllvm_home=/home/user/downloads/clang+llvm-15.0.0-aarch64-linux-gnu
>> clean verify
>>
>> > Task :compileJava
>> Note: Some input files use preview features of Java SE 19.
>> Note: Recompile with -Xlint:preview for details.
>>
>> > Task :createJextractImage FAILED
>> Error: Module jdk.compiler not found
>> java.lang.module.FindException: Module jdk.compiler not found
>> at java.base/java.lang.module.Resolver.findFail(Resolver.java:892)
>> at java.base/java.lang.module.Resolver.resolve(Resolver.java:129)
>> at
>> java.base/java.lang.module.Configuration.resolve(Configuration.java:420)
>> at
>> java.base/java.lang.module.Configuration.resolve(Configuration.java:254)
>> at
>> jdk.jlink/jdk.tools.jlink.internal.Jlink$JlinkConfiguration.resolve(Jlink.java:217)
>> at
>> jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImageProvider(JlinkTask.java:536)
>> at
>> jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImage(JlinkTask.java:424)
>> at
>> jdk.jlink/jdk.tools.jlink.internal.JlinkTask.run(JlinkTask.java:276)
>> at jdk.jlink/jdk.tools.jlink.internal.Main.run(Main.java:56)
>> at jdk.jlink/jdk.tools.jlink.internal.Main.main(Main.java:34)
>> =============================================
>>
>> Would it make sense to add a Dockerfile for Linux to the repo that can
>> reliably build the latest version?
>> That way folks don't have to mess around with finding and installing LLVM
>> and whatnot.
>>
>> I'm happy to submit a PR for this if someone can tell me why the regular
>> build command is failing, ha.
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20220921/fc79290e/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 83028 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20220921/fc79290e/image-0001.png>
More information about the panama-dev
mailing list