Commit 1f4a216
Fix clang-specific cc/cxx invocations in cargo_buildscript (#1373)
Summary:
After updating to a version of buck2 that included these changes (using bundled prelude), we started seeing the following when building the `openssl-sys` crate via a Reindeer-generated BUCK file:
```
Header expansion error:
Error { kind: ToolExecError, message: "command did not execute successfully (status code exit status: 1): LC_ALL="C" "…/__openssl-sys-0.9-build-script-main-run__/74052bece190009d/__cc_shim.sh" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "../../../../../../toolchains/b42aeba648b8c415/__openssl_includes__/out.link-dev/include" "-Wall" "-Wextra" "-E" "build/expando.c"" }
Failed to find OpenSSL development headers.
```
The real error (which, unfortunately, is not shown) is that `--ld-path` is a clang-specific flag - or at least, that it is not recognized by gcc. It seems a little unlikely to me that buildscripts need to access the linker in general so I'm not sure we necessarily need to be passing `--ld-path` at all? But this change should at least expand the set of cargo build scripts that can successfully run with gcc toolchains, without affecting clang.
I've tested this in the context of Mercury's monorepo and I'm confident it works there, but I'm struggling a bit to set up a reproducer/test outside of the context of that monorepo. Can you help me figure out whether this should be accompanied by a test, and if so what kind of test?
Pull Request resolved: #1373
Reviewed By: diliop
Differential Revision: D112153850
Pulled By: dtolnay
fbshipit-source-id: 4499512f7f6df065576127917daafcf1716bae331 parent 0d3d7c2 commit 1f4a216
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| 307 | + | |
| 308 | + | |
307 | 309 | | |
308 | 310 | | |
309 | 311 | | |
| |||
319 | 321 | | |
320 | 322 | | |
321 | 323 | | |
322 | | - | |
| 324 | + | |
323 | 325 | | |
324 | 326 | | |
325 | 327 | | |
| |||
334 | 336 | | |
335 | 337 | | |
336 | 338 | | |
337 | | - | |
| 339 | + | |
338 | 340 | | |
339 | 341 | | |
340 | 342 | | |
| |||
0 commit comments