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

[Bug]: Many modules add -lrt as a linkopt, which only works on Linux #2017

Open
eyebrowsoffire opened this issue May 12, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@eyebrowsoffire
Copy link

What happened?

It appears many of the module definitions add the -lrt linkopt explicitly in their BUILD file definition. See for example

This link option is only valid on Linux. Other platforms, such as macOS, this just causes a link failure.

Version

Development (host) and target OS/architectures: macOS 13.6.6 (22G630)

Output of bazel --version: bazel 7.1.2

How to reproduce

Just create a simple hello world that links on `websocketpp` as an example.

Build file:


cc_binary(
    name = "hello_world",
    srcs = [
        "main.cpp",
    ],
    deps = [
        "@websocketpp",
    ],
)

In the MODULE.bazel file:

bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "websocketpp", version = "0.8.2")


### Any other information?

I'm guessing probably this linkopt should be gated on a platform configuration so it is only added on linux.
@eyebrowsoffire eyebrowsoffire added the bug Something isn't working label May 12, 2024
@fmeum
Copy link
Contributor

fmeum commented May 16, 2024

You could submit a new version (with a customary .bcr.1 suffix) and e.g. add a select based on the target platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants