fpm icon indicating copy to clipboard operation
fpm copied to clipboard

cache.toml cannot be found

Open davidpfister opened this issue 5 months ago • 2 comments

Description

While building and running fpm-modules, I noticed that my code stopped working while it used to work with version v0.12.0.

According to the runtime error, the 'cache.toml cannot be found'

I spotted the difference below that could explain the problem. Image

While I can fix this easily on my end, would it be possible to initiate the value of the build folder to 'build' and ensure backward compatibility?

Expected Behaviour

The build folder should be initialized to some default value (e.g. 'build')

Version of fpm

main

Platform and Architecture

Windows 10

Additional Information

No response

davidpfister avatar Sep 23 '25 16:09 davidpfister

Thank you for posting this @davidpfister - Looking at the code, I see the fpm_build_settings are properly validated on CLI initialization, which is the expected behavior. However, you may be getting an empty build directory because you're building the structure yourself. Because the build-directory feature will be officially released in the upcoming release, perhaps a solution for you would be to pinpoint the fpm dependency to 0.12.0. Otherwise, what solution would you propose? I would avoid introducing final procedures at least until all compilers support them robustly.

perazz avatar Sep 24 '25 06:09 perazz

@perazz, indeed, I embedded fpm for building the dependency tree, and therefore, I am building the model myself. For the moment, I have already done what you proposed and targeted explicitly the version v0.12.0. As a safeguard, you could add

if (len_trim(settings%build_dir) == 0) settings%build_dir = 'build'

at line 46 in the screenshot. (or check the allocation status, whatever is best)

Of course, once released I will change my code and add an explicit location for the build_dir

davidpfister avatar Sep 24 '25 07:09 davidpfister