Hi,
In short, my question is: What is the purpose of cc_import, and when should it be preferred over cc_library?
cc_import has several known issues and their workaround seems to always be to use cc_library instead.
I've frequently encountered the following two issues:
1. cc_import does not have a `strip_include_prefix` attribute [1].
E.g. you'd have to change `#include "zlib.h"` to `#include "external/zlib/zlib.h"`, or similar.
2. cc_import does not work with shared libraries that don't match their soname [2].
E.g. if `libz.so` has soname `libz.so.1`, then execution of the final cc binary will fail.
Both these issues can be worked around by using cc_library instead of cc_import.
See [3] for the `strip_issue_prefix` issue, and [4] for the soname issue.
This begs the question: Why not always use cc_library instead of cc_import?
Is there some functionality that is only provided by cc_import?
As I understand the discussion in [2] the new Starlark C++ API should replace the current implementations for cc_import and cc_library. In that context, does it make sense to provide both functions, or would cc_library alone suffice?
I've previously raised this question in [4]. I'm writing to this list as suggested by @mboes.
Best, Andreas