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

bdkwallet/bdkgo/bdkgo.go:60:10: cannot define new methods on non-local type RustBuffer #276

Open
whileunless opened this issue Feb 25, 2025 · 2 comments

Comments

@whileunless
Copy link

I cannot build it, make all gives me:

if ! type cargo; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ; fi
cargo is /root/.cargo/bin/cargo
if ! type uniffi-bindgen-go; then cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.0+v0.25.0 ; fi
uniffi-bindgen-go: not found
    Updating git repository `https://github.com/NordSecurity/uniffi-bindgen-go`
    Updating git submodule `https://github.com/NordSecurity/uniffi-rs.git`
  Installing uniffi-bindgen-go v0.2.0+v0.25.0 (https://github.com/NordSecurity/uniffi-bindgen-go?tag=v0.2.0+v0.25.0#4095f606)
    Updating crates.io index
  Downloaded askama_derive v0.12.5
  Downloaded basic-toml v0.1.9
  Downloaded scroll_derive v0.11.1
  Downloaded askama v0.12.1
  Downloaded askama_escape v0.10.3
  Downloaded plain v0.2.3
  Downloaded extend v1.2.0
  Downloaded askama_parser v0.2.1
  Downloaded smawk v0.3.2
  Downloaded unicase v2.8.1
  Downloaded unicode-linebreak v0.1.5
  Downloaded fs-err v2.11.0
  Downloaded mime_guess v2.0.5
  Downloaded once_cell v1.20.3
  Downloaded scroll v0.11.0
  Downloaded clap_derive v3.2.25
  Downloaded cargo_metadata v0.15.4
  Downloaded anyhow v1.0.96
  Downloaded ryu v1.0.19
  Downloaded toml v0.5.11
  Downloaded serde_derive v1.0.218
  Downloaded log v0.4.26
  Downloaded unicode-ident v1.0.17
  Downloaded bytes v1.10.0
  Downloaded serde v1.0.218
  Downloaded serde_json v1.0.139
  Downloaded goblin v0.6.1
  Downloaded syn v2.0.98
  Downloaded libc v0.2.170
  Downloaded 29 crates (2.2 MB) in 1.41s
   Compiling proc-macro2 v1.0.93
   Compiling unicode-ident v1.0.17
   Compiling serde v1.0.218
   Compiling autocfg v1.4.0
   Compiling version_check v0.9.5
   Compiling memchr v2.7.4
   Compiling thiserror v1.0.69
   Compiling unicase v2.8.1
   Compiling anyhow v1.0.96
   Compiling semver v1.0.25
   Compiling camino v1.1.9
   Compiling serde_json v1.0.139
   Compiling itoa v1.0.14
   Compiling syn v1.0.109
   Compiling minimal-lexical v0.2.1
   Compiling ryu v1.0.19
   Compiling mime v0.3.17
   Compiling mime_guess v2.0.5
   Compiling once_cell v1.20.3
   Compiling libc v0.2.170
   Compiling smawk v0.3.2
   Compiling unicode-width v0.1.14
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling siphasher v0.3.11
   Compiling unicode-linebreak v0.1.5
   Compiling bytes v1.10.0
   Compiling paste v1.0.15
   Compiling fs-err v2.11.0
   Compiling indexmap v1.9.3
   Compiling textwrap v0.16.1
   Compiling hashbrown v0.12.3
   Compiling log v0.4.26
   Compiling nom v7.1.3
   Compiling askama_escape v0.10.3
   Compiling plain v0.2.3
   Compiling heck v0.4.1
   Compiling os_str_bytes v6.6.1
   Compiling quote v1.0.38
   Compiling termcolor v1.4.1
   Compiling syn v2.0.98
   Compiling clap_lex v0.2.4
   Compiling bitflags v1.3.2
   Compiling atty v0.2.14
   Compiling strsim v0.10.0
   Compiling glob v0.3.2
   Compiling askama_parser v0.2.1
   Compiling weedle2 v4.0.0 (/root/.cargo/git/checkouts/uniffi-bindgen-go-10b6486a739c08f4/4095f60/3rd-party/uniffi-rs/weedle2)
   Compiling clap_derive v3.2.25
   Compiling serde_derive v1.0.218
   Compiling thiserror-impl v1.0.69
   Compiling uniffi_checksum_derive v0.25.0 (/root/.cargo/git/checkouts/uniffi-bindgen-go-10b6486a739c08f4/4095f60/3rd-party/uniffi-rs/uniffi_checksum_derive)
   Compiling scroll_derive v0.11.1
   Compiling extend v1.2.0
   Compiling uniffi_meta v0.25.0 (/root/.cargo/git/checkouts/uniffi-bindgen-go-10b6486a739c08f4/4095f60/3rd-party/uniffi-rs/uniffi_meta)
   Compiling clap v3.2.25
   Compiling scroll v0.11.0
   Compiling goblin v0.6.1
   Compiling basic-toml v0.1.9
   Compiling cargo-platform v0.1.9
   Compiling toml v0.5.11
   Compiling askama_derive v0.12.5
   Compiling cargo_metadata v0.15.4
   Compiling uniffi_testing v0.25.0 (/root/.cargo/git/checkouts/uniffi-bindgen-go-10b6486a739c08f4/4095f60/3rd-party/uniffi-rs/uniffi_testing)
   Compiling uniffi_udl v0.25.0 (/root/.cargo/git/checkouts/uniffi-bindgen-go-10b6486a739c08f4/4095f60/3rd-party/uniffi-rs/uniffi_udl)
   Compiling askama v0.12.1
   Compiling uniffi_bindgen v0.25.0 (/root/.cargo/git/checkouts/uniffi-bindgen-go-10b6486a739c08f4/4095f60/3rd-party/uniffi-rs/uniffi_bindgen)
warning: unnecessary qualification
   --> 3rd-party/uniffi-rs/uniffi_bindgen/src/interface/mod.rs:152:36
    |
152 |         self.types.add_known_type(&uniffi_meta::Type::String)?;
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: the lint level is defined here
   --> 3rd-party/uniffi-rs/uniffi_bindgen/src/lib.rs:92:27
    |
92  | #![warn(rust_2018_idioms, unused_qualifications)]
    |                           ^^^^^^^^^^^^^^^^^^^^^
help: remove the unnecessary path segments
    |
152 -         self.types.add_known_type(&uniffi_meta::Type::String)?;
152 +         self.types.add_known_type(&Type::String)?;
    |

warning: unnecessary qualification
   --> 3rd-party/uniffi-rs/uniffi_bindgen/src/library_mode.rs:233:13
    |
233 |             uniffi_meta::Metadata::UdlFile(meta) => Some(meta),
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: remove the unnecessary path segments
    |
233 -             uniffi_meta::Metadata::UdlFile(meta) => Some(meta),
233 +             Metadata::UdlFile(meta) => Some(meta),
    |

warning: unnecessary qualification
   --> 3rd-party/uniffi-rs/uniffi_bindgen/src/lib.rs:245:40
    |
245 | ...cdylib_name) = crate::library_mode::calc_cdylib_name(library_file.as...
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: remove the unnecessary path segments
    |
245 -             if let Some(cdylib_name) = crate::library_mode::calc_cdylib_name(library_file.as_ref())
245 +             if let Some(cdylib_name) = library_mode::calc_cdylib_name(library_file.as_ref())
    |

   Compiling uniffi-bindgen-go v0.2.0+v0.25.0 (/root/.cargo/git/checkouts/uniffi-bindgen-go-10b6486a739c08f4/4095f60/bindgen)
warning: `uniffi_bindgen` (lib) generated 3 warnings (run `cargo fix --lib -p uniffi_bindgen` to apply 3 suggestions)
    Finished `release` profile [optimized] target(s) in 41.83s
  Installing /root/.cargo/bin/uniffi-bindgen-go
   Installed package `uniffi-bindgen-go v0.2.0+v0.25.0 (https://github.com/NordSecurity/uniffi-bindgen-go?tag=v0.2.0+v0.25.0#4095f606)` (executable `uniffi-bindgen-go`)
uniffi-bindgen-go -o bdkwallet bdkwallet/bdkgo_crate/src/bdkgo.udl
cargo build --release
    Updating git repository `https://github.com/bitcoindevkit/bdk.git`
    Updating crates.io index
  Downloaded anyhow v1.0.80
  Downloaded autocfg v1.1.0
  Downloaded uniffi v0.25.0
  Downloaded uniffi_testing v0.25.0
  Downloaded uniffi_checksum_derive v0.25.3
  Downloaded uniffi_build v0.25.0
  Downloaded cargo-platform v0.1.7
  Downloaded paste v1.0.14
  Downloaded itoa v1.0.10
  Downloaded bitcoin-private v0.1.0
  Downloaded bytes v1.5.0
  Downloaded thiserror-impl v1.0.57
  Downloaded thiserror v1.0.57
  Downloaded weedle2 v4.0.0
  Downloaded uniffi_udl v0.25.0
  Downloaded oneshot v0.1.6
  Downloaded getrandom v0.2.12
  Downloaded quote v1.0.35
  Downloaded bitcoin_hashes v0.12.0
  Downloaded uniffi_macros v0.25.0
  Downloaded uniffi_meta v0.25.0
  Downloaded bitcoin_hashes v0.11.0
  Downloaded basic-toml v0.1.8
  Downloaded proc-macro2 v1.0.78
  Downloaded camino v1.1.6
  Downloaded uniffi_core v0.25.0
  Downloaded secp256k1 v0.27.0
  Downloaded cc v1.0.88
  Downloaded base64 v0.13.1
  Downloaded memchr v2.7.1
  Downloaded bip39 v2.0.0
  Downloaded unicode-normalization v0.1.22
  Downloaded uniffi_bindgen v0.25.0
  Downloaded serde_json v1.0.114
  Downloaded bitcoin v0.30.2
  Downloaded syn v2.0.52
  Downloaded miniscript v10.0.0
  Downloaded 37 crates (2.6 MB) in 1.21s
   Compiling proc-macro2 v1.0.78
   Compiling unicode-ident v1.0.12
   Compiling serde v1.0.197
   Compiling anyhow v1.0.80
   Compiling version_check v0.9.4
   Compiling thiserror v1.0.57
   Compiling minimal-lexical v0.2.1
   Compiling memchr v2.7.1
   Compiling camino v1.1.6
   Compiling serde_json v1.0.114
   Compiling autocfg v1.1.0
   Compiling semver v1.0.22
   Compiling libc v0.2.153
   Compiling paste v1.0.14
   Compiling ryu v1.0.17
   Compiling itoa v1.0.10
   Compiling cfg-if v1.0.0
   Compiling once_cell v1.19.0
   Compiling bytes v1.5.0
   Compiling mime v0.3.17
   Compiling bitcoin-private v0.1.0
   Compiling cc v1.0.88
   Compiling siphasher v0.3.11
   Compiling log v0.4.21
   Compiling ppv-lite86 v0.2.17
   Compiling unicase v2.7.0
   Compiling plain v0.2.3
   Compiling fs-err v2.11.0
   Compiling askama_escape v0.10.3
   Compiling hex_lit v0.1.1
   Compiling glob v0.3.1
   Compiling heck v0.4.1
   Compiling bitcoin v0.30.2
   Compiling base64 v0.13.1
   Compiling nom v7.1.3
   Compiling bech32 v0.9.1
   Compiling tinyvec_macros v0.1.1
   Compiling quote v1.0.35
   Compiling mime_guess v2.0.4
   Compiling static_assertions v1.1.0
   Compiling oneshot v0.1.6
   Compiling tinyvec v1.6.0
   Compiling syn v2.0.52
   Compiling getrandom v0.2.12
   Compiling bitcoin_hashes v0.11.0
   Compiling rand_core v0.6.4
   Compiling rand_chacha v0.3.1
   Compiling secp256k1-sys v0.8.1
   Compiling uniffi_core v0.25.0
   Compiling rand v0.8.5
   Compiling unicode-normalization v0.1.22
   Compiling askama_parser v0.2.1
   Compiling weedle2 v4.0.0
   Compiling serde_derive v1.0.197
   Compiling thiserror-impl v1.0.57
   Compiling uniffi_checksum_derive v0.25.3
   Compiling scroll_derive v0.11.1
   Compiling uniffi_meta v0.25.0
   Compiling scroll v0.11.0
   Compiling goblin v0.6.1
   Compiling cargo-platform v0.1.7
   Compiling basic-toml v0.1.8
   Compiling toml v0.5.11
   Compiling bincode v1.3.3
   Compiling bitcoin_hashes v0.12.0
   Compiling bip39 v2.0.0
   Compiling askama_derive v0.12.5
   Compiling cargo_metadata v0.15.4
   Compiling secp256k1 v0.27.0
   Compiling uniffi_testing v0.25.0
   Compiling uniffi_udl v0.25.0
   Compiling askama v0.12.1
   Compiling uniffi_bindgen v0.25.0
   Compiling miniscript v10.0.0
   Compiling bdk_chain v0.8.0 (https://github.com/bitcoindevkit/bdk.git?rev=070fffb95cddb9153f326d5662f206d25ecbcc7c#070fffb9)
   Compiling uniffi_build v0.25.0
   Compiling bdk v1.0.0-alpha.4 (https://github.com/bitcoindevkit/bdk.git?rev=070fffb95cddb9153f326d5662f206d25ecbcc7c#070fffb9)
   Compiling bdk_file_store v0.4.0 (https://github.com/bitcoindevkit/bdk.git?rev=070fffb95cddb9153f326d5662f206d25ecbcc7c#070fffb9)
   Compiling uniffi_macros v0.25.0
   Compiling uniffi v0.25.0
   Compiling bdkgo v0.1.0 (/usr/local/src/utreexod/bdkwallet/bdkgo_crate)
    Finished `release` profile [optimized] target(s) in 44.60s
go build --tags=bdkwallet -o . ./...
go: downloading github.com/utreexo/utreexo v0.3.3
go: downloading github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23
go: downloading github.com/aead/siphash v1.0.1
go: downloading github.com/btcsuite/btcd v0.24.0
go: downloading github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
go: downloading github.com/btcsuite/btcd/btcec/v2 v2.1.3
go: downloading github.com/cockroachdb/pebble v1.1.4
go: downloading github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
go: downloading golang.org/x/crypto v0.7.0
go: downloading github.com/btcsuite/btcd/btcutil v1.1.5
go: downloading github.com/stretchr/testify v1.9.0
go: downloading github.com/decred/dcrd/lru v1.0.0
go: downloading github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
go: downloading github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1
go: downloading github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/stretchr/objx v0.5.2
go: downloading golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/golang/snappy v0.0.4
go: downloading github.com/cockroachdb/errors v1.11.3
go: downloading github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce
go: downloading github.com/cockroachdb/redact v1.1.5
go: downloading github.com/prometheus/client_golang v1.12.0
go: downloading github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06
go: downloading golang.org/x/sys v0.18.0
go: downloading github.com/DataDog/zstd v1.4.5
go: downloading github.com/cespare/xxhash/v2 v2.2.0
go: downloading github.com/getsentry/sentry-go v0.27.0
go: downloading github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/golang/protobuf v1.5.3
go: downloading github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a
go: downloading github.com/prometheus/common v0.32.1
go: downloading github.com/prometheus/procfs v0.7.3
go: downloading google.golang.org/protobuf v1.33.0
go: downloading github.com/gogo/protobuf v1.3.2
go: downloading github.com/kr/pretty v0.3.1
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369
go: downloading github.com/kr/text v0.2.0
go: downloading github.com/rogpeppe/go-internal v1.9.0
go: downloading golang.org/x/text v0.14.0
go: downloading github.com/decred/dcrd/crypto/blake256 v1.0.0
# github.com/utreexo/utreexod/bdkwallet/bdkgo
bdkwallet/bdkgo/bdkgo.go:36:10: cannot define new methods on non-local type RustBuffer
bdkwallet/bdkgo/bdkgo.go:40:10: cannot define new methods on non-local type RustBuffer
bdkwallet/bdkgo/bdkgo.go:44:10: cannot define new methods on non-local type RustBuffer
bdkwallet/bdkgo/bdkgo.go:48:10: cannot define new methods on non-local type RustBuffer
bdkwallet/bdkgo/bdkgo.go:53:10: cannot define new methods on non-local type RustBuffer
bdkwallet/bdkgo/bdkgo.go:60:10: cannot define new methods on non-local type RustBuffer
make: *** [Makefile:15: build-utreexod] Error 1
root@slim:/usr/local/src/utreexod# make all
if ! type cargo; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ; fi
cargo is /root/.cargo/bin/cargo
if ! type uniffi-bindgen-go; then cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.0+v0.25.0 ; fi
uniffi-bindgen-go is /root/.cargo/bin/uniffi-bindgen-go
uniffi-bindgen-go -o bdkwallet bdkwallet/bdkgo_crate/src/bdkgo.udl
cargo build --release
Finished `release` profile [optimized] target(s) in 0.05s
go build --tags=bdkwallet -o . ./...
# github.com/utreexo/utreexod/bdkwallet/bdkgo
bdkwallet/bdkgo/bdkgo.go:36:10: cannot define new methods on non-local type RustBuffer
bdkwallet/bdkgo/bdkgo.go:40:10: cannot define new methods on non-local type RustBuffer
bdkwallet/bdkgo/bdkgo.go:44:10: cannot define new methods on non-local type RustBuffer
bdkwallet/bdkgo/bdkgo.go:48:10: cannot define new methods on non-local type RustBuffer
bdkwallet/bdkgo/bdkgo.go:53:10: cannot define new methods on non-local type RustBuffer
bdkwallet/bdkgo/bdkgo.go:60:10: cannot define new methods on non-local type RustBuffer
make: *** [Makefile:15: build-utreexod] Error 1

About my machine: Ubuntu Desktop 22.04 LTS, Go version 1.24.0 linux/amd64, Rust rustc 1.78.0.

@kcalvinalvin
Copy link
Contributor

Hey! Thanks for making the issue.

I was able to reproduce with go version 1.24.0 and seems like there was a change to the go toolchain. I'll push a fix soon so that it'll still build with 1.24.0.

For now, you could use a past go version or build without the bdk wallet:

# command to build without the bdk wallet.
go build -o . ./...

@whileunless
Copy link
Author

Thanks. I'll use the precompiled binaries in the newest release until you push a fix for that.

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