Error with Gradle 1.5 RC1

We just tried Gradle 15 RC1 and it fails on windows with following error:

15:57:07 Downloading http://services.gradle.org/distributions/gradle-1.5-rc-1-bin.zip 15:58:33 … 15:58:33 Unzipping C:\WINDOWS\system32\config\systemprofile.gradle\wrapper\dists\gradle-1.5-rc-1-bin\48r6habbfrmh4hqqss9ndrhba\gradle-1.5-rc-1-bin.zip to C:\WINDOWS\system32\config\systemprofile.gradle…\gradle-bin\gradle-1.5-rc-1-bin\48r6habbfrmh4hqqss9ndrhba 15:58:34

15:58:34 FAILURE: Build aborted because of an internal error. 15:58:34

15:58:34 * What went wrong: 15:58:34 Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org. 15:58:34

15:58:34 * Try: 15:58:34 Run with --debug option to get additional debug info. 15:58:34

15:58:34 * Exception is: 15:58:34 java.lang.UnsatisfiedLinkError: net.rubygrapefruit.platform.internal.jni.WindowsConsoleFunctions.isConsole(ILnet/rubygrapefruit/platform/internal/FunctionResult;)Z 15:58:34

at net.rubygrapefruit.platform.internal.jni.WindowsConsoleFunctions.isConsole(Native Method) 15:58:34

at net.rubygrapefruit.platform.internal.WindowsTerminals.isTerminal(WindowsTerminals.java:28) 15:58:34

at org.gradle.internal.nativeplatform.console.NativePlatformConsoleDetector.getConsole(NativePlatformConsoleDetector.java:39) 15:58:34

at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:32) 15:58:34

at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:27) 15:58:34

at org.gradle.logging.internal.OutputEventRenderer.attachConsole(OutputEventRenderer.java:68) 15:58:34

at org.gradle.logging.internal.DefaultLoggingManager.attachConsole(DefaultLoggingManager.java:149) 15:58:34

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:168) 15:58:34

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139) 15:58:34

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) 15:58:34

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) 15:58:34

at org.gradle.launcher.Main.doAction(Main.java:48) 15:58:34

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) 15:58:34

at org.gradle.launcher.Main.main(Main.java:39) 15:58:34

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 15:58:34

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 15:58:34

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 15:58:34

at java.lang.reflect.Method.invoke(Method.java:597) 15:58:34

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50) 15:58:34

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32) 15:58:34

at org.gradle.launcher.GradleMain.main(GradleMain.java:26) 15:58:34

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 15:58:34

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 15:58:34

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 15:58:34

at java.lang.reflect.Method.invoke(Method.java:597) 15:58:34

at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33) 15:58:34

at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130) 15:58:34

at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48) 15:58:34

15:58:34 Build step ‘Execute Windows batch command’ marked build as failure

It was working perfectly with 1.4. Any help is appreciated.

Hi, can you run (with Gradle 1.4) ‘gradle -v’ and send us the output. Also, the output of running Gradle 1.5-rc-1 with ‘–debug’ would be useful.

Sure.

E:\w\tr-gr_expweb_node6_0\trunk>call gradlew -v

17:36:01

17:36:01 ------------------------------------------------------------ 17:36:01 Gradle 1.4 17:36:01 ------------------------------------------------------------ 17:36:01

17:36:01 Gradle build time: Monday, January 28, 2013 3:42:46 AM UTC 17:36:01 Groovy: 1.8.6 17:36:01 Ant: Apache Ant™ version 1.8.4 compiled on May 22 2012 17:36:01 Ivy: 2.2.0 17:36:01 JVM: 1.6.0_29 (Sun Microsystems Inc. 20.4-b02) 17:36:01 OS: Windows 2003 5.2 amd64

17:40:36 E:\w\tr-grcl_expweb_node3_0\trunk>call gradlew --parallel -s --profile -Penv=ci clean build -Pp4Changelist=728059 --rerun-tasks --debug

17:40:37 17:42:40.541 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@664883c, org.gradle.logging.internal.logback.LogbackLoggingConfigurer@322c1e6b, org.gradle.logging.internal.JavaUtilLoggingConfigurer@6e811c88] 17:40:37 17:42:40.603 [DEBUG] [org.gradle.internal.nativeplatform.services.NativeServices] Unable to initialize native-platform. Failure: net.rubygrapefruit.platform.NativeException: Failed to load native library ‘native-platform-windows-amd64.dll’ for Windows 2003 amd64. 17:40:37 caused by: java.lang.UnsatisfiedLinkError: C:\Documents and Settings\Default User.gradle\native\15\native-platform-windows-amd64.dll: The specified procedure could not be found 17:40:37 17:42:40.619 [ERROR] [org.gradle.BuildExceptionReporter]

17:40:37 17:42:40.619 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build aborted because of an internal error. 17:40:37 17:42:40.619 [ERROR] [org.gradle.BuildExceptionReporter]

17:40:37 17:42:40.619 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 17:40:37 17:42:40.619 [ERROR] [org.gradle.BuildExceptionReporter] Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org. 17:40:37 Build step ‘Execute Windows batch command’ marked build as failure

Thanks for that. Would you mind downloading and running the test application for our native integration: http://repo.gradle.org/gradle/libs-releases-local/net/rubygrapefruit/native-platform-test/0.3-rc-2/native-platform-test-0.3-rc-2.zip

You just need to unzip this and run ‘bin/native-platform-test.bat’. You should get a bunch of information. I’m interested in whether this application succeeds or fails, and if it fails, what the stacktrace is.

Could you also run the test application for the version of native integration that we used in Gradle 1.4: http://repo.gradle.org/gradle/libs-releases-local/net/rubygrapefruit/native-platform-test/0.2/native-platform-test-0.2.zip

Here you go:

E:\w\tr-gr_expweb_node6_0\trunk\copied>cd 1.4

15:27:57

15:27:57 E:\w\tr-gr_expweb_node6_0\trunk\copied\1.4>cd bin

15:27:57

15:27:57 E:\w\tr-gr_expweb_node6_0\trunk\copied\1.4\bin>call native-platform-test.bat

15:27:57

15:27:57 * OS: Windows 2003 5.2 amd64 15:27:57 * JVM: Sun Microsystems Inc. 1.6.0_29 15:27:57 Exception in thread “main” net.rubygrapefruit.platform.NativeException: Failed to initialise native integration. 15:27:57

at net.rubygrapefruit.platform.Native.init(Native.java:50) 15:27:57

at net.rubygrapefruit.platform.Native.get(Native.java:67) 15:27:57

at net.rubygrapefruit.platform.test.Main.main(Main.java:35) 15:27:57 Caused by: java.lang.UnsatisfiedLinkError: C:\WINDOWS\Temp\native-platform222690752647507433dir\native-platform-windows-amd64.dll: The specified procedure could not be found 15:27:57

at java.lang.ClassLoader$NativeLibrary.load(Native Method) 15:27:57

at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807) 15:27:57

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703) 15:27:57

at java.lang.Runtime.load0(Runtime.java:770) 15:27:57

at java.lang.System.load(System.java:1003) 15:27:57

at net.rubygrapefruit.platform.Native.init(Native.java:41) 15:27:57

… 2 more 15:27:57

15:27:58

E:\w\tr-gr_expweb_node6_0\trunk\copied>cd 1.5

15:29:23

15:29:23 E:\w\tr-gr_expweb_node6_0\trunk\copied\1.5>cd bin

15:29:23

15:29:23 E:\w\tr-gr_expweb_node6_0\trunk\copied\1.5\bin>call native-platform-test.bat

15:29:23

15:29:23 * OS: Windows 2003 5.2 amd64 15:29:23 * JVM: Sun Microsystems Inc. 1.6.0_29 15:29:23 * Encoding: Cp1252 15:29:24 Exception in thread “main” net.rubygrapefruit.platform.NativeException: Failed to load native library ‘native-platform-windows-amd64.dll’ for Windows 2003 amd64. 15:29:24

at net.rubygrapefruit.platform.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:49) 15:29:24

at net.rubygrapefruit.platform.Native.init(Native.java:55) 15:29:24

at net.rubygrapefruit.platform.Native.get(Native.java:80) 15:29:24

at net.rubygrapefruit.platform.test.Main.main(Main.java:52) 15:29:24 Caused by: java.lang.UnsatisfiedLinkError: C:\WINDOWS\Temp\native-platform8769373858645699475dir\native-platform-windows-amd64.dll: The specified procedure could not be found 15:29:24

at java.lang.ClassLoader$NativeLibrary.load(Native Method) 15:29:24

at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807) 15:29:24

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703) 15:29:24

at java.lang.Runtime.load0(Runtime.java:770) 15:29:24

at java.lang.System.load(System.java:1003) 15:29:24

at net.rubygrapefruit.platform.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:45) 15:29:24

… 3 more 15:29:24 Build step ‘Execute Windows batch command’ marked build as failure 15:29:24 [htmlpublisher] Archiving HTML reports…

Thanks for that. How are you actually running Gradle? From the command-line? via some CI server? Something else?

btw, a workaround for this problem is to set the GRADLE_OPTS environment variable to ‘-Dorg.gradle.native=false’ when running Gradle. This will disable the native integration entirely, but this really only has an effect on windows when you’re using the Gradle daemon.

Yeah, we are running it through Jenkins on CI servers. I believe there is windows batch command build action which then calls gradlew.

I will try -Dorg.gradle.native=false and see if that works. Thanks for your help.

Could you try running gradle 1.5 from the command-line on the machine where it’s failing and see if it’s working from the command-line (it may be related to the fact that jenkins will be running as a service)? Or run Gradle 1.5 on some other windows machine in your environment?

Will this work through command line?

gradlew build -Dorg.gradle.native=false

No, the property needs to be set very early in the build startup, so it needs to be done with the GRADLE_OPTS environment variable.

Is it possible that you could try running Gradle with a 32-bit jvm instead of the 64-bit jvm?

Unfortunately I can’t access CI servers except through Jenkins admin console. Gradle 1.5 works nicely on intel windows machines. So, this looks like be an issue with either running through Jenkins service or running on AMD.

I am trying to get access to an AMD machine in our farm. I am not sure how soon I can get that access though.

No problem. Thanks for all your help with this issue.

I tried from command line on one of these machines and it failed with same error. 1.4 works fine.

BTW, these machines are VMWare virtual machine platform, dual core AMD opteron with windows server 2003 SP2 installed.

Could you give this snapshot build a try: http://services.gradle.org/distributions-snapshots/gradle-1.5-20130315085205+0000-bin.zip

It should fix the problem you are seeing.

Yep. This snapshot works.

Great. Thanks for your help.