1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

rustビルドのtips

1
Posted at
  • cargo.tomlopt-levelコンパイル時の最適化レベル 高いほどビルド時間が長い
    • [profile.dev] 自分がビルドするとき デバッグ時何度もビルドする
    • [profile.dev.package."*"] パッケージをビルドするとき 一度しかビルドしない
[package]
name = "project_name"
version = "0.1.0"

[dependencies]
tokio = "0.1.0"

[profile.dev]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3
  • パッケージ追加時のcargo add tokio -F dynamic_linking

    • ビルド時に動的リンキング
    • パッケージ全体ではなくコード内で参照された部分だけリンクする
  • 別のリンカを使う

    • 開発環境に入れておけばデフォルトより速いリンカが使える
    • mkdir .cargoからのtouch config.toml
[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe" # rustのツールチェーンにもともと入ってる

[target.x86_64-unknown-linux-gnu]
linker = clang
rustflags = ["-C", "link-arg=-fuse-ld=lld"] # ubuntuに入れておいた
1
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?