[SOLVED] Jbuilder error "Error: I don't know about package"



Hi folks,

I have a package that I updated to build with jbuilder. Before I made the pull request to the opam-repository I wanted to test it so I forked opam-repository and I add as a a remote.

When trying to install the package with opam I get:

# Error: I don't know about package pla (passed through --only-packages/--release)

but the package builds correctly when I do

$ jbuilder build
$ jbuilder install

and also when I run the install command specified in the opam file

$ jbuilder build -p pla -j 1

The code of my package is here https://github.com/modlfo/pla and my forked opam repository is here https://github.com/modlfo/opam-repository/tree/master/packages/pla/pla.1.2

Maybe I’m doing something stupid or I’m forgetting something.



This is a common mistake about the -p option. The way to think about -p (in fact, it literally works this way) is that it makes only the listed packages under -p visible to jbuilder. In your case, that means everything but pla should be invisible.

What you’re probably looking for is a way to only build a particular package. To do you should simply pass the appropriate targets to $ jbuilder build. In your case, pla.install could work, or you could select a particular cma or binary. IMO, this is a bit of a usability issue with jbuilder today so feel free to mention this issue in the appropriate issue so that it can be fixed.


Thank you for your answer. I works correctly now.

From the manual I got the impression that one should always used the -p option as stated in: https://jbuilder.readthedocs.io/en/latest/usage.html#invocation-from-opam



When jbuilder is building a package for opam, it should build it against the installed packages rather than the other local packages in the source directory. This is why -p is mandatory in opam builds.