| 20 Sep 2025 |
ghpzin | But do you expect for bindgen to always use those things by default ? | 18:51:31 |
emily | yes. what bindgen does is use libclang to read C code and generate Rust bindings based on that | 18:51:35 |
emily | bindgen is, essentially, Clang | 18:51:43 |
emily | we have the hook so that it can find glibc, the dependencies of the derivation, etc. | 18:51:52 |
Lun | duplicating something that would be correct alone is enough to mess up include_next iirc? | 18:52:13 |
emily | we use the flags from @clang@ because it is a kind of Clang, so it needs the Clang logic from cc-wrapper rather than the GCC logic | 18:52:14 |
emily | for atomics though I'm not quite sure, because I think that might be a libgcc vs. compiler-rt distinction š„“ | 18:52:40 |
Alyssa Ross | Why does mesa even have bindgenHook | 18:53:11 |
Alyssa Ross | surely it doesn't use the bindgen crate, being a meson project | 18:53:19 |
Alyssa Ross | yep, doesn't look like it⦠| 18:53:47 |
emily | as in it's just using the bindgen CLI? | 18:54:12 |
emily | and our hook breaks the CLI? | 18:54:16 |
Alyssa Ross | yeah | 18:54:16 |
emily | ah, pkgs/development/tools/rust/bindgen/wrapper.sh | 18:54:32 |
Alyssa Ross | (yeah, it's just using the bindgen CLI) | 18:54:36 |
emily | it seems like we should make our hook and our wrapper not break each other | 18:54:42 |
emily | bindgenHook should surely at worst be a nop | 18:54:42 |
Alyssa Ross | yes, but separately, it shouldn't be there | 18:54:57 |
emily | we could drop our wrapper, and rely only on the hook to make the unwrapped CLI work | 18:54:58 |
emily | or we could make our wrapper detect the hook and overwrite or not duplicate its work | 18:55:09 |
emily | (I of course prefer the solution with less wrapper) | 18:55:23 |
emily | (the CLI could propagate the hook) | 18:55:29 |
Alyssa Ross | or we could just not allow both of them to be used at once, because it's always going to be a mistake⦠| 18:55:30 |
emily | is it? | 18:55:36 |
emily | what if your build uses the crate in one place but the CLI in another? | 18:55:43 |
Alyssa Ross | that would be very, very strange | 18:55:52 |
emily | builds are weird :) | 18:56:00 |
emily | it seems entirely possible with vendored deps | 18:56:04 |
dramforever | i wonder if there's a way to get bindgen to dump the full command line | 18:56:17 |
Alyssa Ross | if you were vendoring the crate you'd have no reason to use the CLI | 18:56:19 |