@@ -14,8 +14,8 @@ Rustにおけるリンクの一般的なケースについては本書の前の
1414<!-- the `link_args` attribute. This attribute is applied to `extern` blocks and -->
1515<!-- specifies raw flags which need to get passed to the linker when producing an -->
1616<!-- artifact. An example usage would be: -->
17- どのようにリンクをカスタマイズするかを` rustc ` に指示するために、1つの方法があります。それは、` link_args ` アトリビュートを使うことです。
18- このアトリビュートは` extern ` ブロックに適用され、生成物を作るときにリンカに渡したいフラグをそのまま指定します。
17+ どのようにリンクをカスタマイズするかを ` rustc ` に指示するために、1つの方法があります。それは、 ` link_args ` アトリビュートを使うことです。
18+ このアトリビュートは ` extern ` ブロックに適用され、生成物を作るときにリンカに渡したいフラグをそのまま指定します。
1919使い方の例は次のようになります。
2020
2121``` no_run
@@ -34,14 +34,14 @@ extern {}
3434<!-- LLVM directly to link native libraries, in which case `link_args` will have no -->
3535<!-- meaning. You can achieve the same effect as the `link_args` attribute with the -->
3636<!-- `-C link-args` argument to `rustc`. -->
37- これはリンクを実行するための認められた方法ではないため、この機能は現在` feature(link_args) ` ゲートによって隠されているということに注意しましょう。
38- 今は` rustc ` がシステムリンカ(多くのシステムでは` gcc ` 、MSVCでは` link.exe ` )に渡すので、追加のコマンドライン引数を提供することには意味がありますが、それが今後もそうだとは限りません。
39- 将来、` rustc ` がネイティブライブラリをリンクするためにLLVMを直接使うようになるかもしれませんし、そのような場合には` link_args ` は意味がなくなるでしょう。
40- ` rustc ` に ` -C link-args ` 引数をつけることで、` link_args ` アトリビュートと同じような効果を得ることができます。
37+ これはリンクを実行するための認められた方法ではないため、この機能は現在 ` feature(link_args) ` ゲートによって隠されているということに注意しましょう。
38+ 今は ` rustc ` がシステムリンカ(多くのシステムでは ` gcc ` 、MSVCでは ` link.exe ` )に渡すので、追加のコマンドライン引数を提供することには意味がありますが、それが今後もそうだとは限りません。
39+ 将来、 ` rustc ` がネイティブライブラリをリンクするためにLLVMを直接使うようになるかもしれませんし、そのような場合には ` link_args ` は意味がなくなるでしょう。
40+ ` rustc ` に ` -C link-args ` 引数をつけることで、 ` link_args ` アトリビュートと同じような効果を得ることができます。
4141
4242<!-- It is highly recommended to *not* use this attribute, and rather use the more -->
4343<!-- formal `#[link(...)]` attribute on `extern` blocks instead. -->
44- このアトリビュートは使わ * ない* ことが強く推奨されているので、代わりにもっと正式な` #[link(...)] ` アトリビュートを` extern ` ブロックに使いましょう。
44+ このアトリビュートは使わ * ない* ことが強く推奨されているので、代わりにもっと正式な ` #[link(...)] ` アトリビュートを ` extern ` ブロックに使いましょう。
4545
4646<!-- # Static linking -->
4747# スタティックリンク
@@ -55,7 +55,7 @@ extern {}
5555<!-- change this and statically link them as well. -->
5656スタティックリンクとは全ての必要なライブラリを含めた成果物を生成する手順のことで、そうすればコンパイルされたプロジェクトを使いたいシステム全てにライブラリをインストールする必要がなくなります。
5757Rustのみで構築された依存関係はデフォルトでスタティックリンクされます。そのため、Rustをインストールしなくても、作成されたバイナリやライブラリを使うことができます。
58- 対照的に、ネイティブライブラリ(例えば` libc ` や ` libm ` )はダイナミックリンクされるのが普通です。しかし、これを変更してそれらを同様にスタティックリンクすることも可能です。
58+ 対照的に、ネイティブライブラリ(例えば ` libc ` や ` libm ` )はダイナミックリンクされるのが普通です。しかし、これを変更してそれらを同様にスタティックリンクすることも可能です。
5959
6060<!-- Linking is a very platform-dependent topic, and static linking may not even be -->
6161<!-- possible on some platforms! This section assumes some basic familiarity with -->
@@ -69,8 +69,8 @@ Rustのみで構築された依存関係はデフォルトでスタティック
6969<!-- By default, all Rust programs on Linux will link to the system `libc` along with -->
7070<!-- a number of other libraries. Let's look at an example on a 64-bit Linux machine -->
7171<!-- with GCC and `glibc` (by far the most common `libc` on Linux): -->
72- デフォルトでは、Linux上の全てのRustのプログラムはシステムの` libc ` とその他のいくつものライブラリとリンクされます。
73- GCCと` glibc ` (Linuxにおける最も一般的な` libc ` )を使った64ビットLinuxマシンでの例を見てみましょう。
72+ デフォルトでは、Linux上の全てのRustのプログラムはシステムの ` libc ` とその他のいくつものライブラリとリンクされます。
73+ GCCと ` glibc ` (Linuxにおける最も一般的な ` libc ` )を使った64ビットLinuxマシンでの例を見てみましょう。
7474
7575``` text
7676$ cat example.rs
@@ -95,8 +95,8 @@ $ ldd example
9595<!-- Static linking is supported via an alternative `libc`, [`musl`](http://www.musl-libc.org). You can compile -->
9696<!-- your own version of Rust with `musl` enabled and install it into a custom -->
9797<!-- directory with the instructions below: -->
98- スタティックリンクは代わりの` libc ` である[ ` musl ` ] ( http://www.musl-libc.org/ ) によってサポートされています。
99- 以下の手順に従い、` musl ` を有効にした独自バージョンのRustをコンパイルして独自のディレクトリにインストールすることができます。
98+ スタティックリンクは代わりの ` libc ` である [ ` musl ` ] ( http://www.musl-libc.org/ ) によってサポートされています。
99+ 以下の手順に従い、 ` musl ` を有効にした独自バージョンのRustをコンパイルして独自のディレクトリにインストールすることができます。
100100
101101``` text
102102$ mkdir musldist
@@ -142,7 +142,7 @@ $ du -h musldist/bin/rustc
142142<!-- You now have a build of a `musl`-enabled Rust! Because we've installed it to a -->
143143<!-- custom prefix we need to make sure our system can find the binaries and appropriate -->
144144<!-- libraries when we try and run it: -->
145- これで` musl ` が有効になったRustのビルドが手に入りました!
145+ これで ` musl ` が有効になったRustのビルドが手に入りました!
146146独自のプレフィックスを付けてインストールしたので、試しに実行するときにはシステムがバイナリと適切なライブラリを見付けられることを確かめなければなりません。
147147
148148``` text
@@ -171,5 +171,5 @@ thread '<main>' panicked at 'failed', example.rs:1
171171<!-- `cargo build` also permits the `--target` option so you should be able to build -->
172172<!-- your crates as normal. However, you may need to recompile your native libraries -->
173173<!-- against `musl` before they can be linked against. -->
174- ` cargo build ` も ` --target ` オプションを受け付けるので、あなたのクレートも普通にビルドできるはずです。
175- ただし、リンクする前にネイティブライブラリを` musl ` 向けにリコンパイルする必要はあるかもしれません。
174+ ` cargo build ` も ` --target ` オプションを受け付けるので、あなたのクレートも普通にビルドできるはずです。
175+ ただし、リンクする前にネイティブライブラリを ` musl ` 向けにリコンパイルする必要はあるかもしれません。
0 commit comments