ESP8266で遊ぶ


開発環境を作る - Windows Subsystem for Linux を試す再び (5) -

mpcの取得先を変更して再度チャレンジ

mpcのダウンロードサイトの構成が変更されていることは前回確認しました。
ではどのように訂正すればよいのでしょうか?Googleさんにお伺いを立てることにします。

This seems to be a problem with the crosstool-NG project. They have changed their download servers for more recent versions, which the script can't handle.
A quick fix that worked for me: Edit file /crosstool-NG/scripts/build/companion_libs/140-mpc.sh, change the following lines (starting at line 15):

do_mpc_get() {
    CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz      \
        {http,ftp,https}://ftp.gnu.org/gnu/mpc      \
        http://www.multiprecision.org/mpc/download
}

to

do_mpc_get() {
    CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz      \
        https://ftp.gnu.org/gnu/mpc
}

140-mpc.shのURLを差し替えればよさそうです。
それでは、初めからやり直してみましょう。
まずは残骸を削除してしまいましょう。

$ ~/build_sdk ↵
$ rm -Rf crosstool-NG ↵

再びGitHubからソースをクローンします。

$  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 | 13.00 KiB/s, done.
Resolving deltas: 100% (20003/20003), done.
Checking connectivity... done.
Checking out files: 100% (1602/1602), done.

バックアップを取って、URLを差し替えます。

$ cp -p scripts/build/companion_libs/140-mpc.sh scripts/build/companion_libs/140-mpc.sh.ORG ↵
$ vi scripts/build/companion_libs/140-mpc.sh ↵
# Download MPC
do_mpc_get() {
    CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz      \
        http://www.multiprecision.org/mpc/download
}

16行目のURLを次のように変更します。

# Download MPC
do_mpc_get() {
    CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz      \
        https://ftp.gnu.org/gnu/mpc
}

ビルドを始めます。

$ ./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... /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'
  INST    'ct-ng'
  INSTDIR 'config/'
  INSTDIR 'contrib/'
  INSTDIR 'patches/'
  INSTDIR 'scripts/'
  INST    'steps.mk'
  INST    'paths'
  INSTDIR 'samples/'
  INST    'kconfig/'
  INST    'docs/*.txt'
  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 20180330.211427
[INFO ]  Building environment variables
[INFO ]  =================================================================
[INFO ]  Retrieving needed toolchain components' tarballs
[INFO ]  Retrieving needed toolchain components' tarballs: done in 4895.03s (at 81:51)
[INFO ]  =================================================================
[INFO ]  Extracting and patching toolchain components
[INFO ]  Extracting and patching toolchain components: done in 461.66s (at 89:33)
[INFO ]  =================================================================
[INFO ]  Installing GMP for host
[INFO ]  Installing GMP for host: done in 291.79s (at 94:25)
[INFO ]  =================================================================
[INFO ]  Installing MPFR for host
[INFO ]  Installing MPFR for host: done in 120.47s (at 96:26)
[INFO ]  =================================================================
[INFO ]  Installing ISL for host
[INFO ]  Installing ISL for host: done in 111.49s (at 98:17)
[INFO ]  =================================================================
[INFO ]  Installing CLooG for host
[INFO ]  Installing CLooG for host: done in 62.32s (at 99:20)
[INFO ]  =================================================================
[INFO ]  Installing MPC for host
[INFO ]  Installing MPC for host: done in 64.91s (at 100:25)
[INFO ]  =================================================================
[INFO ]  Installing binutils for host
[INFO ]  Installing binutils for host: done in 327.99s (at 105:53)
[INFO ]  =================================================================
[INFO ]  Installing final compiler
[INFO ]  Installing final compiler: done in 685.25s (at 117:18)
[INFO ]  =================================================================
[INFO ]  Installing cross-gdb
[INFO ]  Installing cross-gdb: done in 583.70s (at 127:02)
[INFO ]  =================================================================
[INFO ]  Cleaning-up the toolchain's directory
[INFO ]    Stripping all toolchain executables
[INFO ]  Cleaning-up the toolchain's directory: done in 12.41s (at 127:14)
[INFO ]  Build completed at 20180330.232140
[INFO ]  (elapsed: 127:12.41)
[INFO ]  Finishing installation (may take a few seconds)...

ビルドが終わりました。
生成されたバイナリを転送します。

$ sudo cp -r builds/xtensa-lx106-elf /opt/Espressif/ ↵

PATHを追加します。

$ vi ~/.profile ↵
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"

20行目を次のように変更します。

# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:/opt/Espressif/xtensa-lx106-elf/bin:$PATH"

Ubuntuターミナルを起動しなおすと、PATHが追加されています。

参考サイト

技適OKな中華IoTモジュールを使いこなす
crosstool-ng build error - wrong link to MPC tarball ?