Closed Glavo closed 10 months ago
@Spasi
I'm running into a little trouble.
I disabled the bgfx module for RISC-V 64. However, the nanovg module contains a class (NanoVGBGFX) that depends on bgfx. When the bgfx module is disabled, the class cannot be compiled either (because several invokeXXX methods are missing in org.lwjgl.system.JNI
).
I guess this is a known thing since I saw in the template that the class is only generated when the bgfx module is enabled (nanovg_bgfx.kt). But unfortunately, unless I run ant clean
first and then turn on offline mode before building, the class always appears.
I know that the generator of LWJGL caches generated classes, so I'm guessing the cause of the problem is that the generator doesn't delete classes that shouldn't be there. But I'm not familiar with the generator, so can you take a look at this problem?
@Glavo That's correct, the generator is not clever enough to delete previously generated code that is no longer needed. Also, ant clean
will only clean directories of currently enabled modules.
I've verified that with a fully clean/reset repo and bgfx disabled in config/build-bindings.xml
, the NanoVGBGFX
class is not generated and LWJGL builds correctly. Just make sure to not use ant hydrate-kotlinc
, that will generate everything again. Use ant compile-templates
instead (slow, but necessary in this case).
@Glavo That's correct, the generator is not clever enough to delete previously generated code that is no longer needed. Also,
ant clean
will only clean directories of currently enabled modules.I've verified that with a fully clean/reset repo and bgfx disabled in
config/build-bindings.xml
, theNanoVGBGFX
class is not generated and LWJGL builds correctly. Just make sure to not useant hydrate-kotlinc
, that will generate everything again. Useant compile-templates
instead (slow, but necessary in this case).
I see, thank you.
I just spent a few hours working on the same thing, so hopefully I can help progress this PR!
There is an issue with compiling this on a VisionFive 2 running the Debian image with OpenJDK 19:
javac: nanovg] /home/user/lwjgl3-riscv/lwjgl3-riscv-existing/modules/lwjgl/nanovg/src/generated/java/org/lwjgl/nanovg/NanoVGBGFX.java:72: error: cannot find symbol
[javac: nanovg] return invokeCPP(_edgeaa, _viewId, _allocator, __functionAddress);
[javac: nanovg] ^
[javac: nanovg] symbol: method invokeCPP(int,short,long,long)
[javac: nanovg] location: class NanoVGBGFX
[javac: nanovg] /home/user/lwjgl3-riscv/lwjgl3-riscv-existing/modules/lwjgl/nanovg/src/generated/java/org/lwjgl/nanovg/NanoVGBGFX.java:97: error: cannot find symbol
[javac: nanovg] invokePCV(_ctx, _viewId, __functionAddress);
[javac: nanovg] ^
[javac: nanovg] symbol: method invokePCV(long,short,long)
[javac: nanovg] location: class NanoVGBGFX
[javac: nanovg] /home/user/lwjgl3-riscv/lwjgl3-riscv-existing/modules/lwjgl/nanovg/src/generated/java/org/lwjgl/nanovg/NanoVGBGFX.java:158: error: cannot find symbol
[javac: nanovg] invokeCPV(_view_id, _framebuffer, __functionAddress);
[javac: nanovg] ^
[javac: nanovg] symbol: method invokeCPV(short,long,long)
[javac: nanovg] location: class NanoVGBGFX
[javac: nanovg] /home/user/lwjgl3-riscv/lwjgl3-riscv-existing/modules/lwjgl/nanovg/src/generated/java/org/lwjgl/nanovg/NanoVGBGFX.java:172: error: cannot find symbol
[javac: nanovg] invokePCV(_ctx, _id, _width, _height, flags, __functionAddress);
[javac: nanovg] ^
[javac: nanovg] symbol: method invokePCV(long,short,int,int,int,long)
[javac: nanovg] location: class NanoVGBGFX
[javac: nanovg] 4 errors
[javac: nanovg] 1 warning
Looking in my own lwjgl3 fork, it appears that this symbol does exist as just a function declaration. What differences would cause your version to not make this symbol?
Edit: just do ant clean
first
@Slackadays Hey, the problem you encountered was mentioned in the previous conversation. Here is Spasi's reply to this:
That's correct, the generator is not clever enough to delete previously generated code that is no longer needed. Also,
ant clean
will only clean directories of currently enabled modules.I've verified that with a fully clean/reset repo and bgfx disabled in
config/build-bindings.xml
, theNanoVGBGFX
class is not generated and LWJGL builds correctly. Just make sure to not useant hydrate-kotlinc
, that will generate everything again. Useant compile-templates
instead (slow, but necessary in this case).
I actually just realized that by trying ant clean
right after, so I guess that's on me because I'm used to CMake where it handles this kind of thing properly.
One more thing: I'm trying to get the tests working, and it looks like rpmalloc
was removed specifically for RISC-V in https://github.com/LWJGL/lwjgl3/pull/890/commits/f2062730c7020e678df266109eaf024626061ee8. However, it seems to compile just fine, so is there a specific reason it was disabled?
One more thing: I'm trying to get the tests working, and it looks like
rpmalloc
was removed specifically for RISC-V in f206273. However, it seems to compile just fine, so is there a specific reason it was disabled?
Sorry, I forgot why I did this. I will re-review these temporarily disabled modules when the issues blocking this PR are resolved.
It turns out that there was an issue with rpmalloc which prevented it from properly working on RISC-V. I just made a PR at https://github.com/Glavo/lwjgl3/pull/1 that should fix it. Unfortunately, the tests hang at OpenCL probably because the VF2's Imagination drivers are pure junk right now, so that might improve sometime in the future.
@Spasi There has been no progress on this PR for several months. Can you please take a look at these PRs?
long wait……
@Spasi these PRs let RISC-V become viable for Minecraft and anything else that uses LWJGL
I'll run some tests right away to see if there are any issues that need to be addressed.
@Spasi I have successfully built LWJGL on RISC-V platform and it passes all tests. This PR is now pending review.
GitHub Action is working: https://github.com/Glavo/lwjgl3/actions/runs/6803359632
Thank you @Glavo and @Slackadays! The first 3.3.4 snapshot will include riscv64 binaries.
@SimonIT it's up, I published it before going to bed and updated https://www.lwjgl.org/customize about an hour ago.
Most of the work has been completed, and both cross compilation and native compilation can work. I have successfully launched Minecraft on Debian RISC-V 64.
Currently, the dependent native libraries are all built by me on my own machine. Next, I need to have LWJGL CI build the native libraries for RISC-V.
Progress: