frcUserProgram file exists error on link

Hi All,

I am a new programming mentor. I know c++, but not gradle. Our build works on all of our laptops except mine. Mine was working until about a month ago. (I have no idea what changed).

I now consistently get a link error that the frcUserProgram executable exists. I have deleted the entire contents of the build directory & retried with the same results. When I look at the build/tmp/compile & link logs for both debug and release output.txt everything says successful. My object files, executables have the correct build time.

I suspect a gradle race condition on writing/renaming the executable files, but I don’t know gradle well enough debug or confirm this or even how to begin to fix this problem or what to check. I would greatly appreciate any advice/help/thoughts you all may have to help me resolve.

Thanks in advance!

Try running the gradlew command with the --info switch to see the commands that are being executed and hopefully see the command that is trying to do the rename. That way you can see both filenames involved in the rename operation and check out the status of the one that is not named in the output that you’re seeing.

Can you post your code? I’ve seen this happen if nothing actually gets linked into the executable, for instance if the source files got moved.


Running the build from the command line by selecting run gradle command and typing build --info, shows all of my object files being created successfully & I do see those objects in the build directory.

I see the link fail with:
arm-frc2020-linux-gnueabi-strip.exe unable to rename ‘…Robot2020\build\exe\frcUserProgram\debug\frcUserProgram’; reason: file exists

In build\exe I only have a debug directory, no release directory and in the debug directory I have both frcUserProgram and frcUserProgram.debug

I think on one of the times I tried running from gradle command line, I saw a permission denied error, but I cannot recreate that. It seems like the build should have created a release directory under build\exe?

I did check file system permission between a working laptop & mine & can’t find any differences in permissions from our user directory down.

I did try to uninstall and reinstall everything related to wpilib and frc, but I get the same error, so I am definitely missing something or there is an environment error on my machine.

The tmp…\output.txt files don’t indicate any errors.

I am at a loss for what to try next. I really don’t care if we have a debug version of the executable - we haven’t run the debugger on our robot code, so if I could change it to never create a debug version and only create a release executable, I would be really happy - I don’t really understand the gradle or json files enough to know how to do that.

I appreciate any thoughts you may have…

I don’t really understand? It’s our whole robot - commands, subsystems etc. A lot of files, because we actually do have a working robot. It definitely compiles/links/deploys onto the roborio from our other laptops. I see all the object files for all of .cpp files.

I haven’t changed any file that gets generated. We did a create new project and we use create new command and create new subsystem to add to our robot. We did add some vendordeps for the color sensor and phoenix talonSRX motor controllers.

What code would help? I also do see an executable created in build\exe\frcUserProgram\debug (both frcUserProgram & frcUserProgram.debug) just no build\exe\frcUserProgram\release directory, which I believe is supposed to be created?

I made sure non of our code generates any compiler warnings.

Have you tried deleting the build\exe directory?


I actually did & I got the same cannot rename/file exists error. So I decided to really read about gradle using the gradle docs pdf.

Using wpi->run a gradle command->tasks
I got it to list all of the defined gradle tasks. I did a clean and then I tried to rebuild the build environment, to make sure there was nothing dumb in my setup. All of those gradle commands work. It is really just the rename of the executable that fails, so I tried doing that copy & rename myself in windows explorer. That worked & I did a gradle check on the executables, which was successful. I am going to try to deploy my executable on the roborio at our next meeting & see if it works - that way I will actually know if my link is successful, because it really does look like it is. If that works, then I think this is some weird windows 10 permissions/user problem. I must say - I am a linux fan…

Thanks for all your help. I’ll write back on the deploy status. The fact that no one else has chimed in with “I get that problem also” really leads me to think there is just something dumb messed up on my individual laptop. On the upside - I am reading the gradle and VSCode documentation, which can never hurt!