[GRADLE-2459] LibCBackedTerminalDetector throws exception on JamVM Created: 31/Aug/12  Updated: 04/Jan/13  Resolved: 14/Dec/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0
Fix Version/s: 1.3-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Fixed Votes: 0


 Description   

Hi,
I'm trying to integrate a java library into an embedded system. I'm currently using gradle 1.0 and my native environment has JamVM as the virtual machine. This is a thin native environment suitable for building openjdk for the target.

java -v reports something like this:

java version "1.5.0"
JamVM version 1.6.0-devel
Copyright (C) 2003-2012 Robert Lougher

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2,
or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

Build information:

Execution Engine: inline-threaded interpreter with stack-caching
Compiled with: gcc 4.6.1

Boot Library Path: /home/gizero/Documents/research/denzil-build/tmp/sysroots/i686-linux/usr/lib/classpath
Boot Class Path: /home/gizero/Documents/research/denzil-build/tmp/sysroots/i686-linux/usr/share/jamvm/classes.zip:/home/gizero/Documents/research/denzil-build/tmp/sysroots/i686-linux/usr/share/classpath/glibj.zip

This environment causes gradle to except even on a simple "gradle -v" as follows:

FAILURE: Build aborted because of an internal error.

  • What went wrong:
    Build aborted because of an unexpected internal error. Please file an issue at: [1]http://forums.gradle.org.
  • Try:
    Run with --debug option to get additional debug info.
  • Exception is:
    org.gradle.internal.UncheckedException: java.lang.NoSuchFieldException
    at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:39)
    at org.gradle.internal.nativeplatform.jna.LibCBackedTerminalDetector.isTerminal(LibCBackedTerminalDetector.java:39)
    at org.gradle.logging.internal.OutputEventRenderer.addStandardOutputAndError(OutputEventRenderer.java:54)
    at org.gradle.logging.LoggingServiceRegistry.createOutputEventRenderer(LoggingServiceRegistry.java:131)
    at java.lang.reflect.VMMethod.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:327)
    at org.gradle.internal.service.DefaultServiceRegistry.invoke(DefaultServiceRegistry.java:179)
    at org.gradle.internal.service.DefaultServiceRegistry.access$300(DefaultServiceRegistry.java:47)
    at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.create(DefaultServiceRegistry.java:340)
    at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:244)
    at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.getService(DefaultServiceRegistry.java:279)
    at org.gradle.internal.service.DefaultServiceRegistry$OwnServices.getService(DefaultServiceRegistry.java:219)
    at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:145)
    at org.gradle.logging.LoggingServiceRegistry.(LoggingServiceRegistry.java:46)
    at org.gradle.logging.LoggingServiceRegistry.newCommandLineProcessLogging(LoggingServiceRegistry.java:53)
    at org.gradle.launcher.cli.CommandLineActionFactory.createLoggingServices(CommandLineActionFactory.java:74)
    at org.gradle.launcher.cli.CommandLineActionFactory.convert(CommandLineActionFactory.java:54)
    at org.gradle.launcher.Main.doAction(Main.java:48)
    at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:45)
    at org.gradle.launcher.Main.main(Main.java:39)
    at java.lang.reflect.VMMethod.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:327)
    at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
    at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:32)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
    Caused by: java.lang.NoSuchFieldException
    at java.lang.Class.getDeclaredField(Class.java:458)
    at org.gradle.internal.nativeplatform.jna.LibCBackedTerminalDetector.isTerminal(LibCBackedTerminalDetector.java:35)
    ...23 more

Any idea how to further debug this? It looks like something wrong happening at the very beginning of execution. Running with --debug as suggested does not add any information.

TIA
Andrea
----------------------------------------------------------------------------------------
[1] http://forums.gradle.org



 Comments   
Comment by Peter Niederwieser [ 31/Aug/12 ]

LibCBackedTerminalDetector.isTerminal() makes the assumption that java.io.FileDescriptor declares a (private) field named "fd", and blows up otherwise (rather than, say, returning 'false'). Apparently this isn't true for all platforms.

Comment by Andrea Galbusera [ 31/Aug/12 ]

One more bit that may help: JamVM showing the problem is using GNU Classpath 0.99.
More testing showed that the problem is not reproducible with a different instance of JamVM (from icedtea-6-jre-jamvm) that runs smoothly on my Ubuntu host with:

$JAVA_OPTS=-jamvm gradle -v

------------------------------------------------------------
Gradle 1.0
------------------------------------------------------------

Gradle build time: Tuesday, June 12, 2012 12:56:21 AM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_24 (Robert Lougher 1.6.0-devel)
OS: Linux 3.0.0-24-generic i386

Comment by Adam Murdoch [ 20/Nov/12 ]

This should be fixed in 1.3. Can you give it a try and let us know the fix works for you or not? Thanks.

Comment by Andrea Galbusera [ 14/Dec/12 ]

Adam,
Sorry for the delay in replying to you, but I was busy and away from this project for some time. Good news is I can confirm that the issue with LibCBackedTerminalDetector is solved in 1.3.
Unfortunately, I can't get much further when running gradle with JamVM and GNU Classpath: seems a different and unrelated problem. If I can't get past of it, I'll file a new bug with the relevant trace.

Generated at Wed Jun 30 12:22:29 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.