I have an external library ace.so.
cc_library(
name='ace',
hdrs=glob(['path/to/ace/**']),
srcs=['path/to/ace.so'],
)
How do I go about linking to that library with bazel? I know a colon can be used when invoking gcc/g++ directly, but I'm not sure how to get the same behavior from bazel.
- I tried adding
-l:ace.so(also-Wl,-l:ace.so) tocoptsbut it seems bazel doesn't pass that to gcc or add it to the@file used for linker args. - I tried
nocopts='-lace.so'in combination withlinkopts=['-l:ace.so']. No luck. - I also tried
cc_importinstead ofcc_library, but that didn't work either.
I've read the Importing precompiled C++ libraries doc, but I didn't see anything about using libs with an arbitrary prefix - or with no prefix.
As a temporary fix, I've added a symlink libace.so pointing to ace.so and changed the srcs line to match. While this works, I'd much rather convince bazel to use the lib as is.