could not configure a c compiler

2019-09-19 11:39发布

I am trying to compile some libraries using gcc 4.7 (which i just upgraded from 4.6.3, somehow it complain about c compiler:

/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

1条回答
Fickle 薄情
2楼-- · 2019-09-19 12:07

gcc-4.7 may not be set as the auto default. Depending on your OS version you may need to get the 4.7 version from another archive like PPA. This is for Ubuntu:

Install the python tools for adding an archive to apt-get:

root@bidder:~# apt-get install python-software-properties

Then add the ppa archive:

root@bidder:~# add-apt-repository ppa:ubuntu-toolchain-r/test

Make sure there are no existing linking:

root@bidder:~# update-alternatives --remove-all gcc
root@bidder:~# update-alternatives --remove-all g++

Update list of packages from all archives:

root@bidder:~# apt-get update

Install the 4.7 versions of gcc and g++ :

root@bidder:~# apt-get install gcc-4.7
root@bidder:~# apt-get -f install
root@bidder:~# apt-get install g++-4.7

Add default links to the new versions:

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++

Confirm the versions and defaults:

root@bidder:~# apt-cache policy gcc

Mostly referenced from https://askubuntu.com/questions/26498/choose-gcc-and-g-version/26518#26518 and personal experience on Ubuntu 12.04.

查看更多
登录 后发表回答