For context, I'm trying to develop on this crate that generates plugins for wireshark. These are typically .so objects that can be added into search paths by adding them to specified search paths.
I am attempting to build the example plugins in this crate, and get them to be run in wireshark
My main issue is that I am not able to generate .so type from the, and I have yet to find a good way to do so! What I would ideally like to achieve is something of similar nature to passing a -bundle flag to the build process like described here.
I have also come across this help thread titled # [Compile dynamic library crate to .dylib vs .so] where some of the suggestions were to simply rename the file, but it seems like that's not how it works for wireshark at least.
Now I'm not sure if I'm understanding the Cargo Book section on configuration wrong but RUSTFLAGS="-C link-args=-Wl,-bundle cargo build --examples seems to interfere with the building of other crates.
You won't be able to generate .so files for macOS, because macOS doesn't use this format, nor this file extension. Apple's dynamic libraries are Mach-O files with .dylib extension, rather than typically-Linux ELF files with an .so extension. They're functionally the same, but just not called .so.
Cargo will generate .so files on macOS hosts only when cross-compiling to Linux or a similar OS.
Cargo has no support for making .bundles. These are just directories with a name suffix and Info.plist inside. You can make a .dylib and put it in the right directory structure yourself, or use Xcode and possibly cargo-xcode to build it for you.
Thank you to @kornel for the further insight on the abilities of cargo and suggestion to look at cargo-xcode, but it didn't seem like what I was looking for in a solution.
@cdbennett turns out you were right! The original suggestion from the other thread was right as well. The silly reason why it wasn't working for me was because the Wireshark application links the plugins at start up, and there's no hot reloading or anything like that.
I will investigate further to ascertain how Wireshark loads plugins, but the empirical solution was indeed to rename .dylib to .so