Open TheZoq2 opened 4 years ago
I thought a bit more about this, and to me, it looks like these are symbols defined in rust, not in the cpp file, so just not building against the cxx cpp file probably won't help in this case
Edit: I was going to try to add a fix for this, so I added cxx as a submodule and now things compile as expected. I pressume that's not a solution though
Mozilla's approach to the duplicate symbols problem is to compile all libraries into rlibs, and then create a single wrapper crate around all of them that compiles into a staticlib for linking purposes. I'm curious to see if that could be applicable for cxx
as well; if so it would be nice to have a guide somewhere.
I wrote some stuff here which may be relevant: https://github.com/adetaylor/cxx/blob/book/book/src/building.md#linking-the-c-and-rust-together
but the bottom line is, @antonok-edm is right - the only realistic solution is to pull all your Rust code together into a single staticlib
target :( There's a bit more discussion here: https://github.com/rust-lang/rust/issues/73632
Since I liked the first time I used this crate, I figured I could start RIIRing another part of my project. This part is a standalone library, so I don't want to merge it with my first converted part, but unfortunately that means I run into some linker errors because I now link against the cxx library twice.
Is there a way to work around this, something like optionally not building against the cxx cpp file?