Dushistov / flapigen-rs

Tool for connecting programs or libraries written in Rust with other languages
BSD 3-Clause "New" or "Revised" License
775 stars 59 forks source link

Duplicate symbols when linking Android on Rust 1.60 #415

Open YuhanLiin opened 2 years ago

YuhanLiin commented 2 years ago

When building multiple crates that export Android APIs via flapigen, the final linking step fails with the error: ld error: duplicate symbol: JNI_OnLoad. This only happens on Rust 1.60 and not older versions. This is caused because of https://github.com/rust-lang/rust/pull/83822, which removes support for duplicate symbols on Android targets.

Dushistov commented 2 years ago

Not sure that going to fix this. This project is designed to work with the idea that only top level crate uses flapigen. Not the many crate provides C API and somehow combined into big library, the idea that all crates provide Rust API, and only top level crate provides C API.