Error when using "fpm build"

I’m getting the following error when using “fpm build”:

cmd_build Package error: Key test is not allowed in install table

The code was running without problems and all of a sudden this error showed up. One thing I did was using the command “pip install fortls”. I’m not sure is correlated, but it may be a cause of the problem.

@igor-inoue.ufv welcome to the forum!

If the code is open source, go ahead and post instructions how to reproduce it.

If it is not open source, you can try to create a minimal reproducible example (MRE) that shows the above error, and post it here, and we can try to fix it.

Otherwise you can also see the source code of fpm and try to figure out why that is happening. Or wait if anybody else has seen this error as well and knows what the problem might be.

This is the github repository: GitHub - igor-inoue/trabalho_1

It’s a numeric integration code, the comments are in portuguese.

The reproducer would indeed make it easier to diagnose but that looks like a typo in the fpm.toml OR a typo in an fpm.toml file in the dependencies; or that you moved or changed somehing that that made the build cache information incorrect. First, remove the build/ directory and retry. If there is still a problem did you recently change the fpm.toml file? If the code is not available publically if you can post the fpm.toml file the odds are that is where the problem is. The version of fpm (fpm --version) would be useful to know as well.

I answered in the previous reply the github repository where the code is located, so if I did everything right, you should be able to access the fpm.toml file there.

When the error showed up, I searched in the forum and that was one of the hypothesis. So I used “fpm clean” to delete the build paste and then used “fpm build” again but it didn’t work. I restored the fpm.toml to the original state and did this process again, but the error still happened.

All this process is not registered through commits in the github repository.

fpm clean --all

or it leaves the dependencies in place. I pulled the repo and it builds fine with a recent version of fpm.

Initialized empty Git repository in /tmp/trabalho_1/build/dependencies/tictoc-fortran/.git/
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 8 (delta 0), reused 4 (delta 0), pack-reused 0 (from 0)
Unpacking objects: 100% (8/8), 1.91 KiB | 65.00 KiB/s, done.
From https://github.com/wcota/tictoc-fortran
 * branch            HEAD       -> FETCH_HEAD
m_funcao.f90                           done.
m_limites.f90                          done.
m_n.f90                                done.
tictoc.f90                             done.
m_integral.f90                         done.
libtrabalho_1.a                        done.
main.f90                               done.
trabalho_1                             done.
[100%] Project compiled successfully.

That’s weird, so the problem is probably in my computer right? I’ll try this command you suggested. Thanks for your help!

The problem is still happening. Before writing the post, a deleted by hand the build paste, now when i used the “fpm clean -all” command is says:
fpm: No build directory found.

Then, when I used “fpm build”, it still says:
cmd_build Package error: Key test is not allowed in install table
STOP 1

Does not seem to be the problem here, but to avoid issues where the change in a dependency might cause an issue like this it is generally recommended to add a specific version to the dependency such as in

name = "trabalho_1"
version = "0.1.0"
license = "license"
author = "igor-inoue"
maintainer = "igor.inoue@ufv.br"
copyright = "Copyright 2024, igor-inoue"
[build]
   auto-executables = true
   auto-tests = true
   auto-examples = true
   module-naming = false
[install]
   library = false
   test = false
[fortran]
   implicit-typing = false
   implicit-external = false
   source-form = "free"
[dependencies]
   tictoc-fortran.git = "https://github.com/wcota/tictoc-fortran"
   tictoc-fortran.rev = "47d8131ea94eb9152ac0153bb1a88fd33444c461"

so if you pull your own repo down into a scratch area and do “fpm build” it generates that error?
How old is the version of fpm(1) you are using? If you move the fpm.toml file to fpm.toml.hold and
enter “fpm new . --backfill” it will generate a new fpm.toml file that is compatible with the fpm you are using. Then add the dependencies from the old one to the new fpm.toml and do “fpm clean --all;fpm build --verbose”.

“fpm new . --backfill”
This command worked! Thank you very much, you were of much help!

No problem. That implies there is a typo in the original fpm.toml you had not pushed to the github repo or that you were using a version of fpm incompatible with your fpm.toml file. So it is always better to wonder what was causing a problem instead of what is causing one but

diff fpm.toml fpm.toml.hold
which fpm
fpm --versio 

might edify what the root cause was.

One possibility is the fpm command is pointing to a different older version than it was, in which case the proposals to add versioning to the manifest file so it is possible to detect when a manifest file might be incompatible with the available fpm command; or that it was
a typo in the file and perhaps a plug-in could be made (or changes to fpm itself) that would diagnose the problem a bit more clearly. It is often useful to know the root cause as it can help develop fpm to make it easier for those who come later.

So when you were installing new packages lately, did any of them bundle in an old fpm command? The “which” command might show if that is the case.

The “diff” command (assuming you are on GNU/Linux or Unix) would show the differences between the working and defunct fpm.toml files, which would probably clarify if there is a typo or version incompatibility between the file and fpm.

1 Like