Skip to content

swift_c_module "does not have mandatory providers: 'cc'" with bazel 0.22 #123

@keith

Description

@keith

With the bazel 0.22rc2 pre-release (from here), with this WORKSPACE:

http_archive(
    name = "StringsGenPathKit",
    build_file = "//bazel/third_party:PathKit.BUILD",
    sha256 = "463c5a14204991e9b82c397f426be79756d8c305555e11c572e88ec2e2ab374b",
    strip_prefix = "PathKit-0.9.1",
    url = "https://github.com/kylef/PathKit/archive/0.9.1.tar.gz",
)

http_archive(
    name = "StringsGenYams",
    build_file = "//bazel/third_party:Yams.BUILD",
    patch_cmds = [
        """
echo '
module CYaml {
    umbrella header "CYaml.h"
    export *
}
' > Sources/CYaml/include/Yams.modulemap
    """,
    ],
    sha256 = "c58ed6520b35a83b3998f076b61134c5456d9349006ec1300744db903b3086f4",
    strip_prefix = "Yams-0.7.0",
    url = "https://github.com/jpsim/Yams/archive/0.7.0.tar.gz",
)

And this in the BUILD file:

load(
    "@build_bazel_rules_swift//swift:swift.bzl",
    "swift_c_module",
    "swift_library",
)

cc_library(
    name = "CYamlLib",
    srcs = glob([
        "Sources/CYaml/src/*.c",
        "Sources/CYaml/src/*.h",
    ]),
    hdrs = glob([
        "Sources/CYaml/include/*.h",
    ]),
    includes = ["Sources/CYaml/include"],
    linkstatic = True,
)

swift_c_module(
    name = "CYaml",
    module_map = "Sources/CYaml/include/Yams.modulemap",
    deps = [":CYamlLib"],
)

swift_library(
    name = "Yams",
    srcs = glob(["Sources/Yams/*.swift"]),
    cc_libs = [":CYamlLib"],
    copts = ["-whole-module-optimization"],
    defines = ["SWIFT_PACKAGE"],
    visibility = ["//visibility:public"],
    deps = [":CYaml"],
)

I end up with this build error:

ERROR: /private/var/tmp/_bazel_ksmiley/c8513c989333be3c89713e16206869b2/external/StringsGenYams/BUILD.bazel:23:12: in deps attribute of swift_c_module rule @StringsGenYams//:CYaml: '@StringsGenYams//:CYamlLib' does not have mandatory providers: 'cc'
ERROR: Analysis of target '//Modules/PassengerCore:PassengerCore' failed; build aborted: Analysis of target '@StringsGenYams//:CYaml' failed; build aborted

I'm not sure what change in bazel has caused this yet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions