発生した現象
configureスクリプトでMakefile作成時に以下のエラーが発生した。
$ ../ruby/configure --prefix=$PWD/../install --enable-shared
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ ../ruby/configure --prefix=/Users/daiki-kudo/repos/ruby/build/../install --enable-shared
...(中略)...
## ----------- ##
## Core tests. ##
## ----------- ##
configure:6061: checking whether the C compiler works
configure:6083: clang -I/usr/local/opt/llvm/include -L/usr/local/opt/llvm/lib conftest.c >&5
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/lib/libSystem.tbd' for architecture x86_64
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
configure:6087: $? = 1
configure:6127: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define RUBY_ABI_VERSION 0
| /* end confdefs.h. */
|
| int
| main (void)
| {
|
| ;
| return 0;
| }
configure:6132: error: in `/Users/daiki-kudo/repos/ruby/build':
configure:6134: error: C compiler cannot create executables
See `config.log' for more details
解決方法
以下の二つを行い、Anaconda関連のコードを削除すると直った。(ref)
-
~/.zshrc
内のconda関係の設定を削除。 - $
rm -rf ~/anaconda3
でAnaconda関係のディレクトリを削除。
他にやったこと
自分の場合以下では直らなかった。(ref)
brew upgrade llvm
brew upgrade gcc
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
ref.