• bazel、tensorflow_serving、opencv编译问题


    1、出现该错误表示opencv冲突,该机器上有多个opencv版本。

    解决方法:卸载低版本opencv

    2、bazel中BUILD的写法:

    1. copts中放置-I/usr/include/、-D
    2. linkopts中放置-lopencv_core、-std=c++11、-L/usr/lib64
    3. 出现编译错误时,可以使用--verbose_failures来打印错误处的详细编译命令,以此查找脚本的错误
      bazel build tensorflow/... --verbose_failures
    4.  1 package(
       2     default_visibility = ["//tensorflow_serving:internal"],
       3     features = ["no_layering_check"],
       4 )
       5 
       6 licenses(["notice"])  # Apache 2.0
       7 
       8 exports_files(["LICENSE"])
       9 
      10 load("//tensorflow_serving:serving.bzl", "serving_proto_library")
      11 
      12 filegroup(
      13     name = "all_files",
      14     srcs = glob(
      15         ["**/*"],
      16         exclude = [
      17             "**/METADATA",
      18             "**/OWNERS",
      19         ],
      20     ),
      21 )
      22 
      23 cc_library(
      24     name = "recog_proc",
      25     srcs = glob([
      26         "ImageProc.cpp",
      27     ]),
      28     hdrs = [
      29         "ImageProc.h",
      30     ],
      31     copts = [
      32         "-I/usr/include/",
      33         "-I/usr/include/ImageMagick/",
      34     ],
      35     deps = [
      36         "//tensorflow_serving/apis:prediction_service_proto",
      37         "@grpc//:grpc++",
      38         "@org_tensorflow//tensorflow/core:framework",
      39         "@protobuf_archive//:protobuf_lite",
      40     ],
      41     visibility = [ 
      42         "//visibility:public",
      43     ],
      44 )
      45 
      46 cc_binary(
      47     name = "recog_srv_cc",
      48     srcs = glob([
      49         "main.cpp",
      50     ]),
      51     copts = [
      52         "-I/usr/include/",
      53         "-L/usr/lib64",
      54         "-DSS_LOG_DEFAULT_MODULE=recog",
      55     ],
      56     linkopts = [
      57         "-lACE",
      58         "-lssplatform",
      59         "-ljsoncpp",
      60         "-lopencv_core",
      61         "-lopencv_imgproc",
      62         "-lopencv_highgui",
      63         "-lopencv_imgcodecs",
      64         "-lopencv_photo",
      65         "-lMagick++",
      66         "-lMagickCore",
      67         "-lMagickWand",
      68         "-Wl,-no-undefined",
      69         "-Wno-reorder",
      70         "-std=c++11",
      71         "-pthread",
      72         "-g",
      73         "-L/usr/local/lib64",
      74     ],
      75     deps = [
      76         ":recog_proc",
      77     ],
      78 )
    5. 示例:
  • 相关阅读:
    CSS hacks汇总
    都要靠自己
    不被需要
    我们都是和自己赛跑的人
    其实天底下只有三件事
    开始怀旧了
    JavaScript回调函数陷阱
    郁闷着继续
    清明节悼念逝去亲人
    纯div+css制作的弹出菜单
  • 原文地址:https://www.cnblogs.com/zl1991/p/8574561.html
Copyright © 2020-2023  润新知