##質問したいこと
MacOSX11.1
でbrewでインストールしたGCC10.2.0
のC++を使っているのですが、brewで再インストールしてもデフォルトの--with-sysroot
オプションの指すSDKが以下のようにMacOSX11.0
のものになってしまいます。
zsh
1% g++ -v 2Using built-in specs. 3COLLECT_GCC=g++ 4COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/10.2.0/libexec/gcc/x86_64-apple-darwin20/10.2.0/lto-wrapper 5Target: x86_64-apple-darwin20 6Configured with: ../configure --build=x86_64-apple-darwin20 --prefix=/usr/local/Cellar/gcc/10.2.0 --libdir=/usr/local/Cellar/gcc/10.2.0/lib/gcc/10 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-10 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 10.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk SED=/usr/bin/sed 7Thread model: posix 8Supported LTO compression algorithms: zlib 9gcc version 10.2.0 (Homebrew GCC 10.2.0)
CommandLineToolsのアップデートを行うとMacOSX11.1
のSDKがインストールされてしまうので、現在はMore Downloads for Apple DevelopersからMacOSX11.0
のSDKに対応するCommandLineToolsをインストールして使っている状態です。
GCC10.2.0
を使用する際には問題ないのですが、デフォルトの--with-sysroot
オプションを書き換える方法があればと思い質問させていただきました。
##調べたこと
自分の環境では/usr/local/Cellar/gcc/10.2.0/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0/install-tools/mkheaders.conf
及び/usr/local/Cellar/gcc/10.2.0/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0/plugin/include/configargs.h
がそれぞれ下記のようになっていたので、MacOSX11.0.sdk
とある部分をMacOSX11.1.sdk
と変えて保存してから再起動を試みたのですが、デフォルトの--with-sysroot
は書き変わりませんでした。
c++
1// /usr/local/Cellar/gcc/10.2.0/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0/install-tools/mkheaders.conf 2 3SYSTEM_HEADER_DIR="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk${sysroot_headers_suffix}/usr/include" 4OTHER_FIXINCLUDES_DIRS="" 5STMP_FIXINC="stmp-fixinc"
c++
1// /usr/local/Cellar/gcc/10.2.0/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0/plugin/include/configargs.h 2 3/* Generated automatically. */ 4static const char configuration_arguments[] = "../configure --build=x86_64-apple-darwin20 --prefix=/usr/local/Cellar/gcc/10.2.0 --libdir=/usr/local/Cellar/gcc/10.2.0/lib/gcc/10 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-10 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 10.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk SED=/usr/bin/sed"; 5static const char thread_model[] = "posix"; 6 7static const struct { 8 const char *name, *value; 9} configure_default_options[] = { { "cpu", "core2" } }; 10~
そして、/usr/local/Cellar/gcc/10.2.0/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0/plugin/include/configargs.h
に/* Generated automatically. */
と書いてあったので近くの階層の関係しそうなファイルを見たりHomebrewの設定がおかしいのではと思い/usr/local/Homebrew/Library/Homebrew/os/mac.rb
を読んだりもしたのですが、原因を究明することができませんでした。

あなたの回答
tips
プレビュー