見出し画像

~番外編~ラズベリーパイ PICOでWEBサーバーを作る。(よくわかりませんが、エラー"fatal error: pico/version.h: No such file or directory 20 | #include "pico/version.h"を解決しました。)

93日目

ラズパイ picoへnuttxの環境を構築するたびに発生するエラー"pico/version.h"を解決しました。
$ makeを実行後に必ず発生していた"fatal error: pico/version.h: No such file or directory 20 | #include "pico/version.h"の原因を分析していましたが、エラー文を読み解くとpicoの階層にある、pico.hに#include "pico/version.h"が記載されていませんよ!!!という内容なのですが、cat pico.hコマンドで調べると#include "pico/version.h"が既に記載されているので、原因不明のエラーでした。(参考までに階層を張り付けておきます$ cd pico/pico-sdk/src/common/pico_base/include/pico.h)

ネットで探していたら、海外でも記事数は少ないのですが、困っている人がいるみたいで、pico-sdkのバージョン1.1.2をクローンすれば良いと書いていましたが、そもそもバージョン1.1.2は存在しませんでした。参考までに↓↓なんか困っていますよ記事
https://gitmemory.cn/repo/apache/incubator-nuttx/issues/4919
https://lists.apache.org/thread/s70cdwpmj3odldgqbbywso4xo8lq0jt9

そして、たまたま新しいバージョンをクローンするために古いpico-sdkを削除していたので、再クローンして、試しにnuttxでmakeコマンドを実行したら、nuttx.uf2ファイルが作成されて、エラーの解決ができました。なんか原因不明のエラーがいつのまにか解決していました。


参考までに僕が実行したコマンドを参考までに載せておきます。
(※前回の記事を見ている人はpico-sdkのインストール方法に誤りがありました。ラズパイの公式https://datasheets.raspberrypi.org/pico/getting-started-with-pico.pdfを確認したら、開発環境にラズパイを使用するなら前回記事に載せていた方法ですが、僕は使用していないので、Chapter 2. The Pico SDKの方法でpico-sdkを構築する必要があります。)


wsl上の環境構築
$ cd ~/
$ mkdir pico
$ cd pico
$ git clone -b master https://github.com/raspberrypi/pico-sdk.git
$ cd pico-sdk
$ git submodule update --init
$ cd ..
$ git clone -b master https://github.com/raspberrypi/pico-examples.git
$ sudo apt update
$ sudo apt install cmake gcc-arm-none-eabi build-essential

kconfigの構築
$ sudo apt install bison flex gettext libncurses5-dev gperf automake-1.15 libtool pkg-config
$ git clone https://bitbucket.org/nuttx/tools.git
$ cd tools/kconfig-frontends/
$ ./configure --enable-mconf --disable-nconf --disable-gconf --disable-qconf
$ make
$ sudo make install
$ sudo /sbin/ldconfig

nuttxの構築
$ git clone https://github.com/apache/incubator-nuttx.git nuttx
$ git clone https://github.com/apache/incubator-nuttx-apps.git apps
$ cd nuttx
$ ./tools/configure.sh raspberrypi-pico:nsh
$ make

ここからエラーを修正するために実行したコマンド
$ cd
$ cd pico
$ rm -rf pico-sdk
$ git clone -b master https://github.com/raspberrypi/pico-sdk.git
$ cd pico-sdk
$ git submodule update --init
$ cd
$ cd nuttx
$ ./tools/configure.sh raspberrypi-pico:usbnsh
$ make

エラーが出ていたのが、再度 pico-sdkをインストール

エラー画像

再度、makeして、エラーを解決しました。

era- 画像



参考までに!!
<NuttxをリリースしているApacheの人たちは下記で構築しています。>
結局このやり方はpico-sdkのバージョンは1.1.2は存在していなかったので、解決にはいたりませんでしたが、参考までに載せておきます。
$ sudo apt-get install automake bison build-essential flex gcc-arm-none-eabi gperf git libncurses5-dev libtool libusb-dev libusb-1.0.0-dev pkg-config git
$ git clone -b 1.1.2 master https://github.com/raspberrypi/pico-sdk.git
$ sudo mkdir /opt/rasp_pico
$ sudo mv pico-sdk /opt/rasp_pico/
$ export PICO_SDK_PATH=/opt/rasp_pico/pico-sdk
$ git clone https://github.com/apache/incubator-nuttx.git nuttx
$ git clone https://github.com/apache/incubator-nuttx-apps.git apps
$ make distclean
NuttX has not been configured!
To configure the project:
tools/configure.sh <config>
For a list of available configurations:
tools/configure.sh -L
$ ./tools/configure.sh raspberrypi-pico:nsh
$ make


この記事が気に入ったらサポートをしてみませんか?