1、出现该错误表示opencv冲突,该机器上有多个opencv版本。
解决方法:卸载低版本opencv
2、bazel中BUILD的写法:
- copts中放置-I/usr/include/、-D
- linkopts中放置-lopencv_core、-std=c++11、-L/usr/lib64
- 出现编译错误时,可以使用--verbose_failures来打印错误处的详细编译命令,以此查找脚本的错误
bazel build tensorflow/... --verbose_failures
package(
default_visibility = ["//tensorflow_serving:internal"],
features = ["no_layering_check"],
) licenses(["notice"]) # Apache 2.0 exports_files(["LICENSE"]) load("//tensorflow_serving:serving.bzl", "serving_proto_library") filegroup(
name = "all_files",
srcs = glob(
["**/*"],
exclude = [
"**/METADATA",
"**/OWNERS",
],
),
) cc_library(
name = "recog_proc",
srcs = glob([
"ImageProc.cpp",
]),
hdrs = [
"ImageProc.h",
],
copts = [
"-I/usr/include/",
"-I/usr/include/ImageMagick/",
],
deps = [
"//tensorflow_serving/apis:prediction_service_proto",
"@grpc//:grpc++",
"@org_tensorflow//tensorflow/core:framework",
"@protobuf_archive//:protobuf_lite",
],
visibility = [
"//visibility:public",
],
) cc_binary(
name = "recog_srv_cc",
srcs = glob([
"main.cpp",
]),
copts = [
"-I/usr/include/",
"-L/usr/lib64",
"-DSS_LOG_DEFAULT_MODULE=recog",
],
linkopts = [
"-lACE",
"-lssplatform",
"-ljsoncpp",
"-lopencv_core",
"-lopencv_imgproc",
"-lopencv_highgui",
"-lopencv_imgcodecs",
"-lopencv_photo",
"-lMagick++",
"-lMagickCore",
"-lMagickWand",
"-Wl,-no-undefined",
"-Wno-reorder",
"-std=c++11",
"-pthread",
"-g",
"-L/usr/local/lib64",
],
deps = [
":recog_proc",
],
)- 示例: