Don’t worry, it took me like 4 days to get a build working against the Beta network and then a further 7 days to expose the Libp2p raw swarm, any one would think they didn’t want us in the code yet remembering that my rust knowledge is like zero…
I’m building from Visual Studio, having to use the C linker for rust, and the Windows 10/11 SDK else I’ve not been able to get a traceable debug build out.
I’m currently setting “global” environment variables on my dev box using “edit the system environmental variables” from system properties - avoid a whitespace at end, else rust will panic and you will spend ages trying to find out why
building against “stable” currently has the below system wide environmental variables set - VS is meant to be able to pass a config.toml
with a [env]
block to set compile time environment, but it completely ignored them…;
FOUNDATION_PK = 84418659a8581b510c40b12e57da239787fd0d3b323f102f09fae9daf2ac96907e0045b1653c301de45117d393d92678
GENESIS_PK = 8829ca178d6022de16fb8d3498411dd8a674a69c5f12e04d8b794a52ab056f1d419d12f690df1082dfa7efbbb10f62fa
NETWORK_ROYALTIES_PK = 8c027130571cea2387a0ceb37c14fec12849015be1573ea6d0a8e4d48da2c1fbe2907ae7503bb7c385b21e2d7ac9d6ff
PAYMENT_FORWARD_PK = 8c2f406a52d48d48505e1a3fdbb0c19ab42cc7c4807e9ea19c1fff3e5148f3bbe53431ec5a07544aaeef764e073e4b2f
you will need a custom launcher, I’m using in my launch.json;
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'sn_peek'",
"cargo": {
"args": [
"build",
"--bin=sn_peek",
"--package=sn_peek",
"--features=network-contacts,network-httpd,network-trace"
],
"filter": {
"name": "sn_peek",
"kind": "bin"
}
},
"args": ["dht","--peer","/ip4/<removed>","--network autonomi-beta"],
"cwd": "${workspaceFolder}"
}
]
}
you will need to tweak the executable name, bin, package - you can use the --features
comma separated to enable from cargo.toml - and can pass arguments through in the args
, comma separated.
in the cargo.toml
if you want to build against the stable crates, you will need to change the dependencies from linking to ../sn_network version=...
…
sn_client = { version = "0.109.0" }
sn_logging = { version = "0.2.31" }
sn_protocol = { version = "0.17.6" }
sn_peers_acquisition = { version = "0.4.1" }
sn_networking = { version = "0.17.1" }
sn_registers = { version = "0.3.16" }
sn_transfers = { version = "0.18.9" }
also in the cargo.toml if using vs, then you can get the pdb debug files including; (obviously, if you were going to publish a release build, remove the debug)
[profile.release]
debug = true
[profile.dev]
debug = true