2015-10-13 69 views
0

对于安装,我必须更改我的默认gcc编译器版本。我在使用的版本中遇到了一些编译问题,所以我通过macports下载了其他几个版本,其中一个最终用于我的安装。更改了默认的gcc版本,现在正在编译问题

我几乎可以肯定,我以前使用过的是gcc4.2,在我的ports中列出为:llvm-gcc42。

在另外两种情况下,我正面临着C++文件的编译问题。我对C++不熟悉,我使用编译器只是为了编译一些 - 主要是node.js - 模块或现在,为原子编辑器打包。

这里是我所得到的,这使我的assumtion的东西与C++编译器是不正确的:

cc1plus:错误:无法识别的命令行选项 “-std = GNU ++ 0x中”

我可以通过更改默认的gcc版本来摆脱第一种情况。但我无法每次尝试几个版本。

所以:我应该使用哪一个gcc版本,或者是否有其他可能导致此问题的内容? gcc5,最新使我有同样..


在特定的情况下:问题与安装termrk(用于原子编辑器模块)

gcc --version 
gcc (MacPorts gcc5 5.2.0_0) 5.2.0 
[...] 

有安装包原子的两种方式:在编辑器中用gui和命令行工具apm。两者都不起作用,但我得到了不同的错误消息。

1.在GUI内:

> [email protected] install /private/var/folders/nl/2ppbw8fn0cjbw04pdqbxmqtr0000gn/T/apm-install-dir-115913-1105-1g6fykw/node_modules/Termrk/node_modules/pty.js 
 
> node-gyp rebuild 
 

 
    CXX(target) Release/obj.target/pty/src/unix/pty.o 
 

 
cc1plus: error: unrecognized command line option "-std=gnu++0x" 
 
make: *** [Release/obj.target/pty/src/unix/pty.o] Error 1 
 
gyp ERR! build error 
 
gyp ERR! stack Error: `make` failed with exit code: 2 
 
gyp ERR! stack  at ChildProcess.onExit (/Applications/Atom.app/Contents/Resources/app/apm/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23) 
 
gyp ERR! stack  at ChildProcess.emit (events.js:98:17) 
 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (child_process.js:820:12) 
 
gyp ERR! System Darwin 12.6.0 
 
gyp ERR! command "node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
 
gyp ERR! cwd /private/var/folders/nl/2ppbw8fn0cjbw04pdqbxmqtr0000gn/T/apm-install-dir-115913-1105-1g6fykw/node_modules/Termrk/node_modules/pty.js 
 
gyp ERR! node -v v0.10.40 
 
gyp ERR! node-gyp -v v2.0.2 
 
gyp ERR! not ok 
 
npm ERR! Darwin 12.6.0 
 
npm ERR! argv "/Applications/Atom.app/Contents/Resources/app/apm/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Users/michael/.atom/.apm/.apmrc" "--userconfig" "/Users/michael/.atom/.apmrc" "install" "/private/var/folders/nl/2ppbw8fn0cjbw04pdqbxmqtr0000gn/T/d-115913-1105-1hg4ytj/package.tgz" "--target=0.30.7" "--arch=x64" 
 
npm ERR! node v0.10.40 
 
npm ERR! npm v2.13.3 
 
npm ERR! code ELIFECYCLE 
 

 
npm ERR! [email protected] install: `node-gyp rebuild` 
 
npm ERR! Exit status 1 
 
npm ERR! 
 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. 
 
npm ERR! This is most likely a problem with the pty.js package, 
 
npm ERR! not with npm itself. 
 
npm ERR! Tell the author that this fails on your system: 
 
npm ERR!  node-gyp rebuild 
 
npm ERR! You can get their info via: 
 
npm ERR!  npm owner ls pty.js 
 
npm ERR! There is likely additional logging output above. 
 

 
npm ERR! Please include the following file with any support request: 
 
npm ERR!  /private/var/folders/nl/2ppbw8fn0cjbw04pdqbxmqtr0000gn/T/apm-install-dir-115913-1105-1g6fykw/npm-debug.log

1.在终端:

~ michael$ sudo apm install termrk 
 
Installing termrk to /Users/michael/.atom/packages ✗ 
 

 
> [email protected] install /private/tmp/apm-install-dir-115913-1063-2zj63h/node_modules/Termrk/node_modules/pty.js 
 
> node-gyp rebuild 
 

 

 
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied 
 
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied 
 

 
node.js:844 
 
    var cwd = process.cwd(); 
 
        ^
 
Error: EACCES, permission denied 
 
    at Function.startup.resolveArgv0 (node.js:844:23) 
 
    at startup (node.js:58:13) 
 
    at node.js:935:3 
 
npm ERR! Darwin 12.6.0 
 
npm ERR! argv "/Applications/Atom.app/Contents/Resources/app/apm/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Users/michael/.atom/.apm/.apmrc" "--userconfig" "/Users/michael/.atom/.apmrc" "install" "/private/tmp/d-115913-1063-1cgkfyq/package.tgz" "--target=0.30.7" "--arch=x64" 
 
npm ERR! node v0.10.40 
 
npm ERR! npm v2.13.3 
 
npm ERR! code ELIFECYCLE 
 

 
npm ERR! [email protected] install: `node-gyp rebuild` 
 
npm ERR! Exit status 8 
 
npm ERR! 
 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. 
 
npm ERR! This is most likely a problem with the pty.js package, 
 
npm ERR! not with npm itself. 
 
npm ERR! Tell the author that this fails on your system: 
 
npm ERR!  node-gyp rebuild 
 
npm ERR! You can get their info via: 
 
npm ERR!  npm owner ls pty.js 
 
npm ERR! There is likely additional logging output above. 
 

 
npm ERR! Please include the following file with any support request: 
 
npm ERR!  /private/tmp/apm-install-dir-115913-1063-2zj63h/npm-debug.log

+0

我想我会删除我的答案,因为它实际上没有什么意义。看起来像node-gyp选择了旧版本的编译器。我对此毫不知情,也无济于事。祝你好运! – Rostislav

回答

0

对于GCC 5.2来说这是一个有效的选项,所以如果它说它是无法识别的,那么这意味着你没有使用GCC 5.2。

您可能仍在编译旧的GCC 4.2版本。

+0

是有道理的,但gcc --version告诉我gcc(MacPorts gcc5 5.2.0_0)5.2.0。任何想法如何检查node-gyp是否使用正确的版本? –