Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding dependencies Issue - unresolved import `sp_core #192

Closed
blockcowboy opened this issue Mar 10, 2023 · 1 comment
Closed

Adding dependencies Issue - unresolved import `sp_core #192

blockcowboy opened this issue Mar 10, 2023 · 1 comment

Comments

@blockcowboy
Copy link

blockcowboy commented Mar 10, 2023

I built the MacOS version successfully
I built Substrate example successfully

When I added Substate dependencies to MacOS version I get the following error:

error[E0432]: unresolved import sp_core::to_substrate_wasm_fn_return_value
--> ~/.cargo/git/checkouts/substrate-7e08433d4c370a21/f38bd66/primitives/api/src/lib.rs:80:9
|
80 | pub use sp_core::to_substrate_wasm_fn_return_value;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no to_substrate_wasm_fn_return_value in the root

Can this be my .toml , etc.


#!/bin/bash

##################################################

We call this from an Xcode run script.

##################################################

set -e

if [[ -z "$PROJECT_DIR" ]]; then
echo "Must provide PROJECT_DIR environment variable set to the Xcode project directory." 1>&2
exit 1
fi

cd $PROJECT_DIR

export PATH="$HOME/.cargo/bin:$PATH"

Without this we can't compile on MacOS Big Sur

TimNN/cargo-lipo#41 (comment)

if [[ -n "${DEVELOPER_SDK_DIR:-}" ]]; then
export LIBRARY_PATH="${DEVELOPER_SDK_DIR}/MacOSX.sdk/usr/lib:${LIBRARY_PATH:-}"
fi

TARGETS=""
if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then
TARGETS="aarch64-apple-ios-sim,x86_64-apple-ios"
else
TARGETS="x86_64-apple-darwin,aarch64-apple-darwin"
fi

if [ $ENABLE_PREVIEWS == "NO" ]; then

if [[ $CONFIGURATION == "Release" ]]; then
echo "BUIlDING FOR RELEASE ($TARGETS)"

  cargo lipo --release --manifest-path ../Cargo.toml  --targets $TARGETS

else
echo "BUIlDING FOR DEBUG ($TARGETS)"

  cargo lipo --manifest-path ../Cargo.toml  --targets $TARGETS

fi

else

echo "Skipping the script because of preview mode"

fi


[package]
name = "macos-rust-analyzer"
version = "0.1.0"
edition = "2021"

build = "build.rs"

[build-dependencies]
swift-bridge-build = "0.1"

[lib]
crate-type = ["staticlib"]

[dependencies]
swift-bridge = "0.1"
ide = {git = "https://github.com/rust-analyzer/rust-analyzer"}
petgraph = "0.6.3"

anyhow = "1.0.43"
frame-metadata = { version = "15.0.0", features = ["v13"] }
hex = "0.4.3"
parity-scale-codec = "3.0.0"
reqwest = { version = "0.11.4", features = ["json"] }
serde = "1"
serde_json = "1"
tokio = { version = "1.10.0", features = ["full"] }
jsonrpsee = { version = "0.12.0", features = ["async-client", "client-ws-transport"] }

Various types and functions useful for interacting with substrate exist in these sp (substrate-primitives) crates:

sp-core = { git = "https://github.com/paritytech/substrate", package = "sp-core", default-features = false, branch = "polkadot-v0.9.37" }
sp_runtime = { git = "https://github.com/paritytech/substrate", package = "sp-runtime", default-features = false, branch = "polkadot-v0.9.37" }
sp_keyring = { git = "https://github.com/paritytech/substrate.git", package = "sp-keyring", default-features = false, branch = "polkadot-v0.9.37" }
sp_version = { git = "https://github.com/paritytech/substrate.git", package = "sp-version", default-features = false, branch = "polkadot-v0.9.37" }

XCM utilized for the 06_storage_iter example.

xcm = { version = "0.9", git = "https://github.com/paritytech/polkadot.git", branch = "master", package = "xcm" }

There are some types we want in the pallet crates (if we liked, we could just redefine them to save bringing these in):

pallet_balances = { git = "https://github.com/paritytech/substrate.git", package = "pallet-balances", default-features = false, branch = "polkadot-v0.9.37" }
pallet_system = { git = "https://github.com/paritytech/substrate.git", package = "frame-system", default-features = false, branch = "polkadot-v0.9.37" }

[profile.dev]
panic = 'unwind'

[profile.release]
panic = 'unwind'

@chinedufn
Copy link
Owner

Closing as I can't understand what this issue is asking.

If you think that this issue is related to swift-bridge, please edit your issue body to clearly explain the problem that you are facing with swift-bridge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants