conan: [bug] Build of a recipe which has a tool_requires with `` may fail if build triggered from build context
Environment details
- Operating System+version: Ubuntu 22.04
- Compiler+version: GCC 12
- Conan version: 2.0.13
- Python version: 3.10.5
Steps to reproduce
For example you could add qt
recipe to build requirements of a recipe on Linux, it will drag xkbcommon
in build context. Also take care of not downloading pre-built binaries from conancenter but build from source, and do not have xkbcommon in host context (or a different flavor like shared=True
).
Build of xkbcommon
will fail (It was working fine before https://github.com/conan-io/conan-center-index/pull/19983 which has replaced wayland/1.21.0
by wayland/<host_version>
in its build requirements).
If you build xkbcommon
with a simple conan install --requires xkbcommon/1.5.0 -b
, it works fine.
It might be an issue with PkgConfigDeps build_context_activated with <host_version
in the context of a build triggered from build context, I don’t know: https://github.com/conan-io/conan-center-index/blob/8d3eb5dcf5fcf29d971892e156781b5e26e1453a/recipes/xkbcommon/all/conanfile.py#L104-L138
see also https://github.com/conan-io/conan-center-index/issues/20542
Logs
xkbcommon/1.5.0: Calling build()
xkbcommon/1.5.0: Meson configure cmd: meson setup --native-file "/home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/b/build-release/conan/conan_meson_native.ini" "/home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/b/build-release" "/home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/b/src" -Dprefix="/home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/p"
xkbcommon/1.5.0: RUN: meson setup --native-file "/home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/b/build-release/conan/conan_meson_native.ini" "/home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/b/build-release" "/home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/b/src" -Dprefix="/home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/p"
The Meson build system
Version: 1.2.2
Source dir: /home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/b/src
Build dir: /home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/b/build-release
Build type: native build
Project name: libxkbcommon
Project version: 1.5.0
C compiler for the host machine: /usr/bin/gcc-12 (gcc 12.3.0 "gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0")
C linker for the host machine: /usr/bin/gcc-12 ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -fno-strict-aliasing: YES
Compiler for C supports arguments -Wno-unused-parameter: YES
Compiler for C supports arguments -Wno-missing-field-initializers: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wmissing-declarations: YES
Compiler for C supports arguments -Wformat=2: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wmissing-prototypes: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wbad-function-cast: YES
Compiler for C supports arguments -Wshadow: YES
Compiler for C supports arguments -Wlogical-op: YES
Compiler for C supports arguments -Wdate-time: YES
Compiler for C supports arguments -Wwrite-strings: YES
Compiler for C supports arguments -Wno-documentation-deprecated-sync: NO
Found pkg-config: /home/spaceim/.conan2/p/b/pkgco720a404f4464b/p/bin/pkgconf (2.0.3)
Run-time dependency xkeyboard-config found: YES 2.33
Has header "unistd.h" : YES
Checking if "__builtin_expect" : links: YES
Header "unistd.h" has symbol "eaccess" : YES
Header "unistd.h" has symbol "euidaccess" : YES
Header "sys/mman.h" has symbol "mmap" : YES
Header "stdlib.h" has symbol "mkostemp" : YES
Header "fcntl.h" has symbol "posix_fallocate" : YES
Header "string.h" has symbol "strndup" : YES
Header "stdio.h" has symbol "asprintf" : YES
Header "stdlib.h" has symbol "secure_getenv" : YES
Header "limits.h" has symbol "PATH_MAX" : YES
Checking if "-Wl,--version-script" : links: YES
Program scripts/map-to-def found: YES (/home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/b/src/scripts/map-to-def)
Program bison found: YES (/home/spaceim/.conan2/p/b/bison7391da5f74f3d/p/bin/bison)
Run-time dependency xcb found: YES 1.14
Run-time dependency xcb-xkb found: YES 1.14
Run-time dependency libxml-2.0 found: YES 2.11.4
Header "getopt.h" has symbol "getopt_long" : YES
Has header "linux/input.h" : YES
Found CMake: /usr/bin/cmake (3.27.6)
Run-time dependency wayland-client found: NO (tried pkgconfig and cmake)
Found pkg-config: /home/spaceim/.conan2/p/b/pkgco720a404f4464b/p/bin/pkgconf (2.0.3)
Build-time dependency wayland-protocols_build found: YES 1.31
Build-time dependency wayland-scanner_build found: YES 1.22.0
../src/meson.build:481:12: ERROR: Problem encountered: The Wayland xkbcli programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
You can disable the Wayland xkbcli programs with -Denable-wayland=false.
A full log can be found at /home/spaceim/.conan2/p/b/xkbco9f60d54155a8e/b/build-release/meson-logs/meson-log.txt
xkbcommon/1.5.0: ERROR:
Package 'f9ef332b3b3d0aa590e813e2022896740eb3a979' build failed
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 19 (18 by maintainers)
Submitting a fix in https://github.com/conan-io/conan/pull/15763
The fix was quick once we could reproduce it. This highlights the importance of reducing to the very minimum the repro-cases, it helps a lot to expedite the resolution of bugs.
I have already tried to backport this to Conan 1.X, but it doesn’t seem possible, as the graph model (
tool_requires
when you are already in the build context) in Conan 1.X does not correctly support this case.Thanks all for the feedback!
Thanks for the details.
I have tried it, had to change:
Then, after that, with the command:
I had to quote the “*”.
Then I got a normal conflict:
Not the error you are reporting inside the Meson build. Testing with latest Conan 2.1.
Then I used the new 2.1 to resolve the conflict:
and pass it both as host and build profile
Then it started to build things, but then I got stuck with:
It seems their server is down at this moment
It eventually proceed. Then I wanted to introduce some prints/traces in the
xkbcommon
recipe, but then the latest revisions from ConanCenter brought a new version conflict, I added a new replace:to be able to move forward.
I now think that I have been able to identify the issue in
PkgConfigDeps
, I will be working on a fix for Conan 2.2. Sorry it took so long, it was challenging to reproduce.