How Do You Troubleshoot the Cargo Problem “error[E0658]: use of unstable library feature ‘str_strip’: newly added”?

Problem scenario
You run a cargo command. You get this error:

error[E0658]: use of unstable library feature ‘str_strip’: newly added
–/home/jdoe/.cargo/registry/src/github.com-1ecc6299db9ec823/ethbloom-0.10.0/src/lib.rs:69:1
|
69 | / construct_fixed_hash! {
70 | | /// Bloom hash type with 256 bytes (2048 bits) size.
71 | | pub struct Bloom(BLOOM_SIZE);
72 | | }
| |_^
|
= note: see issue #67302 https://github.com/rust-lang/rust/issues/67302 for more information
= note: this error originates in a macro (in Nightly builds,

 » Read more..

Where Can You Find the build_rust.sh Script?

Problem scenario
You want to use Rust and Incubed (the Blockchains in3 crate). You search for “build_rust.sh”, but you find irrelevant build-rust.sh files. How do you find the one with the underscore (or underbar) and not the hyphen/dash?

Solution
Here is the content:

#!/bin/sh
cd ..
mkdir -p rust/in3-sys/in3-core
mkdir -p rust/in3-sys/in3-core/c
cp -r c/CMakeLists.txt c/macro.cmake c/compiler.cmake c/docs c/src c/include rust/in3-sys/in3-core/c/
cp CMakeLists.txt rust/in3-sys/in3-core/
export UPDATE_IN3_BINDINGS=1
cd rust &&  » Read more..

How Do You Troubleshoot the Cargo/Rust Error “use of undeclared type or module”?

Problem Scenario
You run a “cargo run” command. You get an error like one or more of the following:

use of undeclared type or module api

use of undeclared type or module serde_json

use of undeclared type or module async-std

What should you do?

Solution
Update the Cargo.toml file. The dependencies section should have an entry like one of the following (but the version number may or may not differ):

[package]
name = “in3-tutorial”
version = “0.0.1”
authors = [”reader@medium.com”]
edition = “2018”

[dependencies]
in3 = “0.1.7”
async-std = “1.5.0”
futures-executor = “0.3.5”
serde_json = “1.0”
ethabi = “13.0.0”
ethereum_abi = “0.2.0”
ethbloom = “0.10.0”

[[bin]]
name = “in3”
path = “/home/jdoe/rust/contint.rs”

If you are not sure what version is valid,

 » Read more..

How Do You Troubleshoot “cp: cannot stat …: No such file or directory” when Running build_rust.sh?

Problem scenario
You are running build_rust.sh to use Blockchains’ Incubed. But you get an error message like this:

cp: cannot stat ‘c/CMakeLists.txt’: No such file or directory
cp: cannot stat ‘c/macro.cmake’: No such file or directory
cp: cannot stat ‘c/compiler.cmake’: No such file or directory
cp: cannot stat ‘c/docs’: No such file or directory
cp: cannot stat ‘c/src’: No such file or directory
cp: cannot stat ‘c/include’: No such file or directory
cp: cannot stat ‘CMakeLists.txt’: No such file or directory

What should you do?

 » Read more..

How Do You Troubleshoot the Cargo Problem “error: no such subcommand: add”?

Problem scenario
You run a Cargo command, but you get this:

error: no such command `add`
Did you mean `b`?

What should you do?

Solution
Run this: sudo cargo install cargo-edit

It can take 15 minutes to run. This should eliminate the problem.

 » Read more..

How Do You Write a “Hello World” Command in Rust?

Problem scenario
You want to write a basic program in Rust to know you have it installed correctly. What do you do?

Solution

  1. Install Rust. If you need assistance, try this command:

sudo curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh

2. Create a file called contint.rs with the following four lines:

// We recommend calling this contint.rs
fn main() {
println!(“Hello World!”);  » Read more..

How Do You Install Rust on Any Distribution of Linux?

Problem scenario
You want to install Rust on Linux (e.g., SUSE, Debian/Ubuntu or CentOS/RHEL/Fedora).

Solution

  1. Run this command:

sudo curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh

Choose “1” and press enter.

2. Run this command:

source $HOME/.cargo/env  » Read more..

How Do You Troubleshoot Error Messages in a Bash Script?

Problem scenario
You run a shell or bash script but you receive an error message such as one of the following:

$’\r’: command not found
line:55 syntax error: unexpected end of file

Solution
Did you download the file from the internet directly to the Unix system? The root cause could be that there are invisible characters in the file.

 » Read more..

How Do You Troubleshoot the Bash Script Error “line 5: $’\r’: command not found”?

Problem scenario
You drafted a Bash script on a Windows computer.  You then uploaded it to Google Cloud Platform via a web browser feature.  When you run the bash script on a Linux server (e.g., in GCP), you get this error “line 5: $’\r’: command not found”.  You do not want to install dos2unix or any new packages.  What should you do?

Solution
The file needs to be modified or “cleaned up.” 

 » Read more..

How Do You Write a Hello World Program in Lua?

Problem scenario
You want to run a basic Lua program as a test.  What do you do?

Solution
Prerequisite

You must have installed the Lua compiler.  If you are using a CentOS/RHEL/Fedora server, try this link.

Procedures
1.  Create a file called contint.lua with the following line:
print(“This is a Hello World program”)

2. 

 » Read more..