bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.99k stars 4.03k forks source link

bazel should import a new rule to have a better experience to import traditional libraries #23164

Open xiedeacc opened 1 month ago

xiedeacc commented 1 month ago

Description of the feature request:

many traditional libraries need configure to generate some config file, then compile, then install. installed file structure is very different with source tree. this introduce header search confict, even more terrible, a bazel rule writer have to handle many case for -isystem and -iquote problem.

I suggest import a new rule like cc_library, let's named it cc_install_library temporalily, cc_install_library just contain hdrs and deps, every header file in hdrs can be imported by other cc_library use -isystem, deps just contain other cc_library's .so or .a file .

briefly: introduce a new cc_install_library rule let we can import a library just like that library installed on system

Which category does this issue belong to?

C++ Rules, Core

xiedeacc commented 1 month ago

I believe this rule can help bazel be the most popular build tool in c-family languages

comius commented 3 weeks ago

I acknowledge the problem. The solution needs more discussion - where do we draw the line of non-hermeticity, when should we use binaries instead of building from sources (and can this be automated?), should the libraries on the system be auto discovered.