[GRADLE-2374] Chmod not found when running under Windows Created: 07/Jul/12  Updated: 04/Jan/13  Resolved: 18/Jul/12

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

Type: Bug
Reporter: Gradle Forums Assignee: René Gröschke (Inactive)
Resolution: Fixed Votes: 0


 Description   

Following repeatedly getting this error in a large multi Java project on a Windows XP PC, I've created a simple build.gradle containing only the line

apply plugin: 'java'

in a project which is empty.

Running gradle build gives the following stack trace. My Java version is 1.6.0_31, Gradle version is 1.0 rc 3:

  • Exception is:
    java.lang.UnsatisfiedLinkError: Error looking up function 'chmod': The specified procedure could not be found.

at com.sun.jna.Function.(Function.java:179)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:344)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:324)
at com.sun.jna.Library$Handler.invoke(Library.java:203)
at $Proxy3.chmod(Unknown Source)
at org.gradle.internal.nativeplatform.filesystem.FilePermissionHandlerFactory$LibcChmod.chmod(FilePermissionHandlerFactory.java:67)
at org.gradle.internal.nativeplatform.filesystem.ComposableFilePermissionHandler.chmod(ComposableFilePermissionHandler.java:38)
at org.gradle.internal.nativeplatform.filesystem.GenericFileSystem.chmod(GenericFileSystem.java:64)
at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:65)
at org.gradle.api.internal.file.collections.MapFileTree$FileVisitDetailsImpl.getFile(MapFileTree.java:133)
at org.gradle.api.internal.file.AbstractFileTree$1.visitFile(AbstractFileTree.java:39)
at org.gradle.api.internal.file.AbstractFileTree$FilteredFileTree$1.visitFile(AbstractFileTree.java:145)
at org.gradle.api.internal.file.collections.MapFileTree$Visit.visit(MapFileTree.java:103)
at org.gradle.api.internal.file.collections.MapFileTree.visit(MapFileTree.java:70)
at org.gradle.api.internal.file.collections.FileTreeAdapter.visit(FileTreeAdapter.java:96)
at org.gradle.api.internal.file.AbstractFileTree$FilteredFileTree.visit(AbstractFileTree.java:136)
at org.gradle.api.internal.file.AbstractFileTree.getFiles(AbstractFileTree.java:37)
at org.gradle.api.internal.file.CompositeFileCollection.getFiles(CompositeFileCollection.java:39)
at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:60)
at org.gradle.api.internal.changedetection.DefaultFileSnapshotter.snapshot(DefaultFileSnapshotter.java:42)
at org.gradle.api.internal.changedetection.InputFilesChangedUpToDateRule.create(InputFilesChangedUpToDateRule.java:35)
at org.gradle.api.internal.changedetection.CompositeUpToDateRule.create(CompositeUpToDateRule.java:35)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.calcCurrentState(DefaultTaskArtifactStateRepository.java
:80)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.isUpToDate(DefaultTaskArtifactStateRepository.java:88)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:1
28)
at org.gradle.api.internal.changedetection.ShortCircuitTaskArtifactStateRepository$ShortCircuitArtifactState.isUpToDate(ShortCircuitTaskArtifactStateRep
ository.java:77)
at org.gradle.api.internal.changedetection.FileCacheBroadcastTaskArtifactStateRepository$1.isUpToDate(FileCacheBroadcastTaskArtifactStateRepository.java
:37)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)
at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:31)
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:20)
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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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)

BUILD FAILED

Total time: 3.359 secs



 Comments   
Comment by Gradle Forums [ 07/Jul/12 ]

for setting file permissions, gradle tries to load a jna implementation of chmod. The expected behaviour on windows is, that loading the native jna library via Native#loadLibrary already fails and Gradle falls back to a emptychmod implementation. I have tested this on windows 7. Unfortunately I have no windows xp system available to double check this. Can you do me a favour and run

import org.gradle.internal.nativeplatform.jna.LibC;
import com.sun.jna.Native;
LibC libc = (LibC) Native.loadLibrary("c", LibC.class);

On my windows 7 machine, this results in a LinkageError, which is also the expected behaviour for winxp.

regards,
René

Comment by Gradle Forums [ 07/Jul/12 ]

Running this code on a Windows XP PC gives no error - I added a System.out.println after the call to print out the value libc and get
"Proxy interface to Native Library ."
I can confirm that running on a Windows 7 PC gives the expected UnsatsifiedLinkError.
Unfortunately, the PCs we run at the office are on XP so switching to Windows 7 is not an option!

Comment by Gradle Forums [ 07/Jul/12 ]

Is there anything further I can do on this - this is preventing a move to Gradle 1.0. Thanks

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