Giter Club home page Giter Club logo

Comments (18)

xpenatan avatar xpenatan commented on May 23, 2024

Hi @siauderman

Error 0 and 1 happens when "teavm-cli-0.7.0-dev-1200.jar" classes are inside accepted libs. It should be in "Not Accepted Libs ClassPath"

Is the generator a standalone jar ou being executed with gradle run command ? Check if teavm-cli-0.7.0-dev-1200.jar is not merging with other jar files.

from gdx-teavm.

customautosys avatar customautosys commented on May 23, 2024

I built it as a standalone jar using the dist task because nothing I did could avoid the out of memory error when I run the "run" task.

How do I change it to "Not Accepted Libs" if I build using dist?

from gdx-teavm.

customautosys avatar customautosys commented on May 23, 2024

Also, I just tried running on my Linux machine to see if there's a difference and I got this:

com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: /tmp/libgdxcustomautosys/53b4eafc/libimgui64.so: libimgui-cpp64.so

Any idea why there seems to be a missing native lib?

from gdx-teavm.

xpenatan avatar xpenatan commented on May 23, 2024

The generator uses imgui for the UI and its a known issue that the linux libs are not working.

from gdx-teavm.

xpenatan avatar xpenatan commented on May 23, 2024

About the dist. its not working well. The teavm cli lib is being added along with the generator classes.

Need to find a way to separate it from the final jar. Or, if possible. a way to filter its classes from messing up the emulation classes.

from gdx-teavm.

xpenatan avatar xpenatan commented on May 23, 2024

When running the run gradle command the teavm does not merge its classes so its easier to filter it out.

from gdx-teavm.

xpenatan avatar xpenatan commented on May 23, 2024

Hi @siauderman
I commited a temp way to run the generator.

on windows, execute the generator gradle dist command and then run the "\tools\generator\desktop\run.bat"

See if it works this way.

from gdx-teavm.

customautosys avatar customautosys commented on May 23, 2024

Dear @xpenatan,

Thanks for responding so quickly and sorry for bothering you!

I'm now getting this error instead:

#################################################################
| ERROR[0]
| Class: -
| Method: com.badlogic.gdx.utils.reflect.Field.getElementType(Ljava/lang/Class;Ljava/lang/String;I)Ljava/lang/Class;
| Text: Error accessing proxy method com.badlogic.gdx.utils.reflect.Field.getElementType(Lorg/teavm/metaprogramming/ReflectClass;Lorg/teavm/metaprogramming/Value;Lorg/teavm/metaprogramming/Value;)V: java.lang.NoSuchMethodException: com.badlogic.gdx.utils.reflect.Field.getElementType(org.teavm.metaprogramming.ReflectClass, org.teavm.metaprogramming.Value, org.teavm.metaprogramming.Value)
        at java.lang.Class.getDeclaredMethod(Class.java:2130)
        at org.teavm.metaprogramming.impl.UsageGenerator.getJavaMethod(UsageGenerator.java:259)
        at org.teavm.metaprogramming.impl.UsageGenerator.installProxyEmitter(UsageGenerator.java:69)
        at org.teavm.metaprogramming.impl.MetaprogrammingDependencyListener.methodReached(MetaprogrammingDependencyListener.java:78)
        at org.teavm.dependency.DependencyAnalyzer.linkMethod(DependencyAnalyzer.java:431)
        at org.teavm.dependency.DependencyAnalyzer.linkMethod(DependencyAnalyzer.java:440)
        at org.teavm.dependency.DependencyGraphBuilder$1.invokeSpecial(DependencyGraphBuilder.java:341)
        at org.teavm.dependency.AbstractInstructionAnalyzer.invoke(AbstractInstructionAnalyzer.java:196)
        at org.teavm.model.InstructionReadVisitor.visit(InstructionReadVisitor.java:182)
        at org.teavm.model.instructions.InvokeInstruction.acceptVisitor(InvokeInstruction.java:82)
        at org.teavm.model.BasicBlock.readAllInstructions(BasicBlock.java:314)
        at org.teavm.dependency.DependencyGraphBuilder.buildGraph(DependencyGraphBuilder.java:111)
        at org.teavm.dependency.PreciseDependencyAnalyzer.processMethod(PreciseDependencyAnalyzer.java:35)
        at org.teavm.dependency.DependencyAnalyzer.lambda$scheduleMethodAnalysis$8(DependencyAnalyzer.java:498)
        at org.teavm.dependency.DependencyAnalyzer.processQueue(DependencyAnalyzer.java:656)
        at org.teavm.dependency.DependencyAnalyzer.processDependencies(DependencyAnalyzer.java:683)
        at org.teavm.vm.TeaVM.build(TeaVM.java:379)
        at com.github.xpenatan.gdx.backends.teavm.CustomTeaVMTool.generate(CustomTeaVMTool.java:402)
        at com.github.xpenatan.gdx.backends.teavm.TeaBuilder.build(TeaBuilder.java:201)
        at com.github.xpenatan.gdx.html5.generator.core.viewmodel.GeneratorViewModel$1.run(GeneratorViewModel.java:78)

Doesn't look like a problem with my code, but seems there is some issue with TeaVM / libgdx.

If I run it from Android Studio (somehow I managed to fix the out of memory error), I get this instead:

#################################################################
|
| COMPILING
|
#################################################################
java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at java.util.Arrays.copyOfRange(Arrays.java:3593)
	at org.teavm.common.IrreducibleGraphSplitter.handleStronglyConnectedComponent(IrreducibleGraphSplitter.java:313)
	at org.teavm.common.IrreducibleGraphSplitter.handleIrreducibleChildren(IrreducibleGraphSplitter.java:241)
	at org.teavm.common.IrreducibleGraphSplitter.splitLoops(IrreducibleGraphSplitter.java:220)
	at org.teavm.common.GraphUtils.splitIrreducibleGraph(GraphUtils.java:361)
	at org.teavm.model.util.AsyncProgramSplitter.split(AsyncProgramSplitter.java:201)
	at org.teavm.ast.decompilation.Decompiler.decompileAsync(Decompiler.java:142)
	at org.teavm.backend.javascript.JavaScriptTarget.decompileAsync(JavaScriptTarget.java:637)
	at org.teavm.backend.javascript.JavaScriptTarget.decompile(JavaScriptTarget.java:595)
	at org.teavm.backend.javascript.JavaScriptTarget.decompile(JavaScriptTarget.java:563)
	at org.teavm.backend.javascript.JavaScriptTarget.modelToAst(JavaScriptTarget.java:516)
	at org.teavm.backend.javascript.JavaScriptTarget.emit(JavaScriptTarget.java:355)
	at org.teavm.backend.javascript.JavaScriptTarget.emit(JavaScriptTarget.java:336)
	at org.teavm.vm.TeaVM.build(TeaVM.java:422)
	at com.github.xpenatan.gdx.backends.teavm.CustomTeaVMTool.generate(CustomTeaVMTool.java:402)
	at com.github.xpenatan.gdx.backends.teavm.TeaBuilder.build(TeaBuilder.java:201)
	at com.github.xpenatan.gdx.html5.generator.core.viewmodel.GeneratorViewModel$1.run(GeneratorViewModel.java:78)

Thanks a lot for your help, much appreciated!

Is there a way I can add the backend to my liftoff project instead of using the generator? Maybe that might help?

from gdx-teavm.

xpenatan avatar xpenatan commented on May 23, 2024

Thanks for responding so quickly and sorry for bothering you!

No problem. The more error reports the better the tool becomes.

Is there a way I can add the backend to my liftoff project instead of using the generator? Maybe that might help?

Yes but its not ready yet. It's by creating a teavm module like its done in examples. The only issue is that there no snapshots yet. You can use publishToMavenLocal task from html5 tools and add this implementation to your game teavm module:

  implementation "com.github.xpenatan.gdx-web-tools:backend-web:1.0.0-SNAPSHOT"
  implementation "com.github.xpenatan.gdx-web-tools:backend-teavm:1.0.0-ALL-SNAPSHOT"

Also needs to have mavenLocal first in repositories:

	repositories {
		mavenLocal()
               // Others repos.
	}

The libs will be generated in C:\Users\MyUser.m2\repository\com\github\xpenatan\gdx-web-tools

I'm now getting this error instead:

teaVM reflection support is very small so its hard to know if its a bug or its not supported. Can you share a small jar/source example that cause this bug ? The generator does not have a option to add reflection classees yet so I'm not sure if its because of TeaReflectionSupplier.addReflectionClass or something else.

If I run it from Android Studio (somehow I managed to fix the out of memory error), I get this instead:

Have no idea what could be the problem. What java version are you using? I use java 8 to build my examples.

from gdx-teavm.

customautosys avatar customautosys commented on May 23, 2024

My jar is here: https://customautosys.com/tuxfight/download/TuxFight-0.0.1.jar

If you need the sources, do you have a BitBucket account? It's a private repo. I can grant you access for the purpose of improving your project if you keep it confidential (not open source).

I set the Android Studio JDK to Java 8.

Will try your suggestions tomorrow, thanks!

from gdx-teavm.

xpenatan avatar xpenatan commented on May 23, 2024

Nice game.

Yes, I have bitbucket arround, its https://bitbucket.org/xpenatan/

I tried to get any info of which class is crashing teavm but no go. Since it contains some features like MyAccount, I guess we need to disable some code to check what is causing the crash. Does this game works with GWT?

By Default, teavm skip classes if its not being called.

from gdx-teavm.

customautosys avatar customautosys commented on May 23, 2024

For some reason BitBucket is not allowing me to add you by name, can I have your email?

It worked on GWT SuperDev after commenting out all the code that used ea-async and auth0 (it kept saying sources not available despite me copying source files and creating gwt.xml). The dist build crashes mid-game: https://customautosys.com/tuxfight/web

from gdx-teavm.

xpenatan avatar xpenatan commented on May 23, 2024

Sure, its [email protected].

from gdx-teavm.

xpenatan avatar xpenatan commented on May 23, 2024

Hi @siauderman

I used the GWT branch and almost got it to compile. There is 1 issue that i cant get to work. which is the CompletableFuture class. GWT have a emulation lib but teavm does not have this class. I managed to commented out everything that use CompletableFutre but another issue popup.

I could only get the first loading screen to work. The assets are confusing, some assets are in root/asset folder while others are in core/main/images. If its possible to have everything in asset folder would be better.
image

from gdx-teavm.

customautosys avatar customautosys commented on May 23, 2024

The assets that are actually used by the game engine are in assets. Those in src are the original source image files before being packed with TexturePacker (they do not actually get bundled with the game).

Wait, TeaVM doesn't support CompletableFuture at all? Then it's not much better than GWT for me then (save maybe that I can use the Auth0 Java library - don't know if that'll work too). I was hoping to use it so that I would not have to rewrite all my ea-async code which uses await (it is "instrumented" which means the ea-async library modifies the bytecode during compile time to change all the await calls to multiple thenAcceptAsync calls with lambdas - works on both Android and desktop).

So ironic that JavaScript natively supports await, Java can support await with ea-async, but when we convert Java to JavaScript we can't use await!

from gdx-teavm.

xpenatan avatar xpenatan commented on May 23, 2024

I'll investigate it later to try to get the assets working. One step at a time.

GWT does not have CompletableFuture. OneGeek created a external lib to emulate it in GWT https://github.com/OneGeek/GWT-CompletableFuture. Someone may need to do it also for teavm.

teavm contains some classes from concurrent package but its not everything https://github.com/konsoletyper/teavm/tree/master/classlib/src/main/java/org/teavm/classlib/java/util/concurrent

If your game works in GWT, it will work with teavm also. But the issue is that if teavm is missing something, it needs to be implemented or ported from gwt.

from gdx-teavm.

customautosys avatar customautosys commented on May 23, 2024

I'll investigate it later to try to get the assets working. One step at a time.

GWT does not have CompletableFuture. OneGeek created a external lib to emulate it in GWT https://github.com/OneGeek/GWT-CompletableFuture. Someone may need to do it also for teavm.

teavm contains some classes from concurrent package but its not everything https://github.com/konsoletyper/teavm/tree/master/classlib/src/main/java/org/teavm/classlib/java/util/concurrent

If your game works in GWT, it will work with teavm also. But the issue is that if teavm is missing something, it needs to be implemented or ported from gwt.

Yes, I'm using that CompletableFuture implementation.

Have you tried cheerpj? Supposedly it supports the entire Java 8 API.

from gdx-teavm.

xpenatan avatar xpenatan commented on May 23, 2024

Hi @siauderman. I know about cheerpj but its not free.

The free part is evaluate and testing only. If you plan to export a html game for commercial purposes you need to pay =(
If you can convince them to let libgdx devs create games without issue I may take a look at.

from gdx-teavm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.