アプリケーション開発ポータルサイト
ServerNote.NET
Amazon.co.jpでPC関連商品タイムセール開催中!
カテゴリー【Amazon/AWSDebianCentOS
cannot guess build type; you must specify oneと言われた場合
POSTED BY
2023-04-21

Intel/X86でなくARMのアーキテクチャでソフトをソースコードから入れようとconfigureしたとき、表題のエラーが出て終了してしまう場合がある。

今回、AWSのインスタンスをARM 64Bit+Debianを選択してFastCGIパッケージをコンパイルしようとしたところ、出た。

wget https://github.com/FastCGI-Archives/FastCGI.com/raw/master/original_snapshot/fcgi-2.4.1-SNAP-0910052249.tar.gz
tar xvfzp fcgi-2.4.1-SNAP-0910052249.tar.gz
cd fcgi-2.4.1-SNAP-0910052249/
./configure

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
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 for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... ./config.guess: unable to guess system type

This script, last modified 2005-12-13, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from

  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
and
  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub

If the version you run (./config.guess) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.

config.guess timestamp = 2005-12-13

uname -m = aarch64
uname -r = 4.19.0-16-arm64
uname -s = Linux
uname -v = #1 SMP Debian 4.19.181-1 (2021-03-19)

/usr/bin/uname -p = unknown
/bin/uname -X     =

hostinfo               =
/bin/universe          =
/usr/bin/arch -k       =
/bin/arch              = aarch64
/usr/bin/oslevel       =
/usr/convex/getsysinfo =

UNAME_MACHINE = aarch64
UNAME_RELEASE = 4.19.0-16-arm64
UNAME_SYSTEM  = Linux
UNAME_VERSION = #1 SMP Debian 4.19.181-1 (2021-03-19)
configure: error: cannot guess build type; you must specify one

メッセージにはconfigureに--build=をつけて明示的に指定せよと言ってるっぽいが、何を指定すればよいのかわからない。

uname -a
Linux ip-172-31-28-160 4.19.0-16-arm64 #1 SMP Debian 4.19.181-1 (2021-03-19) aarch64 GNU/Linux

であるので、適当に--build=arm64とかしてみたが、config.subにそのような識別子は無い、と言われた。であれば、config.subをarmでgrepしてみる。

grep arm config.sub

        | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
        | strongarm \
        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
        | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
                basic_machine=armv4l-rebel
        arm*-rebel)
        arm*-semi)

ふーむ、見た所一番近そうなのは「arm」でありそうなので、

./configure --build=arm

としたところ、今度はエラー無くconfigure完了、make make installできた。

64ついてないけど大丈夫かな?とインストールバイナリを見てみたが

cd /usr/local/bin
file cgi-fcgi
cgi-fcgi: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=78ee93f56ba87aa13a298f9bb59cf428d68b8671, with debug_info, not stripped

一応ちゃんと64bitになっているようなので?大丈夫そうである。

※本記事は当サイト管理人の個人的な備忘録です。本記事の参照又は付随ソースコード利用後にいかなる損害が発生しても当サイト及び管理人は一切責任を負いません。
※本記事内容の無断転載を禁じます。
【WEBMASTER/管理人】
自営業プログラマーです。お仕事ください!
ご連絡は以下アドレスまでお願いします★

☆ServerNote.NETショッピング↓
ShoppingNote / Amazon.co.jp
☆お仲間ブログ↓
一人社長の不動産業務日誌
【キーワード検索】