Polkadot is capable of allowing you to defining the native runtimes you want included within the final node binary (with flags like polkadot-native
, kusama-native
and so on..). Attempting to port the ability to do something similar has resulted with an odd problem.
When building with enable-runtime-one
or enable-runtime-two
(the equivalent flags in the codebase I'm working on), the code is successfully able to compile but attempting to compile with both flags seems to cause overlapping symbols.
error: symbol `AccountNonceApi_account_nonce` is already defined
--> /src/runtime/runtime/src/runtime/lib.rs:1281:1
|
1281 | / sp_api::impl_runtime_apis! {
1282 | | impl sp_api::Core<Block> for Runtime {
1283 | | fn version() -> RuntimeVersion {
1284 | | VERSION
... |
1539 | | }
1540 | | }
| |_^
|
= note: this error originates in the macro `sp_api::impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
Now, I don't see any deduplication between Polkadot, Kusama or Westend's runtime logic. I initially thought that perhaps I could deduplicate it by placing it in the common runtime but that causes more problems than solving them.
How do I resolve the problem with repeating symbols (and I've tried just removing the symbol from one and keeping the other and the errors it has given me seem to indicate that it's a bad idea)
As for additional information, the codebase is built upon the polkadot-v0.9.15-1
branch using Rust stable 1.57
and WASM nightly 2021-11-29
.
construct_runtime
in the same scope, i.e. in the same file, and they are not designed to be used like that. If so, try separating these feature-gated runtimes into separate modules or crates, similar topolkadot
,kusama
andwestend
crates of the polkadot repo.