gdx-teavm icon indicating copy to clipboard operation
gdx-teavm copied to clipboard

Building the generator

Open ange-black69 opened this issue 2 years ago • 17 comments

Hello @xpenatan and thank you very much for your work! I'm trying to port my game to html5 and gwt version was awfull... I have seen your video about TeaVM generator tool but I didn't see any compiled jar on the repo. So I have cloned your depo and did a ./gradlew build on my desktop but I got the following error build failed : ` "A problem occurred configuring project ':examples:core:dragome'".

Failed to notify project evaluation listener. Unsupported servlet container: jetty9"`

So I try at first to replace it with jetty94 and jetty9.4 according to gretty doc but it didn't work either :( I'm running on java openjdk 11. Is there a existing generator compiled ? Thanks you again

ange-black69 avatar Sep 26 '21 16:09 ange-black69

Hi @ange-black69, thanks for trying it out.

I would like to remember that this is a work in progress and may not work for a complete game.

To run the generator try this:

  • Download "teavm-cli-0.7.0-dev-XXXX.jar" from https://github.com/konsoletyper/teavm and add it to "backend-teavm\libs"
  • run ./gradlew :tools:generator:desktop:run from root project

Also, make a pull. I disable dragome in settings.gradle for now. I use sdk 1.8, so I'm not sure it will work with sdk 11.

xpenatan avatar Sep 26 '21 23:09 xpenatan

Thank you very much for your quick reply! I managed to run it. I will test with my game, but that looks really really promissing! To confirm, this does work for jdk11 (at least I can compile the generator). I will definitively follow your project and help where I can! Thank you

ange-black69 avatar Sep 27 '21 07:09 ange-black69

Ok so after further investigation, It does run fine on jdk8 but not on 11 (I have manually switched gradle to 8). If you are using jdk11, it does compile the generator, but you got a class cast exception. This error disapear in jdk 8. However, when I wanted to build with TeaVM Backend, just after the compiling state, I got a " Error optimizing program for method..." and this method is related to javax crypto : "Class not found: java.security.KeyFactory" and "Class not found: java.security.NoSuchAlgorithmException". These bugs are related to TeaVM apparently. I will try to investigate further or post a issue into TeaVM repo directly.

ange-black69 avatar Sep 27 '21 08:09 ange-black69

Does it work with GWT? If it do work then we can try to port.

xpenatan avatar Sep 27 '21 16:09 xpenatan

In fact I abandon gwt a while ago because it was way too complicated to make my game working properply (I use websocket and websocket on gwt is a pain.. anyway) so I have found this alternative really promising.

ange-black69 avatar Sep 27 '21 17:09 ange-black69

Hey @xpenatan how's going this? I was looking for an alternative to GWT in libGDX and I've found this project.. I tried to compile a demo game made with my engine (https://github.com/rednblackgames/tutorial-space-platform/tree/artemis) with TeaVM backend but it didn't worked (compilation produce errors regarding missing methods for freetype extension) and the produced JS code doesn't run. It crashes with a strange stacktrace, I suspect that's because reflection or because I've upgrade it to libGDX 1.10.1-SNAPSHOT... Anyway this looks a very cool project! I would really happy to help if this could avoid using GWT in future :)

P.S. Why Dragome Backend was disabled? Is TeaVM better?

fgnm avatar Dec 28 '21 14:12 fgnm

Hi @fgnm.

Dragome creator is not active anymore. It have some crash bugs that takes some time to understand and fix the source. I even had a fork with some small fixes but then I decided that its not worth it.

About teaVM, it does not have bullet physics or freetype support yet. So you may ask on how did it worked with dragome. I converted C++ to javascript with emscripten and I manually binded most of bullet and freetype methods using dragome api. The same steps is needed for teaVM.

xpenatan avatar Dec 29 '21 13:12 xpenatan

Thanks a lot @xpenatan! I'm learning a bit how the whole mechanism works, I'll need sometime, but I've tried your latest changes on my demo project. The first thing I'd like to point out is that generator cannot be run on Linux due to ImGUI native libraries problems, here the stacktrace:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'libimgui64.so' for target: Linux, 64-bit
	at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:126)
	at com.github.xpenatan.imgui.ImGui.init(ImGui.java:28)
	at com.github.xpenatan.imgui.ImGui.init(ImGui.java:20)
	at com.github.xpenatan.gdx.html5.generator.core.view.MainApplication.create(MainApplication.java:17)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:150)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: /tmp/libgdxkalculon/53b4eafc/libimgui64.so: libimgui-cpp64.so: impossibile aprire il file oggetto condiviso: File o directory non esistente
	at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:322)
	at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:122)
	... 5 more
Caused by: java.lang.UnsatisfiedLinkError: /tmp/libgdxkalculon/53b4eafc/libimgui64.so: libimgui-cpp64.so: impossibile aprire il file oggetto condiviso: File o directory non esistente
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
	at java.lang.Runtime.load0(Runtime.java:810)
	at java.lang.System.load(System.java:1088)
	at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:328)
	at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:297)
	... 6 more

Tried also to manually copy shared libraries into correct folders but still can't get it working on Linux.

fgnm avatar Dec 30 '21 21:12 fgnm

Tried generator on Windows, it works, but as expected compiler produce many errors, mostly regarding freetype and artemis.. I've changed libGDX version into dependencies.gradle to 1.10.1-SNAPSHOT becuase the demo project needs this version.

| ERROR[0]
| Class: com/badlogic/gdx/utils/SharedLibraryLoader.java:122
| Method: com.badlogic.gdx.utils.SharedLibraryLoader.load(Ljava/lang/String;)V
| Text: Method java.lang.System.loadLibrary(Ljava/lang/String;)V was not found
| 
| ----
| 
| ERROR[1]
| Class: com/badlogic/gdx/utils/SharedLibraryLoader.java:320
| Method: com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(Ljava/lang/String;)V
| Text: Method java.lang.System.load(Ljava/lang/String;)V was not found
| 
| ----
| 
| ERROR[2]
| Class: com/badlogic/gdx/utils/SharedLibraryLoader.java:330
| Method: com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(Ljava/lang/String;Ljava/lang/String;Ljava/io/File;)Ljava/lang/Throwable;
| Text: Method java.lang.System.load(Ljava/lang/String;)V was not found
| 
| ----
| 
| ERROR[3]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Stroker.set(JIIII)V
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Stroker.set(JIIII)V has no implementation
| 
| ----
| 
| ERROR[4]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Stroker.done(J)V
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Stroker.done(J)V has no implementation
| 
| ----
| 
| ERROR[5]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$GlyphMetrics.getHeight(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$GlyphMetrics.getHeight(J)I has no implementation
| 
| ----
| 
| ERROR[6]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$GlyphMetrics.getHoriAdvance(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$GlyphMetrics.getHoriAdvance(J)I has no implementation
| 
| ----
| 
| ERROR[7]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.doneFace(J)V
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.doneFace(J)V has no implementation
| 
| ----
| 
| ERROR[8]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getFaceFlags(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getFaceFlags(J)I has no implementation
| 
| ----
| 
| ERROR[9]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getNumGlyphs(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getNumGlyphs(J)I has no implementation
| 
| ----
| 
| ERROR[10]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getMaxAdvanceWidth(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getMaxAdvanceWidth(J)I has no implementation
| 
| ----
| 
| ERROR[11]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.setPixelSizes(JII)Z
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.setPixelSizes(JII)Z has no implementation
| 
| ----
| 
| ERROR[12]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.loadChar(JII)Z
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.loadChar(JII)Z has no implementation
| 
| ----
| 
| ERROR[13]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getGlyph(J)J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getGlyph(J)J has no implementation
| 
| ----
| 
| ERROR[14]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getSize(J)J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getSize(J)J has no implementation
| 
| ----
| 
| ERROR[15]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.hasKerning(J)Z
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.hasKerning(J)Z has no implementation
| 
| ----
| 
| ERROR[16]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getKerning(JIII)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getKerning(JIII)I has no implementation
| 
| ----
| 
| ERROR[17]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getCharIndex(JI)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.getCharIndex(JI)I has no implementation
| 
| ----
| 
| ERROR[18]
| Class: com/badlogic/gdx/graphics/g2d/freetype/FreeType.java:172
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.dispose()V
| Text: Method com.badlogic.gdx.utils.BufferUtils.isUnsafeByteBuffer(Ljava/nio/ByteBuffer;)Z was not found
| 
| ----
| 
| ERROR[19]
| Class: com/badlogic/gdx/graphics/g2d/freetype/FreeType.java:173
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face.dispose()V
| Text: Method com.badlogic.gdx.utils.BufferUtils.disposeUnsafeByteBuffer(Ljava/nio/ByteBuffer;)V was not found
| 
| ----
| 
| ERROR[20]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType.getLastErrorCode()I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType.getLastErrorCode()I has no implementation
| 
| ----
| 
| ERROR[21]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType.initFreeTypeJni()J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType.initFreeTypeJni()J has no implementation
| 
| ----
| 
| ERROR[22]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.doneFreeType(J)V
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.doneFreeType(J)V has no implementation
| 
| ----
| 
| ERROR[23]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.newMemoryFace(JLjava/nio/ByteBuffer;II)J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.newMemoryFace(JLjava/nio/ByteBuffer;II)J has no implementation
| 
| ----
| 
| ERROR[24]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.strokerNew(J)J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.strokerNew(J)J has no implementation
| 
| ----
| 
| ERROR[25]
| Class: com/badlogic/gdx/graphics/g2d/freetype/FreeType.java:73
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.dispose()V
| Text: Method com.badlogic.gdx.utils.BufferUtils.isUnsafeByteBuffer(Ljava/nio/ByteBuffer;)Z was not found
| 
| ----
| 
| ERROR[26]
| Class: com/badlogic/gdx/graphics/g2d/freetype/FreeType.java:74
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.dispose()V
| Text: Method com.badlogic.gdx.utils.BufferUtils.disposeUnsafeByteBuffer(Ljava/nio/ByteBuffer;)V was not found
| 
| ----
| 
| ERROR[27]
| Class: com/badlogic/gdx/graphics/g2d/freetype/FreeType.java:100
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.newFace(Lcom/badlogic/gdx/files/FileHandle;I)Lcom/badlogic/gdx/graphics/g2d/freetype/FreeType$Face;
| Text: Method com.badlogic.gdx.utils.BufferUtils.newUnsafeByteBuffer(I)Ljava/nio/ByteBuffer; was not found
| 
| ----
| 
| ERROR[28]
| Class: com/badlogic/gdx/graphics/g2d/freetype/FreeType.java:96
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.newFace(Lcom/badlogic/gdx/files/FileHandle;I)Lcom/badlogic/gdx/graphics/g2d/freetype/FreeType$Face;
| Text: Method com.badlogic.gdx.utils.BufferUtils.newUnsafeByteBuffer(I)Ljava/nio/ByteBuffer; was not found
| 
| ----
| 
| ERROR[29]
| Class: com/badlogic/gdx/graphics/g2d/freetype/FreeType.java:121
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.newMemoryFace(Ljava/nio/ByteBuffer;I)Lcom/badlogic/gdx/graphics/g2d/freetype/FreeType$Face;
| Text: Method com.badlogic.gdx.utils.BufferUtils.isUnsafeByteBuffer(Ljava/nio/ByteBuffer;)Z was not found
| 
| ----
| 
| ERROR[30]
| Class: com/badlogic/gdx/graphics/g2d/freetype/FreeType.java:122
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Library.newMemoryFace(Ljava/nio/ByteBuffer;I)Lcom/badlogic/gdx/graphics/g2d/freetype/FreeType$Face;
| Text: Method com.badlogic.gdx.utils.BufferUtils.disposeUnsafeByteBuffer(Ljava/nio/ByteBuffer;)V was not found
| 
| ----
| 
| ERROR[31]
| Class: com/artemis/utils/reflect/Field.java:106
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Method java.lang.reflect.Field.getGenericType()Ljava/lang/reflect/Type; was not found
| 
| ----
| 
| ERROR[32]
| Class: com/artemis/utils/reflect/Field.java:108
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Class java.lang.reflect.ParameterizedType was not found
| 
| ----
| 
| ERROR[33]
| Class: com/artemis/utils/reflect/Field.java:113
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Class java.lang.reflect.ParameterizedType was not found
| 
| ----
| 
| ERROR[34]
| Class: com/artemis/utils/reflect/Field.java:115
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Class java.lang.reflect.GenericArrayType was not found
| 
| ----
| 
| ERROR[35]
| Class: com/artemis/utils/reflect/Field.java:114
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Class java.lang.reflect.ParameterizedType was not found
| 
| ----
| 
| ERROR[36]
| Class: com/artemis/utils/reflect/Field.java:116
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Class java.lang.reflect.GenericArrayType was not found
| 
| ----
| 
| ERROR[37]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.done(J)V
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.done(J)V has no implementation
| 
| ----
| 
| ERROR[38]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.strokeBorder(JJZ)J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.strokeBorder(JJZ)J has no implementation
| 
| ----
| 
| ERROR[39]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.toBitmap(JI)J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.toBitmap(JI)J has no implementation
| 
| ----
| 
| ERROR[40]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.getBitmap(J)J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.getBitmap(J)J has no implementation
| 
| ----
| 
| ERROR[41]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.getLeft(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.getLeft(J)I has no implementation
| 
| ----
| 
| ERROR[42]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.getTop(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Glyph.getTop(J)I has no implementation
| 
| ----
| 
| ERROR[43]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Size.getMetrics(J)J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Size.getMetrics(J)J has no implementation
| 
| ----
| 
| ERROR[44]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Bitmap.getRows(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Bitmap.getRows(J)I has no implementation
| 
| ----
| 
| ERROR[45]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Bitmap.getWidth(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Bitmap.getWidth(J)I has no implementation
| 
| ----
| 
| ERROR[46]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Bitmap.getPitch(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Bitmap.getPitch(J)I has no implementation
| 
| ----
| 
| ERROR[47]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Bitmap.getBuffer(J)Ljava/nio/ByteBuffer;
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Bitmap.getBuffer(J)Ljava/nio/ByteBuffer; has no implementation
| 
| ----
| 
| ERROR[48]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Bitmap.getPixelMode(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$Bitmap.getPixelMode(J)I has no implementation
| 
| ----
| 
| ERROR[49]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$GlyphSlot.getMetrics(J)J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$GlyphSlot.getMetrics(J)J has no implementation
| 
| ----
| 
| ERROR[50]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$GlyphSlot.getFormat(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$GlyphSlot.getFormat(J)I has no implementation
| 
| ----
| 
| ERROR[51]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$GlyphSlot.getGlyph(J)J
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$GlyphSlot.getGlyph(J)J has no implementation
| 
| ----
| 
| ERROR[52]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$SizeMetrics.getAscender(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$SizeMetrics.getAscender(J)I has no implementation
| 
| ----
| 
| ERROR[53]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$SizeMetrics.getDescender(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$SizeMetrics.getDescender(J)I has no implementation
| 
| ----
| 
| ERROR[54]
| Class: -
| Method: com.badlogic.gdx.graphics.g2d.freetype.FreeType$SizeMetrics.getHeight(J)I
| Text: Native method com.badlogic.gdx.graphics.g2d.freetype.FreeType$SizeMetrics.getHeight(J)I has no implementation

fgnm avatar Dec 30 '21 21:12 fgnm

Thanks a lot @xpenatan! I'm learning a bit how the whole mechanism works, I'll need sometime, but I've tried your latest changes on my demo project. The first thing I'd like to point out is that generator cannot be run on Linux due to ImGUI native libraries problems, here the stacktrace:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'libimgui64.so' for target: Linux, 64-bit
	at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:126)
	at com.github.xpenatan.imgui.ImGui.init(ImGui.java:28)
	at com.github.xpenatan.imgui.ImGui.init(ImGui.java:20)
	at com.github.xpenatan.gdx.html5.generator.core.view.MainApplication.create(MainApplication.java:17)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:150)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: /tmp/libgdxkalculon/53b4eafc/libimgui64.so: libimgui-cpp64.so: impossibile aprire il file oggetto condiviso: File o directory non esistente
	at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:322)
	at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:122)
	... 5 more
Caused by: java.lang.UnsatisfiedLinkError: /tmp/libgdxkalculon/53b4eafc/libimgui64.so: libimgui-cpp64.so: impossibile aprire il file oggetto condiviso: File o directory non esistente
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
	at java.lang.Runtime.load0(Runtime.java:810)
	at java.lang.System.load(System.java:1088)
	at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:328)
	at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:297)
	... 6 more

Tried also to manually copy shared libraries into correct folders but still can't get it working on Linux.

Hi, I'm currently using windows for now. I'll need to install Ubuntu to verify why is failing.

Do any of the tests works ? Gears, Animation2D, UITest using gradle ?

I'm trying to get FreeType test to work first. I made it compile but was not rendering any text. I guess there is a issue with teavm ByteBuffer and the old freetype emulation code which use a custom readwrite byte buffer.

About Artemis. Teavm have very low reflection support and I think that teavm dont have "java.lang.reflect.ParameterizedType" and "java.lang.reflect.GenericArrayType" implemented.

https://github.com/konsoletyper/teavm/tree/master/classlib/src/main/java/org/teavm/classlib/java/lang/reflect

xpenatan avatar Dec 31 '21 04:12 xpenatan

@fgnm

Freetype is now working.

image

xpenatan avatar Dec 31 '21 16:12 xpenatan

@xpenatan that's awesome! I tried examples and they're working.. Still cannot be able to run an example from my engine, I always got artemis errors:

#################################################################
|
| COMPILING
|
#################################################################
#################################################################
|
| Compiler problems
|
#################################################################
| ERROR[0]
| Class: com/artemis/utils/reflect/Field.java:106
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Method java.lang.reflect.Field.getGenericType()Ljava/lang/reflect/Type; was not found
| 
| ----
| 
| ERROR[1]
| Class: com/artemis/utils/reflect/Field.java:108
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Class java.lang.reflect.ParameterizedType was not found
| 
| ----
| 
| ERROR[2]
| Class: com/artemis/utils/reflect/Field.java:113
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Class java.lang.reflect.ParameterizedType was not found
| 
| ----
| 
| ERROR[3]
| Class: com/artemis/utils/reflect/Field.java:115
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Class java.lang.reflect.GenericArrayType was not found
| 
| ----
| 
| ERROR[4]
| Class: com/artemis/utils/reflect/Field.java:114
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Class java.lang.reflect.ParameterizedType was not found
| 
| ----
| 
| ERROR[5]
| Class: com/artemis/utils/reflect/Field.java:116
| Method: com.artemis.utils.reflect.Field.getElementType(I)Ljava/lang/Class;
| Text: Class java.lang.reflect.GenericArrayType was not found

Which they're weird becuase com.artemis.utils.reflect.Field class is the same of com.badlogic.gdx.utils.reflect.Field

fgnm avatar Dec 31 '21 17:12 fgnm

Okay nothing weird, just my bad. I created com.artemis.utils.reflect.Field and com.artemis.utils.reflect.Annotation based on your class made for libGDX reflection and now compiling is succesfully. Still not works, but I think for a minor issue. This is the stacktrace I got in console:

app.js:253 Uncaught Error: Java exception thrown
    at $rt_exception (app.js:253)
    at $rt_throw (app.js:245)
    at $java.jlr_Field_set (app.js:113416)
    at $java.jlr_Field.$set45 (app.js:564)
    at Object.$java.cbgur_Field_set (app.js:91470)
    at $java.cbgu_Json_readFields (app.js:73877)
    at cbgu_Json.$readFields (app.js:564)
    at $java.cbgu_Json_readValue5 (app.js:74076)
    at cbgu_Json.$readValue0 (app.js:569)
    at $java.cbgu_Json_fromJson7 (app.js:73792)

And looks related to Json reading. The game reads a series of Json files stored in the asset directory which conteins all information about level/game world.

fgnm avatar Dec 31 '21 17:12 fgnm

@fgnm Can you show me the steps you use to build ? Its a single jar file or you created a new module for teavm ?

About the the reflection. I just commited a small fix to get the reflectionTest to work. It requires "TeaReflectionSupplier.addReflectionClass" in the Build class to be able to read the "reflectionClass.json" file.

xpenatan avatar Dec 31 '21 18:12 xpenatan

@xpenatan thanks a lot! I noticed only few minutes after the existence of TeaReflectionSupplier. It's awesome to have an unlimited reflection pool, and I confirm that the game runs pretty well on any browsers! If you like the idea I can PR the few changes I made to get artemis working. I also made a small method that scan classes into jar and add them to relfection cache if the belong to a particular list (like gdx.reflect.include in xml GWT system).

The main reason why I'd like to avoid GWT are performances.. Jbox2D is quite slow and I saw some box2d compiled in wasm that performs on a completely other level, like this one: https://github.com/Birch-san/box2d-wasm. Could this be possible here too?

Anyway, thanks for all and heppy new year :)

fgnm avatar Dec 31 '21 19:12 fgnm

@xpenatan thanks a lot! I noticed only few minutes after the existence of TeaReflectionSupplier. It's awesome to have an unlimited reflection pool, and I confirm that the game runs pretty well on any browsers! If you like the idea I can PR the few changes I made to get artemis working. I also made a small method that scan classes into jar and add them to relfection cache if the belong to a particular list (like gdx.reflect.include in xml GWT system).

The main reason why I'd like to avoid GWT are performances.. Jbox2D is quite slow and I saw some box2d compiled in wasm that performs on a completely other level, like this one: https://github.com/Birch-san/box2d-wasm. Could this be possible here too?

Anyway, thanks for all and heppy new year :)

Sure, I don't use Artemis so I any improvements to get it to work are welcome.

About jBox2d, do you have a example that is possible to compare the two? like a benchmark?
I wonder if using emscripten to convert box2d c++ to js will have any performance gain. Not sure if box2d-wasm is possible.

Happy new year :)

xpenatan avatar Dec 31 '21 21:12 xpenatan

hi @fgnm

I updated readme bullet test. It contains bullet phsyics test and with webassembly. Emscripten support webassembly so it gives a small fps gain.

xpenatan avatar Jan 12 '22 01:01 xpenatan