Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fpm fails to compile projects in parallel: Fortran runtime error: File cannot be deleted (2) #807

Closed
zoziha opened this issue Nov 28, 2022 · 1 comment · Fixed by #808
Closed
Assignees
Labels
bug Something isn't working regression Something isn't working that previously did work

Comments

@zoziha
Copy link
Contributor

zoziha commented Nov 28, 2022

Description

@LKedward, as we described in #707 and #708, even if OMP critical is added to fpm, the current fpm will still occasionally report similar errors (the frequency is greatly reduced) when compiling in parallel:

At line 689 of file ..\src\fpm_filesystem.F90
Fortran runtime error: File cannot be deleted

We didn't think it through at that time, but I think I found the reason for this error. The reason may be that the ar program is compiling the link library by the *.resp file, but execute_command_line didn't wait for this process and starts to delete the *.resp file, so an error occurrs, since *.resp file is occupied and can not be deleted!
A reasonable solution is to add a wait to execute_command_line and then return. Hope I didn't understand anything wrong.

Expected Behaviour

fpm build successfully.

Version of fpm

0.7.0

Platform and Architecture

All platform

Additional Information

I already have a PR on the way to fix this.

@zoziha zoziha added bug Something isn't working regression Something isn't working that previously did work labels Nov 28, 2022
@zoziha zoziha self-assigned this Nov 28, 2022
@zoziha
Copy link
Contributor Author

zoziha commented Feb 14, 2023

To track the solution, the final solution in #808 is:

Create a delete_file_win32 for Windows, it will delete the * .resp file normally, and ignore the returned error (iostat) if cannot delete the * .resp file, and overwrite (replace in open) the original * .resp the next time you run fpm build to generate * .resp.
The behavior of other systems has not changed, mainly to avoid the sudden strange experience of "File cannot be deleted" among Windows-fpm users. In fact, only Windows-fpm will use * .resp files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Something isn't working that previously did work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant