conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.11k stars 964 forks source link

[question] "ERROR: 'Catch2' cannot be found in lockfile for this package" #6083

Closed DavidZemon closed 4 years ago

DavidZemon commented 4 years ago

At first, I thought I understood exactly what this error meant. I thought it meant "you need to add Catch2 to your lock file," which I assumed would best be done by adding it to the recipe. So I did. But the error didn't go away. Can you help me out?

Please note the --build '*' in the conan install ... command. We added this as an option to our firmware project as a way for the CI server to (every so slowly) verify that all of the packages work together, while developers can build complete firmware packages locally and quickly.

This is Conan version 1.20.3 with Python 3 on Linux.

The error:

conan install --install-folder /home/david/reusable/Documents/Programming/RedLion/base/.cache/conan/s5t/ --lockfile /home/david/reusable/Documents/Programming/RedLion/base/targets/s5t/conan/conan.lock --update  --profile /home/david/reusable/Documents/Programming/RedLion/base/targets/s5t/conan/profile  --build '*' /home/david/reusable/Documents/Programming/RedLion/base/.cache/conan/s5t/conanfile.txt
Using lockfile: '/home/david/reusable/Documents/Programming/RedLion/base/targets/s5t/conan/conan.lock'
Configuration:
[settings]
arch=armv7hf
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux
os_build=Linux
platform=sitara
[options]
[build_requires]
[env]

Catch2/2.6.1@catchorg/stable: Forced build from source
cJSON/1.7.0@wsbu/stable: Forced build from source
esp-idf/3.1.3004@wsbu/stable: Forced build from source
googletest/1.8.1@wsbu/stable: Forced build from source
iodb/2.3.1@wsbu/stable: Forced build from source
linux/4.9.119@wsbu/stable: Forced build from source
wsbu-docgen/0.1.3@wsbu/stable: Forced build from source
ERROR: 'Catch2' cannot be found in lockfile for this package
Make sure it was locked with --build arguments while creating lockfile

The recipe being used:

david@balrog:~/reusable/Documents/Programming/RedLion/base$ cat /home/david/reusable/Documents/Programming/RedLion/base/.cache/conan/s5t/conanfile.txt
[requires]
Catch2/2.6.1@catchorg/stable#0
cJSON/1.7.0@wsbu/stable#8015fa7ba346d318e29ffb0ef2ce5b01
esp-idf/3.1.3004@wsbu/stable#bfeacbaf0da7613d75aa164ecfdd5b17
googletest/1.8.1@wsbu/stable
iodb/2.3.1@wsbu/stable#5481b8d7a83e2c08c0c507e6151499af
linux/4.9.119@wsbu/stable#2df0cc52a6a94aae8049f01f133b1f19
wsbu-docgen/0.1.3@wsbu/stable

And the lockfile:

{
 "profile_host": "[settings]\narch=armv7hf\narch_build=x86_64\nbuild_type=Release\ncompiler=gcc\ncompiler.libcxx=libstdc++11\ncompiler.version=7\nos=Linux\nos_build=Linux\nplatform=sitara\n[options]\n[build_requires]\n[env]\n",
 "graph_lock": {
  "nodes": {
   "c6b003cf-07c8-11ea-bdee-a38038f50010": {
    "pref": "cJSON/1.7.0@wsbu/stable#8015fa7ba346d318e29ffb0ef2ce5b01:f576e5b9d63ca3a96f350e00218d1fba5d292dd4#c587189378a625cc7474f437e07e48d6",
    "options": "shared=True\ntest=True"
   },
   "c6b003d0-07c8-11ea-bdee-a38038f50010": {
    "pref": "googletest/1.8.1@wsbu/stable#76b5d3f2d6d39ba4fb4e2dbb7952c1af:09a5aca59994424cb00fe5de5f037b562a308fef#69f263a2a99df5b0f5952cb29cfbbc40",
    "options": "run_tests=False\nshared=False"
   },
   "c6b003d6-07c8-11ea-bdee-a38038f50010": {
    "pref": null,
    "options": "cJSON:shared=True\ncJSON:test=True\ngoogletest:run_tests=False\ngoogletest:shared=False\niodb:build_modsim=True\niodb:public_docs=False\niodb:shared=True\niodb:with_docs=True\nlinux:install_source=True",
    "requires": {
     "Catch2/2.6.1@catchorg/stable#0": "c6b003d1-07c8-11ea-bdee-a38038f50010",
     "cJSON/1.7.0@wsbu/stable#8015fa7ba346d318e29ffb0ef2ce5b01": "c6b003cf-07c8-11ea-bdee-a38038f50010",
     "esp-idf/3.1.3004@wsbu/stable#bfeacbaf0da7613d75aa164ecfdd5b17": "c6b003d2-07c8-11ea-bdee-a38038f50010",
     "googletest/1.8.1@wsbu/stable#76b5d3f2d6d39ba4fb4e2dbb7952c1af": "c6b003d0-07c8-11ea-bdee-a38038f50010",
     "iodb/2.3.1@wsbu/stable#5481b8d7a83e2c08c0c507e6151499af": "c6b003d3-07c8-11ea-bdee-a38038f50010",
     "linux/4.9.119@wsbu/stable#2df0cc52a6a94aae8049f01f133b1f19": "c6b003d4-07c8-11ea-bdee-a38038f50010",
     "wsbu-docgen/0.1.3@wsbu/stable#d85759233340fc32cc4127c5afeba471": "c6b003d5-07c8-11ea-bdee-a38038f50010"
    },
    "path": "/home/david/reusable/Documents/Programming/RedLion/base/.cache/conan/s5t/conanfile.txt"
   },
   "c6b003d3-07c8-11ea-bdee-a38038f50010": {
    "pref": "iodb/2.3.1@wsbu/stable#5481b8d7a83e2c08c0c507e6151499af:fb7050f1c2ebbdccd6142c43cdd4ddcaa44891ca#b8d1ff8ad1cd574a7d3812470f9ccb52",
    "options": "build_modsim=True\npublic_docs=False\nshared=True\nwith_docs=True"
   },
   "c6b003d2-07c8-11ea-bdee-a38038f50010": {
    "pref": "esp-idf/3.1.3004@wsbu/stable#bfeacbaf0da7613d75aa164ecfdd5b17:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9#6415b3613a8b760068d7028fdab17a62",
    "options": ""
   },
   "c6b003d4-07c8-11ea-bdee-a38038f50010": {
    "pref": "linux/4.9.119@wsbu/stable#2df0cc52a6a94aae8049f01f133b1f19:01de722bad232946f9b792f33249c157fb84c24c#26f570535a9d888c771c54d7b95c245a",
    "options": "install_source=True"
   },
   "c6b003d5-07c8-11ea-bdee-a38038f50010": {
    "pref": "wsbu-docgen/0.1.3@wsbu/stable#d85759233340fc32cc4127c5afeba471:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9#217ff4562fbf2b661907c13d29c6c14c",
    "options": ""
   },
   "c6b003d1-07c8-11ea-bdee-a38038f50010": {
    "pref": "Catch2/2.6.1@catchorg/stable#0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9#d48a76d28267e1f74aecd3471b9f487f",
    "options": ""
   }
  }
 },
 "version": "0.1"
}
DavidZemon commented 4 years ago

Oh, and btw, if I do conan install ... for the iodb package, that's shows you why Catch2 was getting pulled in:

...
...
conanfile.py (iodb/2.3.1): Installing package
Requirements
Packages
Build requirements
    Catch2/2.6.1@catchorg/stable from 'rlc' - Cache
    googletest/1.8.1@wsbu/stable from 'rlc' - Cache
    wsbu-docgen/0.1.3@wsbu/stable from 'rlc' - Cache
...
...
theodelrieu commented 4 years ago

Hi @DavidZemon, this sounds similar to #6067 (related to build requirements), do you have a test_package folder?

If so, does removing it "fixes" the issue? This might be the same bug.

DavidZemon commented 4 years ago

I deleted the test_package folder from iodb, then rebuilt it as iodb/2.3.1@foo/bar, then went back to the "big" application with the lockfile and the error remains: ERROR: 'Catch2' cannot be found in lockfile for this package

Was there a different test_package folder you were referring to?

theodelrieu commented 4 years ago

No, it seems to be a different problem then :/

jgsogo commented 4 years ago

Hi, @DavidZemon

I still think that the problem is the same as #6067. For each build requires Conan creates a different node in the graphlock, so Catch2 should appear several times in your graph, at least:

and those two nodes are different, with different ID.

It looks like you are reusing an existing lockfile (/home/david/reusable/Documents/Programming/RedLion/base/targets/s5t/conan/conan.lock) that doesn't contain the node for the Catch2 as a BR of iodb and, as you are requesting to build everything from source, Conan generates the full graph (with all the build_requires) and that particular node is not found in the existing lockfile (it isn't in the lockfile you have copy-pasted).

The way to go is to generate the lockfile with all the nodes (--build '*') and then use it.


Let's try to identify what is causing the error first and then we can think about the way to fix it (I have a use-case in mind that could need a new feature related to the conan graph command... and yours might need another one).

Thanks

DavidZemon commented 4 years ago

That sounds like you hit the nail on the head. I did not realize I needed to pass --build '*' to conan graph .... I'll give that a try and I'll bet it starts working :)

DavidZemon commented 4 years ago

That did it. My lockfile is now generated with --build '*' which allows conan install ... --build '*' to do its thing.

I'll let you decide if this is actually a bug, but as far as I'm concerned, this is fine. Feel free to close if you'd like.

jgsogo commented 4 years ago

It's fine, it is how it works.

Many thanks for submitting this kind of issues, they let us know and think about all these scenarios, about how you all are using it, and with this information we are able to iterate the feature.