前提・実現したいこと
環境は、
・Mac OS Catalina
・/usr/bin/gcc(g++)のgcc, g++はXcode Command Line toolのclangです。
・homebrewでインストールしたgcc@5
・zsh
gcc-5,g++-5でconfigureを通したいです。
いままでの方法は、/usr/bin/gcc
usr/bin/g++
をhomebrewのgcc@5に張り替えていました。しかし、Catalinaにアップデートすることでパスの張り替えができないようになりました。
そこで、./configure
オプションでgcc,g++のバージョンを指定しようと思いました。
発生している問題・エラーメッセージ
./configureをするときに下のコマンドを実行させました。
CC=/usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 CXX=/usr/local/Cellar/gcc@5/5.5.0_3/bin/g++-5 ./configure
すると、このようなエラーが返ってきました。
checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... config/install-sh -c -d checking for gawk... no checking for mawk... no checking for nawk... no checking for awk... awk checking whether make sets $(MAKE)... yes checking build system type... x86_64-apple-darwin19.0.0 checking host system type... x86_64-apple-darwin19.0.0 checking for style of include used by make... GNU checking for gcc... /usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in `/Users/Daiki/soccer/librcsc-4.1.0': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details
エラーを見てみると、 error: cannot run C compiled programs.
と書いています。
今までは、クロスコンパイルせずにconfigureが通っていいました。憶測ですが、gccとg++のバージョンを無理やり指定したのでconfigureがクロスコンパイルだと勘違いしているようです。
該当のソースコード
config.log
config.log
1This file contains any messages produced by compilers while 2running configure, to aid debugging if configure makes a mistake. 3 4It was created by librcsc configure 4.1.0, which was 5generated by GNU Autoconf 2.67. Invocation command line was 6 7 $ ./configure 8 9## --------- ## 10## Platform. ## 11## --------- ## 12 13hostname = aaa-no-MacBook-Pro.local 14uname -m = x86_64 15uname -r = 19.0.0 16uname -s = Darwin 17uname -v = Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 18 19/usr/bin/uname -p = i386 20/bin/uname -X = unknown 21 22/bin/arch = unknown 23/usr/bin/arch -k = unknown 24/usr/convex/getsysinfo = unknown 25/usr/bin/hostinfo = Mach kernel version: 26 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 27Kernel configured for up to 8 processors. 284 processors are physically available. 298 processors are logically available. 30Processor type: x86_64h (Intel x86-64h Haswell) 31Processors active: 0 1 2 3 4 5 6 7 32Primary memory available: 8.00 gigabytes 33Default processor set: 378 tasks, 1695 threads, 8 processors 34Load average: 1.83, Mach factor: 6.16 35/bin/machine = unknown 36/usr/bin/oslevel = unknown 37/bin/universe = unknown 38 39PATH: /usr/local/opt/icu4c/sbin 40PATH: /usr/local/opt/icu4c/bin 41PATH: /usr/local/sbin 42PATH: /usr/local/bin 43PATH: /usr/bin 44PATH: /bin 45PATH: /usr/sbin 46PATH: /sbin 47PATH: /Library/Apple/usr/bin 48PATH: /Library/Apple/bin 49 50 51## ----------- ## 52## Core tests. ## 53## ----------- ## 54 55configure:2692: checking for a BSD-compatible install 56configure:2760: result: /usr/bin/install -c 57configure:2771: checking whether build environment is sane 58configure:2821: result: yes 59configure:2962: checking for a thread-safe mkdir -p 60configure:3001: result: config/install-sh -c -d 61configure:3014: checking for gawk 62configure:3044: result: no 63configure:3014: checking for mawk 64configure:3044: result: no 65configure:3014: checking for nawk 66configure:3044: result: no 67configure:3014: checking for awk 68configure:3030: found /usr/bin/awk 69configure:3041: result: awk 70configure:3052: checking whether make sets $(MAKE) 71configure:3074: result: yes 72configure:3196: checking build system type 73configure:3210: result: x86_64-apple-darwin19.0.0 74configure:3230: checking host system type 75configure:3243: result: x86_64-apple-darwin19.0.0 76configure:3275: checking for style of include used by make 77configure:3303: result: GNU 78configure:3373: checking for gcc 79configure:3400: result: /usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 80configure:3629: checking for C compiler version 81configure:3638: /usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 --version >&5 82gcc-5 (Homebrew GCC 5.5.0_3) 5.5.0 83Copyright (C) 2015 Free Software Foundation, Inc. 84This is free software; see the source for copying conditions. There is NO 85warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 86 87configure:3649: $? = 0 88configure:3638: /usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 -v >&5 89Using built-in specs. 90COLLECT_GCC=/usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 91COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc@5/5.5.0_3/libexec/gcc/x86_64-apple-darwin17.7.0/5.5.0/lto-wrapper 92Target: x86_64-apple-darwin17.7.0 93Configured with: ../configure --build=x86_64-apple-darwin17.7.0 --prefix=/usr/local/Cellar/gcc@5/5.5.0_3 --libdir=/usr/local/Cellar/gcc@5/5.5.0_3/lib/gcc/5 --enable-languages=c,c++,fortran,objc,obj-c++ --program-suffix=-5 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --enable-plugin --disable-werror --disable-nls --with-pkgversion='Homebrew GCC 5.5.0_3' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --enable-multilib 94Thread model: posix 95gcc version 5.5.0 (Homebrew GCC 5.5.0_3) 96configure:3649: $? = 0 97configure:3638: /usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 -V >&5 98gcc-5: error: unrecognized command line option '-V' 99gcc-5: fatal error: no input files 100compilation terminated. 101configure:3649: $? = 1 102configure:3638: /usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 -qversion >&5 103gcc-5: error: unrecognized command line option '-qversion' 104gcc-5: fatal error: no input files 105compilation terminated. 106configure:3649: $? = 1 107configure:3669: checking whether the C compiler works 108configure:3691: /usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 conftest.c >&5 109configure:3695: $? = 0 110configure:3743: result: yes 111configure:3746: checking for C compiler default output file name 112configure:3748: result: a.out 113configure:3754: checking for suffix of executables 114configure:3761: /usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 -o conftest conftest.c >&5 115configure:3765: $? = 0 116configure:3787: result: 117configure:3809: checking whether we are cross compiling 118configure:3817: /usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 -o conftest conftest.c >&5 119In file included from conftest.c:11:0: 120/usr/local/Cellar/gcc@5/5.5.0_3/lib/gcc/5/gcc/x86_64-apple-darwin17.7.0/5.5.0/include-fixed/stdio.h:78:20: fatal error: _stdio.h: No such file or directory 121compilation terminated. 122configure:3821: $? = 1 123configure:3828: ./conftest 124./configure: line 3830: ./conftest: No such file or directory 125configure:3832: $? = 127 126configure:3839: error: in `/Users/Daiki/soccer/librcsc-4.1.0': 127configure:3841: error: cannot run C compiled programs. 128If you meant to cross compile, use `--host'. 129See `config.log' for more details 130 131## ---------------- ## 132## Cache variables. ## 133## ---------------- ## 134 135ac_cv_build=x86_64-apple-darwin19.0.0 136ac_cv_env_CCC_set= 137ac_cv_env_CCC_value= 138ac_cv_env_CC_set=set 139ac_cv_env_CC_value=/usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 140ac_cv_env_CFLAGS_set= 141ac_cv_env_CFLAGS_value= 142ac_cv_env_CPPFLAGS_set= 143ac_cv_env_CPPFLAGS_value= 144ac_cv_env_CPP_set= 145ac_cv_env_CPP_value= 146ac_cv_env_CXXCPP_set= 147ac_cv_env_CXXCPP_value= 148ac_cv_env_CXXFLAGS_set= 149ac_cv_env_CXXFLAGS_value= 150ac_cv_env_CXX_set=set 151ac_cv_env_CXX_value=/usr/local/Cellar/gcc@5/5.5.0_3/bin/g++-5 152ac_cv_env_LDFLAGS_set= 153ac_cv_env_LDFLAGS_value= 154ac_cv_env_LIBS_set= 155ac_cv_env_LIBS_value= 156ac_cv_env_build_alias_set= 157ac_cv_env_build_alias_value= 158ac_cv_env_host_alias_set= 159ac_cv_env_host_alias_value= 160ac_cv_env_target_alias_set= 161ac_cv_env_target_alias_value= 162ac_cv_host=x86_64-apple-darwin19.0.0 163ac_cv_path_install='/usr/bin/install -c' 164ac_cv_prog_AWK=awk 165ac_cv_prog_ac_ct_CC=/usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 166ac_cv_prog_make_make_set=yes 167 168## ----------------- ## 169## Output variables. ## 170## ----------------- ## 171 172#行数が10000文字を超えたのでここの内容は割愛します。 173 174
試したこと
gccのバージョンを変更するだけではなく、ライブラリのパスも通さなければならないのではないか?と考えました。
そこで下のコマンドを実行しました。
CC=/usr/local/Cellar/gcc@5/5.5.0_3/bin/gcc-5 CXX=/usr/local/Cellar/gcc@5/5.5.0_3/bin/g++-5 LIBS=/usr/local/Cellar/gcc@5/5.5.0_3/include/c++/5.5.0/ ./configure
しかし、configureは通りませんでした。
長くなり申し訳ありません。些細な情報だけでもいいの教えていただけると幸いです。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。