はじめに
実践Rustプログラミング入門
をやっていて書籍通りに動かなかったところをまとめていきます
この記事は現在更新中です。7章、8章は飛ばしています
Chapter4
no method named about
found for struct clap::Arg
エラー
about
でエラーがでてしまった
この記事によると3系
で書き方が変わったよう
サンプルリポジトリのコードが更新されていたのでこちらを利用した
unresolved import clap::Clap
3系で変わった
またclap
のバージョンを以下に変更した
Cargo.toml
clap = { version="3.0.0", features=["derive"] }
Chapter5
sqliteを導入した際にエラー
以下のエラーが発生してしまう
error: failed to select a version for `libsqlite3-sys`.
... required by package `rusqlite v0.28.0`
... which satisfies dependency `rusqlite = "^0.28"` of package `r2d2_sqlite v0.21.0`
... which satisfies dependency `r2d2_sqlite = "^0.21.0"` of package `rust-todo-web-app v0.1.0 (/app)`
versions that meet the requirements `^0.25.0` are: 0.25.2, 0.25.1, 0.25.0
the package `libsqlite3-sys` links to the native library `sqlite3`, but it conflicts with a previous package which links to `sqlite3` as well:
package `libsqlite3-sys v0.18.0`
... which satisfies dependency `libsqlite3-sys = "^0.18.0"` of package `rusqlite v0.23.0`
... which satisfies dependency `rusqlite = "^0.23"` of package `rust-todo-web-app v0.1.0 (/app)`
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='libsqlite3-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
failed to select a version for `libsqlite3-sys` which could resolve this conflict
Cargo.tomlを以下にした
Cargo.toml
rusqlite = { version = "0.25.3", features=["bundled"] }
r2d2 = "0.8.9"
r2d2_sqlite = "0.18.0"
Chapter6
npm run startでerror: error:0308010c:digital envelope routines::unsupported
以下の環境変数を設定する
$ export NODE_OPTIONS=--openssl-legacy-provider
# gitにpushできなくなったので以下を実行した
$ unset NODE_OPTIONS
Nodeが最新だったので17にもしました
$ n stable
$ n # node 17にする
おわりに
書籍の学習が終わり次第書きます