Open1

Pythonのビルドに失敗する原因がアンチウィルスソフトだった件

todeskingtodesking

macOS Big Sur(11.6.5)

$ pyenv install 3.10.3
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.3.tar.xz...
-> https://www.python.org/ftp/python/3.10.3/Python-3.10.3.tar.xz
Installing Python-3.10.3...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 11.6.5 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/[redacted]
Results logged to /var/folders/[redacted]/python-build.20220324161857.15677.log

Last 10 log lines:
checking for crypt_r... no
checking for clock_gettime... yes
checking for clock_getres... yes
checking for clock_settime... yes
checking for major... yes
checking for getaddrinfo... yes
checking getaddrinfo bug... yes
Fatal: You must get working getaddrinfo() function.
       or you can specify "--disable-ipv6".
make: *** No targets specified and no makefile found.  Stop.

ログを見るとこんな感じで、getaddrinfoのバグとやらが影響していそうに見える……

checking for clock_gettime... yes
checking for clock_getres... yes
checking for clock_settime... yes
checking for major... yes
checking for getaddrinfo... yes
checking getaddrinfo bug... yes
Fatal: You must get working getaddrinfo() function.
       or you can specify "--disable-ipv6".
make: *** No targets specified and no makefile found.  Stop.

……が、上の方を見ると何かがおかしい:

checking size of int... 0
checking size of long... 0
checking alignment of long... 0
checking size of long long... 0
checking size of void *... 0
checking size of short... 0
checking size of float... 0
checking size of double... 0
checking size of fpos_t... 8
checking size of size_t... 8

sizeof int が0????

ビルドディレクトリの config.log によると

configure:8686: checking size of int
configure:8691: clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include   -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/[[redacted]/.pyenv/versions/3.10.3/include  -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/[redacted]/.pyenv/versions/3.10.3/lib  -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib conftest.c  >&5
ld: warning: directory not found for option '-L/Users/[redacted]/.pyenv/versions/3.10.3/lib'
configure:8691: $? = 0
configure:8691: ./conftest
./configure: line 1967: 18417 Killed: 9               ./conftest$ac_exeext
configure:8691: $? = 137
configure: program exited with status 137

sizeof intの値を返すプログラムが死んでいる。9(SIGKILL)なのでsegvではなく外部から殺されている?

心当たりがないわけではない(Trend Micro Security Agent)が、何か検出されたというログは出ていない。

一応試してみる:

# オラオラ
$ while true; do sleep 1; ps ax | grep iCoreService | grep /libTmAntiMalware.dylib | awk '{ print $1}' | xargs sudo kill -9; done
$ pyenv install 3.10.3
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.3.tar.xz...
-> https://www.python.org/ftp/python/3.10.3/Python-3.10.3.tar.xz
Installing Python-3.10.3...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.10.3 to /Users/[redacted]/.pyenv/versions/3.10.3

やっぱりお前やんけ💢💢💢 このファッ