[llvm] [bazel] Remove -lm on macOS (PR #86706)

Keith Smiley via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 11:04:26 PDT 2024


https://github.com/keith created https://github.com/llvm/llvm-project/pull/86706

Bazel links this library by default which leads to this linker warning on macOS:

```
ld: warning: ignoring duplicate libraries: '-lm'
```

>From e81cc7d72d48519815811c4f2903dc05c765b2b4 Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley at gmail.com>
Date: Tue, 26 Mar 2024 11:02:52 -0700
Subject: [PATCH] [bazel] Remove -lm on macOS

Bazel links this library by default which leads to this linker warning
on macOS:

```
ld: warning: ignoring duplicate libraries: '-lm'
```
---
 utils/bazel/llvm-project-overlay/llvm/BUILD.bazel | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index 0e658353c36f3d..3c3e17bfec668f 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -292,6 +292,10 @@ cc_library(
             "-ldl",
             "-lm",
         ],
+        "@platforms//os:macos": [
+            "-pthread",
+            "-ldl",
+        ],
         "//conditions:default": [
             "-pthread",
             "-ldl",



More information about the llvm-commits mailing list