facebook / buck2

Build system, successor to Buck
https://buck2.build/
Apache License 2.0
3.53k stars 215 forks source link

Build cdylib with rust_library? #524

Closed SUPERCILEX closed 9 months ago

SUPERCILEX commented 9 months ago

How do I build a cdylib library?

ndmitchell commented 9 months ago

I have no idea - but someone does seem to have writing some support for it in our Rust rules - search cdylib in the codebase. Maybe @JakobDegen knows more, as he touched a line mentioning cdylib recently.

JakobDegen commented 9 months ago

Rust libraries export a [shared] subtarget which produces a cdylib. Note though that if the Rust library has any transitive C/C++ deps, those will be built and linked as DSOs as well, which may or may not be what you want (there's no way to opt out of this behavior atm)

SUPERCILEX commented 9 months ago

That works, thanks!