conan-io / conan

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

[bug] BazelDeps generator gives Incorrect link order for multi-lib packages #16949

Closed BoelGerhardt closed 6 days ago

BoelGerhardt commented 1 month ago

Describe the bug

Environment Details

Operating System+version: All Compiler+version: Not relevant Conan version: 1.62 and later Python version: All

Description

This is basically a re-opening of https://github.com/conan-io/conan/issues/11559.

The original issue was that if running Buildifier on the generated bazel BUILD files, it would sort deps in the wrong order for multi-lib packages (like openssl or xmlsec). This was fixed in https://github.com/conan-io/conan/pull/11560 which added a # do not sort comment to the deps section, so that buildifier would not change the order of deps.

Now the # do not sort comment is no longer added, so buildifier will sort the deps again. (It also looks like the BUILD files might already be "prettified", i.e. have the deps sorted alphabetically when generated by conan). This causes link errors for e.g. openssl and xmlsec, due to their component libraries needing to be in a non-alphabetical order.

The issue re-appeared in conan version 1.62. I believe this is the change that broke it: https://github.com/conan-io/conan/pull/14959

How to reproduce it

See https://github.com/conan-io/conan/issues/11559

memsharded commented 6 days ago

This has been fixed in https://github.com/conan-io/conan/pull/17109, will be available in next Conan 2.9, thanks for your feedback!