首页 > 解决方案 > 为什么 bazel 没有从外部拾取我的标题?

问题描述

我做的时候有问题bazel build //MyPackage:MyTarget

fatal error: tls.h: No such file or directory
 #include <tls.h>

我尝试了一切:

#include <external/libressl/install/include/tls.h>
#include <libressl/install/include/tls.h>
#include <include/tls.h>
#include <tls.h>

Bazel 查询告诉我存在依赖项,所以应该没问题:

bazel query 'labels(hdrs, //MyPackage:MyTarget)'
@libressl//install:hdrs

标题本身也肯定会被选中:

bazel query 'labels(hdrs, @libressl//install:hdrs)'
@libressl//install:include/tls.h

这是目标:

cc_library(
    name = "MyTarget",
    hdrs = [
        "@libressl//install:hdrs"
    ],
    srcs = [
        "test.cpp",
    ],
    deps = [
    "@libressl//install:libssl", 
    "@libressl//install:libtls",
    "@libressl//install:libcrypto"
    ],
    copts = [
    "-Iexternal/libressl/install/include"],
)

那么可能是什么问题呢?我可以清楚地看到我的外部文件夹并且路径是正确的,我复制粘贴它。完整路径:my-workspace/bazel-my-workspace-isolated/external/libressl/install/include/tls.h

标签: bazel

解决方案


我不得不"@libressl//install:hdrs"deps


推荐阅读