Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
keith opened this issue Jan 7, 2019 · 9 comments
Closed

Comments

@keith
Copy link
Member

keith commented Jan 7, 2019

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

@allevato
Copy link
Member

allevato commented Jan 7, 2019

I believe it's this: bazelbuild/bazel@a60b6ce

There have been a number of changes to the C++ providers recently that I've been waiting to become finalized enough that I can adopt them.

@keith
Copy link
Member Author

keith commented Jan 7, 2019

Confirmed that setting --no incompatible_disable_legacy_cc_provider works around this

@keith
Copy link
Member Author

keith commented Jan 8, 2019

Is this something we can migrate now? Or would we have to support both at once? I haven't looked for when the new providers were added

@keith
Copy link
Member Author

keith commented Jan 8, 2019

It looks like the same conversation is happening here bazelbuild/bazel#7036 (comment)

@keith
Copy link
Member Author

keith commented Jan 11, 2019

@allevato is this something you're planning on working on before the 0.22 release?

@allevato
Copy link
Member

I'll start working on the migration this week, but the currently released version of Bazel that we use internally doesn't yet include the above commit yet, so I can't release anything until we catch up to that.

I looked into support both simultaneously, but the effort would be fairly large since the old- and new-style providers are very different, and I can't rationalize that amount of effort for a short-term workaround.

If Bazel releases 0.22 before I'm able to fully test the change internally and push it out, then I'd recommend using --noincompatible_disable_legacy_cc_provider until rules_swift can be updated.

@keith
Copy link
Member Author

keith commented Jan 14, 2019

I've commented on the linked issue asking about the migration window, it doesn't seem like 0.22 has the necessary files I expected. I've submitted a first pass PR for this that is compatible with bazel HEAD right now #129

@keith
Copy link
Member Author

keith commented Jan 28, 2019

My PR is green now so we should be good for compatibility with 0.22!

@allevato
Copy link
Member

I believe this is resolved now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants