2015-10-13 38 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是否使用正確的版本? –