1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

実践Rustプログラミング入門でつまづいたところ【随時更新】

Last updated at Posted at 2023-01-30

はじめに

実践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にする

おわりに

書籍の学習が終わり次第書きます

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?