Tag Archives: rust

[Solved] ERROR: lib/bridge_generated.dart:837:9: Error: The parameter ‘ptr‘ of the method ‘FlutterRustB

[error reporting]

Launching lib/main.dart on Linux in debug mode...
Finished dev [unoptimized + debuginfo] target(s) in 0.04s
ERROR: lib/bridge_generated.dart:837:9: Error: The parameter 'ptr' of the method 'FlutterRustBridgeExampleWire.store_dart_post_cobject' has type 'int', which does not match the corresponding type, 'Pointer<NativeFunction<Bool Function(Int64, Pointer)>>', in the overridden method, 'FlutterRustBridgeWireBase.store_dart_post_cobject'.
ERROR: - 'Pointer' is from 'dart:ffi'.
ERROR: - 'NativeFunction' is from 'dart:ffi'.
ERROR: - 'Bool' is from 'dart:ffi'.
ERROR: - 'Int64' is from 'dart:ffi'.
ERROR: - 'Void' is from 'dart:ffi'.
ERROR: Change to a supertype of 'Pointer<NativeFunction<Bool Function(Int64, Pointer)>>', or, for a covariant parameter, a subtype.
ERROR: int ptr,
ERROR: ../../frb_dart/lib/src/basic.dart:153:8: Context: This is the overridden method ('store_dart_post_cobject').
ERROR: void store_dart_post_cobject(
Building Linux application...
Exception: Build process failed


$ export REPO_DIR=$PWD
$ cd /

$ flutter_rust_bridge_codegen \
    --rust-input $REPO_DIR/rust/src/api.rs \
    --dart-output $REPO_DIR/lib/bridge_generated.dart \
    --c-output $REPO_DIR/ios/Classes/bridge_generated.h
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "/home/consulting/Documents/native_add/rust/src/api.rs", dart_output_path: "/home/consulting/Documents/native_add/lib/bridge_generated.dart", c_output_path: "/home/consulting/Documents/native_add/ios/Classes/bridge_generated.h", rust_crate_dir: "/home/consulting/Documents/native_add/rust", rust_output_path: "/home/consulting/Documents/native_add/rust/src/bridge_generated.rs", class_name: "NativeAdd", dart_format_line_length: 80, skip_add_mod_to_lib: false }
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Parse source code to AST
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Parse AST to IR
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Transform IR
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Generate Rust code
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Generate Dart code
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Other things
[2021-10-22T14:39:34Z INFO  flutter_rust_bridge_codegen] Success! Now go and use it :)

$ cd $REPO_DIR

error[E0061]: this function takes 1 argument but 2 arguments were supplied

Error in compiling Trust: error [e0061]: this function takes 1 argument but 2 arguments were supplied

I didn’t find the relevant information. The preliminary judgment may be the problem of the version, because the code can be compiled in a low version.

Solutions are for reference only:

Error code:

let secret_number = rand::thread_rng().gen_range(1, 101);

Correct code:

let secret_number = rand::thread_rng().gen_range(1..101);

Compile after modification.

if a proxy or similar is necessary `net.git-fetch-with-cli`, Rust Complete `Couldn‘t resolve host name (Coul

linux rust download dependency error
if a proxy or similar is necessary net.git-fetch-with-cli
Create config in cargo
vi ~/.cargo/config
add proxy

proxy = ""
proxy = ""

Or modify the download warehouse

registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

Pro test, modify and download the warehouse.

Solution to the error in compiling couldn't resolve host name (could not resolve host: Crites) by rust

When compiling the rust source program, the following couldn’t resolve host name (couldn’t resolve host: Crites) errors may occur (see https://github.com/ustclug/discussions/issues/294 )。

A temporary solution is to add the environment variable cargo when running cargo_ HTTP_ MULTIPLEXING=false。 The function is to cancel parallel downloads. For specific reasons, please refer to the error report of building rustc after using the image.

Pro test passed!

Running trust error reporting linker ‘link. Exe’ not found on Windows

Running trust error reporting linker link.exe not found on Windows

Because on the windows platform, the trust compiler needs the vs C + + compiler. The error usually occurs when using rust C main.rs, because visual studio or C + + build tools are not installed on windows

I download visual studio 2017, install the C + + workload, pro test passed!

Official download address:

[Solved] error: failed to run custom build command for `librocksdb-sys v6.17.3`

Prompt for error in trust build:

error: failed to run custom build command for `librocksdb-sys v6.17.3`



   Compiling ed25519-dalek v1.0.1
   Compiling tracing-subscriber v0.2.17
   Compiling schnorrkel v0.9.1
   Compiling addr2line v0.14.1
   Compiling prost-build v0.7.0
   Compiling mio-uds v0.6.8
error: failed to run custom build command for `librocksdb-sys v6.17.3`

Caused by:
  process didn't exit successfully: `/home/y/IdeaProjects/MinixChain/target/release/build/librocksdb-sys-6de902cd8dc81c39/build-script-build` (exit code: 101)
  --- stderr
  thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\', \'libclang-*.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', /home/y/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.57.0/src/lib.rs:1975:31
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed


sudo apt install llvm clang

Solve rstudio software error: fatal error error system error 5 (access denied) problem, pro test effective

1. Error reporting:

2. Error report: because the current system user name is in Chinese, there is a garbled code when reading the path, which cannot be recognized.

3. Solution: modify the values of the current user’s environment variables temp and TMP. Change the variable value to a path without Chinese name.

4. Restart rsudio software: the software can be used normally.

Rust solves cargo build too slowly

Replace the crates repository source

    Open or create a new er directory /.cargo/config f>to add the configuration

to the>

registry = "https://github.com/rust-lang/crates.io-index"

replace-with = 'tuna'
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
    Save exit

Cargo invoice has failed: error: exit code: 101

Rust language
When you edit the Rust “Thebook” second chapter “guess” game Code in VS Code, try adding a rand dependency in cargo. Toml, which is


rand = "0.7.3"

after typing $cargo build on the command line,

is found

Cargo invocation has failed: Error: exit code: 101.

such a popup reminder, prompt crate enable failure.

OUTPUT window prompts as follows:

Running `cargo build --bin=instances --package=instances
    Blocking waiting for file lock on package cache
    Updating crates.io index warning: spurious network error (2 tries remaining): failed to send request: 操作超时 ; class=Os (2) 
    warning: spurious network error (1 tries remaining): failed to send request: 操作超时 ; class=Os (2) 
    error: failed to get `rand` as a dependency of package `instances v1.46.0 (D:\DataFiles\CodesLearning\RUST\Instances)`

Caused by:   failed to load source for dependency `rand`

Caused by:   Unable to update registry `https://github.com/rust-lang/crates.io-index`

Caused by:   failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:   failed to send request: 操作超时  ; class=Os (2)

it turned out that the connection to Github was timed out. This problem will also be pop-ups for installed updates that are ignored when checking the rust-Analyzer plug-in version every time VS Code is started.

below provides the method to connect to Github. This method also applies to the problem of not being able to connect to Github when a web page is logged on. IP addresses are usually added to the HOSTS file.
host files in C:// Windows/system32/dreivrs/etc directory. You can right click -> Property changes the write permission of User before editing and saving.
can be learned that the current lot by https://github.com.ipaddress.com/www.github.com website IP address has been changed, so a lot of articles referred to in the hosts change have failed. The code added to the hosts file is provided as follows:

#Github github.com 

of course, it is more recommended to use the above link to query before making changes, to prevent IP address update invalid. Finally, don’t forget to save the file hosts, , and unwrite User .