tag:crieit.net,2005:https://crieit.net/tags/Carbon/feed 「Carbon」の記事 - Crieit Crieitでタグ「Carbon」に投稿された最近の記事 2023-03-25T13:04:56+09:00 https://crieit.net/tags/Carbon/feed tag:crieit.net,2005:PublicArticle/18411 2023-03-21T22:33:28+09:00 2023-03-25T13:04:56+09:00 https://crieit.net/posts/Arch-Linux-WSL2-Carbon-2023-03-21 Arch Linux(WSL2)にCarbonをインストール(2023/03/21時点で未達) <p>Arch Linux(WSL2)にCarbonをインストールしてみようとした際の流れを記載。<br /> 2023/03/21時点で、エラーを解消できずに未達。</p> <p><strong>1.必要なパッケージをインストール</strong><br />  必要と思われる下記のパッケージをインストールした。<br />   ・bazel 6.0.0-2<br />   ・clang 15.0.7-2<br />   ・llvm 15.0.7-2<br />   ・lld 15.0.7-2<br />   ・libc++- 15.0.7-3<br />   ・libunwind 1.6.2-2</p> <p><strong>2.Carbonコードをgitからクローン</strong><br />  <a target="_blank" rel="nofollow noopener" href="https://github.com/carbon-language/carbon-lang#getting-started">Getting started</a>を参照。</p> <p><strong>3.ビルドと実行</strong><br />  <a target="_blank" rel="nofollow noopener" href="https://github.com/carbon-language/carbon-lang#getting-started">Getting started</a>を参照。</p> <p>ここで下記のエラーが発生。<br /> libunwind.aが見えていないようなんだけれど、インストールはできていた。<br /> .bash_profileにも「LD_LIBRARY_PATH」を追加してみたけど、エラーは解消できず。<br /> オプションをつけて、「bazel run //explorer -- ./explorer/testdata/print/format_only.carbon --linkopt=-L/usr/lib」で実行してみても変わらなかった。<br /> どうすればいいのかな。<br /> (2023/03/25追記)lddでライブラリを追加できるか試したけれど、参照できていないlibunwind.aは静的ライブラリなので、lddでは追加できない模様。<br /> <a href="https://crieit.now.sh/upload_images/03ba43d531f0692283dcc3b4f26ba2b66419b1676283b.png" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/03ba43d531f0692283dcc3b4f26ba2b66419b1676283b.png?mw=700" alt="エラー" /></a></p> <p><strong>【参考】Ubuntu 20.04(WSL)で試してみた結果</strong><br />  ① 必須パッケージのインストール<br />   <a target="_blank" rel="nofollow noopener" href="https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/contribution_tools.md#debian-or-ubuntu">セットアップコマンド(Debian または Ubuntu)</a><br />  ② bazelのインストール<br />   上記だとbazel、llvmのインストールに失敗したため、個別に対応。<br />   <a target="_blank" rel="nofollow noopener" href="https://bazel.build/install/ubuntu?hl=ja#install-on-ubuntu">Ubuntu への Bazel のインストール</a><br />   ③ 下記を参考にセットアップを実施<br />   llvmのインストールなど、設定を追加<br />   <a target="_blank" rel="nofollow noopener" href="https://zenn.dev/shiena/articles/6ef15e65a87b96">Linux(WSL)でCarbonを動かしてみた</a><br />   ④ 実行<br />   gitからcloneして実施してみたが、下記のエラーが発生した。<br />   <a href="https://crieit.now.sh/upload_images/6fa2b32f4952182d8cea3e2bad21f642641e7115775a0.png" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/6fa2b32f4952182d8cea3e2bad21f642641e7115775a0.png?mw=700" alt="image" /></a><br />  ⑤ bazelでプログラムだけでなく「carbon-explorer」もコンパイルしてメモリが足りていないのかな、と考えて「carbon-explorer」をインストール。<br />   <a target="_blank" rel="nofollow noopener" href="https://zenn.dev/shiena/articles/6ef15e65a87b96#carbon-explorer%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB">carbon-explorerをインストール</a><br />  ⑥ 実行<br />   できた!<br />   <a href="https://crieit.now.sh/upload_images/3d83e63948259ce4968109df94db7be6641e72002a8a1.png" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/3d83e63948259ce4968109df94db7be6641e72002a8a1.png?mw=700" alt="image" /></a></p> ao-iro