ibinti / bugvm

This is BugVM
352 stars 51 forks source link

Bug in compiler (libimobiledevice) #55

Closed chancezeus closed 8 years ago

chancezeus commented 8 years ago

Don't know if this is the proper place to report this, but I was experimenting with BugVM as a replacement for RoboVM as a libgdx backend and found the following error when trying to run the app on an iOS device (from terminal and using the IntelliJ plugin):

The first time I tried it i got (using gradle):

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':ios:launchIOSDevice'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.api.GradleException: Failed to launch IOS Device
    at com.bugvm.gradle.tasks.IOSDeviceTask.invoke(IOSDeviceTask.java:48)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 68 more
Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/p6/ghlmdb6s1fqdgxsj9my51dl80000gp/T/libbugvm-libimobiledevice2549668769138588128.dylib: dlopen(/private/var/folders/p6/ghlmdb6s1fqdgxsj9my51dl80000gp/T/libbugvm-libimobiledevice2549668769138588128.dylib, 1): Library not loaded: /usr/local/opt/gnutls/lib/libgnutls.28.dylib
  Referenced from: /private/var/folders/p6/ghlmdb6s1fqdgxsj9my51dl80000gp/T/libbugvm-libimobiledevice2549668769138588128.dylib
  Reason: image not found
    at com.bugvm.libimobiledevice.NativeLibrary.load(NativeLibrary.java:90)
    at com.bugvm.libimobiledevice.binding.LibIMobileDeviceJNI.<clinit>(LibIMobileDeviceJNI.java:191)
    at com.bugvm.libimobiledevice.binding.StringArrayOut.<init>(StringArrayOut.java:44)
    at com.bugvm.libimobiledevice.IDevice.listUdids(IDevice.java:136)
    at com.bugvm.compiler.target.ios.IOSTarget.createIOSDevLauncher(IOSTarget.java:262)
    at com.bugvm.compiler.target.ios.IOSTarget.createLauncher(IOSTarget.java:152)
    at com.bugvm.compiler.target.AbstractTarget.doLaunch(AbstractTarget.java:490)
    at com.bugvm.compiler.target.ios.IOSTarget.doLaunch(IOSTarget.java:604)
    at com.bugvm.compiler.target.AbstractTarget.launch(AbstractTarget.java:486)
    at com.bugvm.compiler.AppCompiler.launchAsync(AppCompiler.java:827)
    at com.bugvm.compiler.AppCompiler.launch(AppCompiler.java:812)
    at com.bugvm.compiler.AppCompiler.launch(AppCompiler.java:807)
    at com.bugvm.gradle.tasks.IOSDeviceTask.invoke(IOSDeviceTask.java:46)
    ... 76 more

So I installed gnutls using brew (brew install gnutls), expecting to solve the problem. The error remained...

I forced the gnutls recipe to use the latest gnutls 3.3 I could find on the homebrew github (since the referenced library name is /usr/local/opt/gnutls/lib/libgnutls.28.dylib, which is available in the 3.3 version of gnutls and not in the 3.4 version). The error disappeared, but now I get a NoClassDefFoundError: could not initialize class com.robovm.libimobiledevice.binding.LibIMobileDevice which probably means that there still is an error while initializating the native libimobiledevice library.

I'm wondering if anyone can point me in the right direction to solve this...

Personally I think that if the native libimobiledevice library depends so critically on this (gnutls) library, it should be included within the bugvm-sdk, to ensure it's (a) always available and (b) the proper version?

ibinti commented 8 years ago

Weird, you got NoClassDefFoundError: could not initialize class com.robovm.libimobiledevice.binding.LibIMobileDevice

For obvious reason, BugVM does not have class for com.robovm.libimobiledevice.binding.LibIMobileDevice

need some investigation.

chancezeus commented 8 years ago

According to some research NoClassDefFoundError actually means that the class itself could be found but not instantiated (because there was an error in a static initializer for example)... The error for a class that could not be found is ClassNotFoundException

ibinti commented 8 years ago

It can't be. The class itself does not exist as its namespace is com.robovm.* com.bugvm.libimobiledevice.binding.LibIMobileDevice does exist instead.

There must be some mix-up calling robovm instead of bugvm. very strange...

ibinti commented 8 years ago

similar to #58

ibinti commented 8 years ago

similar to #46

ibinti commented 8 years ago

Follow the issue #46 and join the discussion.