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

platform-specific .so rules #283

Closed
sayrer opened this issue Jul 7, 2019 · 4 comments
Closed

platform-specific .so rules #283

sayrer opened this issue Jul 7, 2019 · 4 comments

Comments

@sayrer
Copy link

sayrer commented Jul 7, 2019

In the example directory,

configure_make(
    name = "pcre",
    lib_source = "@pcre//:all",
    static_libraries = ["libpcre.a"],
    shared_libraries = ["libpcre.so.1"],
)

fails to build for me on macOS, because the shared_library produced is libpcre.1.dylib. It would be nice to let shared library outputs be specified as triples, and rearranged for each platform (I suspect .dll on windows causes similar problems).

This isn't an issue with Bazel's native cc rules: those seem to generate .so no matter what.

@artemyarulin
Copy link

Having the same issue. I wonder if we can utilise Starlark to introduce some kind of if to select which lib name to use?

@artemyarulin
Copy link

Yes, using helper from https://docs.bazel.build/versions/master/platforms.html it works just fine, random example from Github

 shared_libraries = select({
        "@bazel_tools//src/conditions:windows": [
            "libcharset.dll",
            "libiconv.dll"
        ],
        "@bazel_tools//src/conditions:darwin": [
            "libcharset.dylib",
            "libiconv.dylib"
        ],
        "//conditions:default": [
            "libcharset.so",
            "libiconv.so"
        ],
    }),

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_foreign_cc!

@github-actions
Copy link

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

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

No branches or pull requests

2 participants