次はPython。でも...
続いてPythonを確認します。本家のUbuntuディストリビューションであればPythonのVer. 2系がインストールされていると思います。しかし、WSLでは何がインストールされているのでしょうか。まず確認してみたいと思います。
$ python --version ↵ The program 'python' can be found in the following packages: * python-minimal * python3 Try: sudo apt install
おや?
インストールされていないようです。
全ての開発作業をLinuxで行う場合はPythonが必要なことは理解しています。しかし、今回の環境はWSLです。コンパイル環境を構築しているにすぎません。
そこでPythonは、必要になってからインストールすることにします。
ツールチェインの準備
クロスコンパイルを行う際にはツールチェインというものが必要なのだそうです。
ARMなどの有名なCPUであればビルド済みのツールチェインが提供されていたりするようですが、ESP8266で利用されているCPUのツールチェインは自前でビルドする必要があるようです。
$ mkdir ~/build_sdk ↵
$ cd ~/build_sdk ↵
$ git clone -b lx106 git://github.com/jcmvbkbc/crosstool-NG.git ↵ Cloning into 'crosstool-NG'... remote: Counting objects: 33801, done. remote: Total 33801 (delta 0), reused 0 (delta 0), pack-reused 33800 Receiving objects: 100% (33801/33801), 17.06 MiB | 39.00 KiB/s, done. Resolving deltas: 100% (20003/20003), done. Checking connectivity... done. Checking out files: 100% (1602/1602), done.
$ cd crosstool-NG ↵
$ ./bootstrap ↵ Running autoconf... Done. You may now run: ./configure
$ ./configure --prefix=/opt/Espressif ↵ checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking whether sed understands -r -i -e... yes checking whether ln -s works... yes checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for ranlib... ranlib checking for gobjcopy... no checking for objcopy... objcopy checking for absolute path to objcopy... /usr/bin/objcopy checking for gobjdump... no checking for objdump... objdump checking for absolute path to objdump... /usr/bin/objdump checking for greadelf... no checking for readelf... readelf checking for absolute path to readelf... /usr/bin/readelf checking for gperf... gperf checking for absolute path to gperf... /usr/bin/gperf checking for bison... bison checking for flex... flex checking for makeinfo... makeinfo checking for cut... cut checking for stat... stat checking for readlink... readlink checking for wget... wget checking for tar... tar checking for gzip... gzip checking for bzip2... bzip2 checking for patch... /usr/bin/patch checking for bash >= 3.1... /bin/bash checking for GNU awk... /usr/bin/gawk checking for GNU make >= 3.80... /usr/bin/make checking whether /usr/bin/make sets $(MAKE)... yes checking for make 3.81... no checking for GNU libtool >= 1.5.26... no configure: error: could not find GNU libtool >= 1.5.26
おや?libtool
がないと怒られました。確認してみましょう。
$ dpkg -l libtool ↵ Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-========================-=================-=================-===================================================== ii libtool 2.4.6-0.1 all Generic library support script
Ver. 2.4.6
がインストールされていることがわかります。
>= 1.5.26
とあるのに、どういうことでしょうか?もしかしたらVer. 1系列でないといけないのでしょうか。
まずは、Ver. 1系列のパッケージがあるか確認してみます。
$ apt-cache policy libtool ↵ libtool: Installed: 2.4.6-0.1 Candidate: 2.4.6-0.1 Version table: *** 2.4.6-0.1 500 500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages 100 /var/lib/dpkg/status
$ apt-cache search libtool ↵ autotools-dev - Update infrastructure for config.{guess,sub} files libltdl-dev - System independent dlopen wrapper for GNU libtool libltdl7 - System independent dlopen wrapper for GNU libtool libtool - Generic library support script libtool-bin - Generic library support script (libtool binary) libtool-doc - Generic library support script clang-modernize-3.5 - Tool to convert C++98 and C++03 code to C++11 clang-modernize-3.6 - Tool to convert C++98 and C++03 code to C++11 clang-modernize-3.7 - Tool to convert C++98 and C++03 code to C++11 cpp11-migrate-3.5 - Tool to convert C++98 and C++03 code to C++11 cpp11-migrate-3.6 - Tool to convert C++98 and C++03 code to C++11 - transition package cpp11-migrate-3.7 - Tool to convert C++98 and C++03 code to C++11 gnome-common - common scripts and macros to develop with GNOME libchardet-dev - universal charset detection library - development files libchardet1 - universal charset detection library - shared library libcrypto++-dev - General purpose cryptographic library - C++ development libtoolkit-perl - Keep your handy modules organized libtools-cli-clojure - command line argument parser for Clojure libtools-logging-clojure - Logging macros for Clojure libtools-macro-clojure - Clojure tools for writing macros mate-common - common scripts and macros to develop with MATE
そのようなものはありませんね。
困ったときのGoogle頼み。お伺いを立てることにします。
Installing libtool-bin solves this issue.
libtool-bin
をインストールすればよさそうです。
$ sudo apt-get -y install libtool-bin ↵ : 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. : Setting up libtool-bin (2.4.6-0.1) ...
$ ./configure --prefix=/opt/Espressif ↵ checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking whether sed understands -r -i -e... yes checking whether ln -s works... yes checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for ranlib... ranlib checking for gobjcopy... no checking for objcopy... objcopy checking for absolute path to objcopy... /usr/bin/objcopy checking for gobjdump... no checking for objdump... objdump checking for absolute path to objdump... /usr/bin/objdump checking for greadelf... no checking for readelf... readelf checking for absolute path to readelf... /usr/bin/readelf checking for gperf... gperf checking for absolute path to gperf... /usr/bin/gperf checking for bison... bison checking for flex... flex checking for makeinfo... makeinfo checking for cut... cut checking for stat... stat checking for readlink... readlink checking for wget... wget checking for tar... tar checking for gzip... gzip checking for bzip2... bzip2 checking for patch... /usr/bin/patch checking for bash >= 3.1... /bin/bash checking for GNU awk... /usr/bin/gawk checking for GNU make >= 3.80... /usr/bin/make checking whether /usr/bin/make sets $(MAKE)... yes checking for make 3.81... no checking for GNU libtool >= 1.5.26... /usr/bin/libtool checking for GNU libtoolize >= 1.5.26... /usr/bin/libtoolize checking for GNU automake >= 1.10... /usr/bin/automake checking for xz... xz checking for cvs... no checking for svn... no checking for inline... inline checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible realloc... yes checking for size_t... yes checking for working alloca.h... yes checking for alloca... yes checking libintl.h usability... yes checking libintl.h presence... yes checking for libintl.h... yes checking whether gettext is declared... yes checking ncurses/ncurses.h usability... no checking ncurses/ncurses.h presence... no checking for ncurses/ncurses.h... no checking ncurses/curses.h usability... no checking ncurses/curses.h presence... no checking for ncurses/curses.h... no checking ncursesw/curses.h usability... no checking ncursesw/curses.h presence... no checking for ncursesw/curses.h... no checking ncurses.h usability... yes checking ncurses.h presence... yes checking for ncurses.h... yes checking for library containing initscr... -lncurses configure: creating ./config.status config.status: creating Makefile
$ make ↵ SED 'ct-ng' SED 'scripts/crosstool-NG.sh' SED 'scripts/saveSample.sh' SED 'scripts/showTuple.sh' GEN 'config/configure.in' GEN 'paths.mk' GEN 'paths.sh' DEP 'nconf.gui.dep' DEP 'nconf.dep' DEP 'lxdialog/yesno.dep' DEP 'lxdialog/util.dep' DEP 'lxdialog/textbox.dep' DEP 'lxdialog/menubox.dep' DEP 'lxdialog/inputbox.dep' DEP 'lxdialog/checklist.dep' DEP 'mconf.dep' DEP 'conf.dep' BISON 'zconf.tab.c' GPERF 'zconf.hash.c' LEX 'lex.zconf.c' DEP 'zconf.tab.dep' CC 'zconf.tab.o' CC 'conf.o' LD 'conf' CC 'lxdialog/checklist.o' CC 'lxdialog/inputbox.o' CC 'lxdialog/menubox.o' CC 'lxdialog/textbox.o' CC 'lxdialog/util.o' CC 'lxdialog/yesno.o' CC 'mconf.o' LD 'mconf' CC 'nconf.o' CC 'nconf.gui.o' LD 'nconf' SED 'docs/ct-ng.1' GZIP 'docs/ct-ng.1.gz'
$ sudo make install ↵ GEN 'config/configure.in' GEN 'paths.mk' GEN 'paths.sh' MKDIR '/opt/Espressif/bin/' INST 'ct-ng' MKDIR '/opt/Espressif/lib/ct-ng.1.20.0/' INSTDIR 'config/' INSTDIR 'contrib/' INSTDIR 'patches/' INSTDIR 'scripts/' INST 'steps.mk' INST 'paths' INSTDIR 'samples/' INST 'kconfig/' MKDIR '/opt/Espressif/share/doc/crosstool-ng/ct-ng.1.20.0/' INST 'docs/*.txt' MKDIR '/opt/Espressif/share/man/man1/' INST 'ct-ng.1.gz' For auto-completion, do not forget to install 'ct-ng.comp' into your bash completion directory (usually /etc/bash_completion.d)
$ ./ct-ng xtensa-lx106-elf ↵ MKDIR config.gen IN config.gen/arch.in IN config.gen/kernel.in IN config.gen/cc.in IN config.gen/binutils.in IN config.gen/libc.in IN config.gen/debug.in CONF config/config.in # # configuration saved # *********************************************************** Initially reported by: Max Filippov <jcmvbkbc@gmail.com> URL: http://www.esp8266.com/viewtopic.php?f=9&t=224 *********************************************************** WARNING! This sample may enable experimental features. Please be sure to review the configuration prior to building and using your toolchain! Now, you have been warned! *********************************************************** Now configured for "xtensa-lx106-elf"
$ ./ct-ng build ↵ [INFO ] Performing some trivial sanity checks [INFO ] Build started 20180329.161226 [INFO ] Building environment variables [INFO ] ================================================================= [INFO ] Retrieving needed toolchain components' tarballs [ERROR] [ERROR] >> [ERROR] >> Build failed in step 'Retrieving needed toolchain components' tarballs' [ERROR] >> called in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: do_mpc_get[scripts/build/companion_libs/140-mpc.sh@741] [ERROR] >> called from: do_companion_libs_get[scripts/build/companion_libs.sh@15] [ERROR] >> called from: main[scripts/crosstool-NG.sh@583] [ERROR] >> [ERROR] >> For more info on this error, look at the file: 'build.log' [ERROR] >> There is a list of known issues, some with workarounds, in: [ERROR] >> '/opt/Espressif/share/doc/crosstool-ng/ct-ng.1.20.0/B - Known issues.txt' [ERROR] [ERROR] (elapsed: 6:02.64) [06:04] / ct-ng:148: recipe for target 'build' failed make: *** [build] Error 1
エラーが発生してしまいました。
build.log
に詳細が書かれているようなので、確認してみます。
$ less build.log ↵ : [ALL ] --2018-03-29 16:18:22-- http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.gz [ALL ] Resolving www.multiprecision.org (www.multiprecision.org)... 185.233.100.48 [ALL ] Connecting to www.multiprecision.org (www.multiprecision.org)|185.233.100.48|:80... connected. [ALL ] HTTP request sent, awaiting response... 500 Internal Server Error [ALL ] 2018-03-29 16:18:23 ERROR 500: Internal Server Error. [ALL ] [DEBUG] Not at this location: "http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.gz" [DEBUG] Trying 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.xz' [DEBUG] ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--progress=dot:binary' '-T' '10' '-O' '/home/masato/build_sdk/crosstool-NG/.build/tarballs/mpc-1.0.2.tar.xz.tmp-dl' 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.xz' [ALL ] --2018-03-29 16:18:23-- http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.xz [ALL ] Resolving www.multiprecision.org (www.multiprecision.org)... 185.233.100.48 [ALL ] Connecting to www.multiprecision.org (www.multiprecision.org)|185.233.100.48|:80... connected. [ALL ] HTTP request sent, awaiting response... 500 Internal Server Error [ALL ] 2018-03-29 16:18:23 ERROR 500: Internal Server Error. [ALL ] [DEBUG] Not at this location: "http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.xz" [DEBUG] Trying 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.lzma' [DEBUG] ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--progress=dot:binary' '-T' '10' '-O' '/home/masato/build_sdk/crosstool-NG/.build/tarballs/mpc-1.0.2.tar.lzma.tmp-dl' 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.lzma' [ALL ] --2018-03-29 16:18:24-- http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.lzma [ALL ] Resolving www.multiprecision.org (www.multiprecision.org)... 185.233.100.48 [ALL ] Connecting to www.multiprecision.org (www.multiprecision.org)|185.233.100.48|:80... connected. [ALL ] HTTP request sent, awaiting response... 500 Internal Server Error [ALL ] 2018-03-29 16:18:24 ERROR 500: Internal Server Error. [ALL ] [DEBUG] Not at this location: "http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.lzma" [DEBUG] Trying 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.bz2' [DEBUG] ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--progress=dot:binary' '-T' '10' '-O' '/home/masato/build_sdk/crosstool-NG/.build/tarballs/mpc-1.0.2.tar.bz2.tmp-dl' 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.bz2' [ALL ] --2018-03-29 16:18:24-- http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.bz2 [ALL ] Resolving www.multiprecision.org (www.multiprecision.org)... 185.233.100.48 [ALL ] Connecting to www.multiprecision.org (www.multiprecision.org)|185.233.100.48|:80... connected. [ALL ] HTTP request sent, awaiting response... 500 Internal Server Error [ALL ] 2018-03-29 16:18:25 ERROR 500: Internal Server Error. [ALL ] [DEBUG] Not at this location: "http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.bz2" [DEBUG] Trying 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.gz' [DEBUG] ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--progress=dot:binary' '-T' '10' '-O' '/home/masato/build_sdk/crosstool-NG/.build/tarballs/mpc-1.0.2.tar.gz.tmp-dl' 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.gz' [ALL ] --2018-03-29 16:18:25-- http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.gz [ALL ] Resolving www.multiprecision.org (www.multiprecision.org)... 185.233.100.48 [ALL ] Connecting to www.multiprecision.org (www.multiprecision.org)|185.233.100.48|:80... connected. [ALL ] HTTP request sent, awaiting response... 500 Internal Server Error [ALL ] 2018-03-29 16:18:26 ERROR 500: Internal Server Error. [ALL ] [DEBUG] Not at this location: "http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.gz" [DEBUG] Trying 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tgz' [DEBUG] ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--progress=dot:binary' '-T' '10' '-O' '/home/masato/build_sdk/crosstool-NG/.build/tarballs/mpc-1.0.2.tgz.tmp-dl' 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tgz' [ALL ] --2018-03-29 16:18:26-- http://www.multiprecision.org/mpc/download/mpc-1.0.2.tgz [ALL ] Resolving www.multiprecision.org (www.multiprecision.org)... 185.233.100.48 [ALL ] Connecting to www.multiprecision.org (www.multiprecision.org)|185.233.100.48|:80... connected. [ALL ] HTTP request sent, awaiting response... 500 Internal Server Error [ALL ] 2018-03-29 16:18:26 ERROR 500: Internal Server Error. [ALL ] [DEBUG] Not at this location: "http://www.multiprecision.org/mpc/download/mpc-1.0.2.tgz" [DEBUG] Trying 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar' [DEBUG] ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--progress=dot:binary' '-T' '10' '-O' '/home/masato/build_sdk/crosstool-NG/.build/tarballs/mpc-1.0.2.tar.tmp-dl' 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar' [ALL ] --2018-03-29 16:18:27-- http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar [ALL ] Resolving www.multiprecision.org (www.multiprecision.org)... 185.233.100.48 [ALL ] Connecting to www.multiprecision.org (www.multiprecision.org)|185.233.100.48|:80... connected. [ALL ] HTTP request sent, awaiting response... 500 Internal Server Error [ALL ] 2018-03-29 16:18:27 ERROR 500: Internal Server Error. [ALL ] [DEBUG] Not at this location: "http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar" [DEBUG] Trying 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.zip' [DEBUG] ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--progress=dot:binary' '-T' '10' '-O' '/home/masato/build_sdk/crosstool-NG/.build/tarballs/mpc-1.0.2.zip.tmp-dl' 'http://www.multiprecision.org/mpc/download/mpc-1.0.2.zip' [ALL ] --2018-03-29 16:18:27-- http://www.multiprecision.org/mpc/download/mpc-1.0.2.zip [ALL ] Resolving www.multiprecision.org (www.multiprecision.org)... 185.233.100.48 [ALL ] Connecting to www.multiprecision.org (www.multiprecision.org)|185.233.100.48|:80... connected. [ALL ] HTTP request sent, awaiting response... 500 Internal Server Error [ALL ] 2018-03-29 16:18:28 ERROR 500: Internal Server Error. [ALL ] [DEBUG] Not at this location: "http://www.multiprecision.org/mpc/download/mpc-1.0.2.zip" [DEBUG] Trying 'http://www.multiprecision.org/mpc/download/mpc-1.0.2' [DEBUG] ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--progress=dot:binary' '-T' '10' '-O' '/home/masato/build_sdk/crosstool-NG/.build/tarballs/mpc-1.0.2.tmp-dl' 'http://www.multiprecision.org/mpc/download/mpc-1.0.2' [ALL ] --2018-03-29 16:18:28-- http://www.multiprecision.org/mpc/download/mpc-1.0.2 [ALL ] Resolving www.multiprecision.org (www.multiprecision.org)... 185.233.100.48 [ALL ] Connecting to www.multiprecision.org (www.multiprecision.org)|185.233.100.48|:80... connected. [ALL ] HTTP request sent, awaiting response... 500 Internal Server Error [ALL ] 2018-03-29 16:18:29 ERROR 500: Internal Server Error. [ALL ] [DEBUG] Not at this location: "http://www.multiprecision.org/mpc/download/mpc-1.0.2" [ERROR] [ERROR] >> [ERROR] >> Build failed in step 'Retrieving needed toolchain components' tarballs' [ERROR] >> called in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: do_mpc_get[scripts/build/companion_libs/140-mpc.sh@741] [ERROR] >> called from: do_companion_libs_get[scripts/build/companion_libs.sh@15] [ERROR] >> called from: main[scripts/crosstool-NG.sh@583] [ERROR] >> [ERROR] >> For more info on this error, look at the file: 'build.log' [ERROR] >> There is a list of known issues, some with workarounds, in: [ERROR] >> '/opt/Espressif/share/doc/crosstool-ng/ct-ng.1.20.0/B - Known issues.txt' [ERROR] [ERROR] (elapsed: 6:02.64)
mpc-1.0.2
が無いらしい。
URLを確認すると、構成が変わっているよです。
先は長そうです。
参考サイト
技適OKな中華IoTモジュールを使いこなす
Ubuntu 15.10 requires libtool-bin