Hi,
I want to use pre-compiled third party library as a cc_library rule so that my binary can depend on it.
I'm using Mac, so I installed the library with "brew install gflags". Then I created a BUILD file for the library:
package(default_visibility = ["//visibility:public"])
cc_library(
name = "gflags",
srcs = [
"lib/libgflags.dylib",
],
hdrs = glob(["include/**/*.h"]),
includes = ["include"],
)
The binary can be built, but when it runs, I got the exception:
dyld: Library not loaded: /usr/local/opt/gflags/lib/libgflags.2.2.dylib
Referenced from: /Users/liangzou/gitreview/bazel-bin/tools/viewer/omap_viewer
Reason: image not found
I don't think I'm using the pre-compiled dynamic library correctly. Can someone please point out what the problem is? Thanks a lot in advance.