我正在尝试使用 gcc 4.7 编译一些库(我刚从4.6.3升级,不知何故它抱怨c编译器:
/home/rtbkit/platform-deps/node/wscript:263: error: could not configure a c compiler!
make[1]: Entering directory `/home/rtbkit/platform-deps/node'
Project not configured (run 'waf configure' first)
make[1]: *** [program] Error 1
make[1]: Target `all' not remade because of errors.
make[1]: Leaving directory `/home/rtbkit/platform-deps/node'
make[1]: Entering directory `/home/rtbkit/platform-deps/node'
Project not configured (run 'waf configure' first)
make[1]: *** [program] Error 1
make[1]: Target `all' not remade because of errors.
make[1]: Leaving directory `/home/rtbkit/platform-deps/node'
make[1]: Entering directory `/home/rtbkit/platform-deps/node'
Project not configured (run 'waf configure' first)
make[1]: *** [program] Error 1
make[1]: Leaving directory `/home/rtbkit/platform-deps/node'
installing
make[1]: Entering directory `/home/rtbkit/platform-deps/node'
Project not configured (run 'waf configure' first)
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/rtbkit/platform-deps/node'
cp: target `/home/rtbkit/local/include/node' is not a directory
make: *** [install_node] Error 1
答案 0 :(得分:1)
gcc-4.7可能未设置为自动默认值。根据您的操作系统版本,您可能需要从另一个存档(如PPA)获取4.7版本。这是针对Ubuntu的:
安装python工具,将存档添加到apt-get:
root@bidder:~# apt-get install python-software-properties
然后添加ppa存档:
root@bidder:~# add-apt-repository ppa:ubuntu-toolchain-r/test
确保没有现有的链接:
root@bidder:~# update-alternatives --remove-all gcc
root@bidder:~# update-alternatives --remove-all g++
更新所有档案中的包列表:
root@bidder:~# apt-get update
安装4.7版本的gcc和g ++:
root@bidder:~# apt-get install gcc-4.7
root@bidder:~# apt-get -f install
root@bidder:~# apt-get install g++-4.7
添加新版本的默认链接:
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 20
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 20
root@bidder:~# update-alternatives --config gcc
root@bidder:~# update-alternatives --config g++
确认版本和默认值:
root@bidder:~# apt-cache policy gcc
主要参考https://askubuntu.com/questions/26498/choose-gcc-and-g-version/26518#26518和Ubuntu 12.04上的个人经验。