【失敗談】32bit版 Debian11(bullseye)にnode.jsを入れようとして無理だった話
概要
32bit版 Debian11に最新LTS版のnode.js(執筆当時 v20.9.0)をインストールしようとしたらmakeでエラーを吐いて困った話です。
エラーを吐いた状況
環境
Windows7からDebianに載せ替えたDellの古いノートPC
いちおうギリ64bitCPUですが、OSは32bitのDebian11を使用しています。
手順
nodejs.orgからソースコードをダウンロード
/usr/src ディレクトリに置く。
/usr/src$ ls
node-v20.9.0.tar.gz
展開する
/usr/src$ tar -xvf node-v20.9.0.tar.gz
(出力:略)
/usr/src$ ls
node-v20.9.0.tar.gz node-v20.9.0
makeする => ここでエラー発生
/usr/src$ cd node-v20.9.0
/usr/src/node-v20.9.0$ ./configure
(出力:略)
/usr/src/node-v20.9.0$ make
(出力:略)
../deps/openssl/config/archs/linux-elf/asm/crypto/aes/aes-586.S: Assembler messages:
../deps/openssl/config/archs/linux-elf/asm/crypto/aes/aes-586.S:5: Error: junk at end of line, first unrecognized character is `%'
../deps/openssl/config/archs/linux-elf/asm/crypto/aes/aes-586.S:8: Error: junk at end of line, first unrecognized character is `%'
(出力:略)
make: *** [Makefile:113: node] エラー 2
makeが通らない原因?
調べてみた
Googleで検索したらGitHubのnodejsのあるIssueがヒットしました。
Node.js Unofficial Builds Projectでもv18.4.0を最後にビルドが配布されていません。
エラーの原因
上のIssueのツリーを読み進めると、どうやらopensslのソース関係に問題がある可能性とのことでした。
くわしくは、makeで使用するnasmというプログラムがバージョンによってifdefディレクティブの認識の仕方が違うらしく(ほんまに?)、今回の実行環境のmakeで使用しているnasmでは#ifdef~#endif
のみが使用できるが、最近のバージョンのnodejsのopensslのソースコードでは%ifdef~%endif
が使用されており、#と%の違いで引っかかっいるらしいとのことです。
(参考)(https://fossies.org/linux/nasm/doc/changes.src)
ではどうするのか
$ ./configure
のあと、make
の前にopensslのソースコード(deps/opensslディレクトリ内)の%ifdef~%endif
を#ifdef~#endif
に強制的に変更してあげます。
/usr/src/node-v20.9.0$ ./configure
(出力:略)
/usr/src/node-v20.9.0$ for f in $(find deps/openssl -type f -name '*.S'); do echo $f; sed -i "s/%ifdef/#ifdef/" "$f"; sed -i "s/%endif/#endif/" "$f"; done
(出力:略)
/usr/src/node-v20.9.0$ make
(出力:略)
その後
makeをやり直すと上記エラーは出なくなり、make開始から5時間ほど経った頃・・・
再びエラー
別のエラーが出て結局ダメでした。
こちらはGoogleで調べてもAIに聞いても情報得られずでした。
エラー出力
cc -o /usr/src/node-v20.9.0/out/Release/obj.target/zlib/deps/zlib/crc32.o ../deps/zlib/crc32.c '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_HAS_QUIC' '-DICU_NO_USER_DATA_OVERRIDE' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DHAVE_HIDDEN' '-DDEFLATE_SLIDE_HASH_SSE2' '-DINFLATE_CHUNK_SIMD_SSE2' '-DADLER32_SIMD_SSSE3' '-DX86_NOT_WINDOWS' -I../deps/zlib -pthread -Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -m32 -O3 -fno-omit-frame-pointer -MMD -MF /usr/src/node-v20.9.0/out/Release/.deps//usr/src/node-v20.9.0/out/Release/obj.target/zlib/deps/zlib/crc32.o.d.raw -c
cc -o /usr/src/node-v20.9.0/out/Release/obj.target/zlib/deps/zlib/deflate.o ../deps/zlib/deflate.c '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_HAS_QUIC' '-DICU_NO_USER_DATA_OVERRIDE' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DHAVE_HIDDEN' '-DDEFLATE_SLIDE_HASH_SSE2' '-DINFLATE_CHUNK_SIMD_SSE2' '-DADLER32_SIMD_SSSE3' '-DX86_NOT_WINDOWS' -I../deps/zlib -pthread -Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -m32 -O3 -fno-omit-frame-pointer -MMD -MF /usr/src/node-v20.9.0/out/Release/.deps//usr/src/node-v20.9.0/out/Release/obj.target/zlib/deps/zlib/deflate.o.d.raw -c
../deps/zlib/deflate.c: In function ‘deflate_slow’:
../deps/zlib/deflate.c:2003:31: warning: comparison of integer expressions of different signedness: ‘IPos’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
2003 | if (s->prev_match == -1) {
| ^~
In file included from ../deps/zlib/deflate.c:57:
../deps/zlib/slide_hash_simd.h: In function ‘slide_hash_simd’:
../deps/zlib/slide_hash_simd.h:98:29: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
98 | const z_vec128i_u16x8_t vec_wsize = Z_SLIDE_INIT_SIMD(w_size);
| ^~~~~~~~~
In file included from ../deps/zlib/slide_hash_simd.h:27,
from ../deps/zlib/deflate.c:57:
/usr/lib/gcc/i686-linux-gnu/10/include/emmintrin.h:648:1: error: inlining failed in call to ‘always_inline’ ‘_mm_set1_epi16’: target specific option mismatch
648 | _mm_set1_epi16 (short __A)
| ^~~~~~~~~~~~~~
In file included from ../deps/zlib/deflate.c:57:
../deps/zlib/slide_hash_simd.h:29:34: note: called from here
29 | #define Z_SLIDE_INIT_SIMD(wsize) _mm_set1_epi16((ush)(wsize))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/zlib/slide_hash_simd.h:98:41: note: in expansion of macro ‘Z_SLIDE_INIT_SIMD’
98 | const z_vec128i_u16x8_t vec_wsize = Z_SLIDE_INIT_SIMD(w_size);
| ^~~~~~~~~~~~~~~~~
In file included from ../deps/zlib/slide_hash_simd.h:27,
from ../deps/zlib/deflate.c:57:
/usr/lib/gcc/i686-linux-gnu/10/include/emmintrin.h:725:1: error: inlining failed in call to ‘always_inline’ ‘_mm_storeu_si128’: target specific option mismatch
725 | _mm_storeu_si128 (__m128i_u *__P, __m128i __B)
| ^~~~~~~~~~~~~~~~
In file included from ../deps/zlib/deflate.c:57:
../deps/zlib/slide_hash_simd.h:35:9: note: called from here
35 | _mm_storeu_si128((__m128i *)(table + 0), vO); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/zlib/slide_hash_simd.h:105:5: note: in expansion of macro ‘Z_SLIDE_HASH_SIMD’
105 | Z_SLIDE_HASH_SIMD(head, hash_size, vec_wsize);
| ^~~~~~~~~~~~~~~~~
In file included from ../deps/zlib/slide_hash_simd.h:27,
from ../deps/zlib/deflate.c:57:
/usr/lib/gcc/i686-linux-gnu/10/include/emmintrin.h:1118:1: error: inlining failed in call to ‘always_inline’ ‘_mm_subs_epu16’: target specific option mismatch
1118 | _mm_subs_epu16 (__m128i __A, __m128i __B)
| ^~~~~~~~~~~~~~
In file included from ../deps/zlib/deflate.c:57:
../deps/zlib/slide_hash_simd.h:34:14: note: called from here
34 | vO = _mm_subs_epu16(vO, vector_wsize); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/zlib/slide_hash_simd.h:105:5: note: in expansion of macro ‘Z_SLIDE_HASH_SIMD’
105 | Z_SLIDE_HASH_SIMD(head, hash_size, vec_wsize);
| ^~~~~~~~~~~~~~~~~
In file included from ../deps/zlib/slide_hash_simd.h:27,
from ../deps/zlib/deflate.c:57:
/usr/lib/gcc/i686-linux-gnu/10/include/emmintrin.h:701:1: error: inlining failed in call to ‘always_inline’ ‘_mm_loadu_si128’: target specific option mismatch
701 | _mm_loadu_si128 (__m128i_u const *__P)
| ^~~~~~~~~~~~~~~
In file included from ../deps/zlib/deflate.c:57:
../deps/zlib/slide_hash_simd.h:33:22: note: called from here
33 | __m128i vO = _mm_loadu_si128((__m128i *)(table + 0)); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/zlib/slide_hash_simd.h:105:5: note: in expansion of macro ‘Z_SLIDE_HASH_SIMD’
105 | Z_SLIDE_HASH_SIMD(head, hash_size, vec_wsize);
| ^~~~~~~~~~~~~~~~~
In file included from ../deps/zlib/slide_hash_simd.h:27,
from ../deps/zlib/deflate.c:57:
/usr/lib/gcc/i686-linux-gnu/10/include/emmintrin.h:725:1: error: inlining failed in call to ‘always_inline’ ‘_mm_storeu_si128’: target specific option mismatch
725 | _mm_storeu_si128 (__m128i_u *__P, __m128i __B)
| ^~~~~~~~~~~~~~~~
In file included from ../deps/zlib/deflate.c:57:
../deps/zlib/slide_hash_simd.h:35:9: note: called from here
35 | _mm_storeu_si128((__m128i *)(table + 0), vO); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/zlib/slide_hash_simd.h:107:5: note: in expansion of macro ‘Z_SLIDE_HASH_SIMD’
107 | Z_SLIDE_HASH_SIMD(prev, w_size, vec_wsize);
| ^~~~~~~~~~~~~~~~~
In file included from ../deps/zlib/slide_hash_simd.h:27,
from ../deps/zlib/deflate.c:57:
/usr/lib/gcc/i686-linux-gnu/10/include/emmintrin.h:1118:1: error: inlining failed in call to ‘always_inline’ ‘_mm_subs_epu16’: target specific option mismatch
1118 | _mm_subs_epu16 (__m128i __A, __m128i __B)
| ^~~~~~~~~~~~~~
In file included from ../deps/zlib/deflate.c:57:
../deps/zlib/slide_hash_simd.h:34:14: note: called from here
34 | vO = _mm_subs_epu16(vO, vector_wsize); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/zlib/slide_hash_simd.h:107:5: note: in expansion of macro ‘Z_SLIDE_HASH_SIMD’
107 | Z_SLIDE_HASH_SIMD(prev, w_size, vec_wsize);
| ^~~~~~~~~~~~~~~~~
In file included from ../deps/zlib/slide_hash_simd.h:27,
from ../deps/zlib/deflate.c:57:
/usr/lib/gcc/i686-linux-gnu/10/include/emmintrin.h:701:1: error: inlining failed in call to ‘always_inline’ ‘_mm_loadu_si128’: target specific option mismatch
701 | _mm_loadu_si128 (__m128i_u const *__P)
| ^~~~~~~~~~~~~~~
In file included from ../deps/zlib/deflate.c:57:
../deps/zlib/slide_hash_simd.h:33:22: note: called from here
33 | __m128i vO = _mm_loadu_si128((__m128i *)(table + 0)); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/zlib/slide_hash_simd.h:107:5: note: in expansion of macro ‘Z_SLIDE_HASH_SIMD’
107 | Z_SLIDE_HASH_SIMD(prev, w_size, vec_wsize);
| ^~~~~~~~~~~~~~~~~
make[1]: *** [deps/zlib/zlib.target.mk:115: /usr/src/node-v20.9.0/out/Release/obj.target/zlib/deps/zlib/deflate.o] エラー 1
rm 3db44b78d210f73c66036a93ef36049e64304796.intermediate f36a4548004c37e56d04dd6bec1ad8e88812ebef.intermediate 513eb5055a83c8d33d2452282cf31bba068b00dd.intermediate bba5422603aef03bda9df0832f60c8ad03c122e2.intermediate
make: *** [Makefile:134: node] エラー 2
おわりに
ということで、少し古いnodejsを入れるか、64bitOSに変えてみるかを検討したいと思います。
しまりのない記事で申し訳ありません。
Discussion