2016-11-28 25 views
0

我對Ruby不是很熟悉,但是使用的是需要構建一些Ruby本機擴展的系統實用程序。當我嘗試運行安裝命令,我得到以下堆棧跟蹤:更改Ruby本機擴展的tmp目錄

Building native extensions. This could take a while... 
ERROR: Error installing sensu-plugins-http: 
    ERROR: Failed to build gem native extension. 

    current directory: /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.7.2/ext/unf_ext 
/opt/sensu/embedded/bin/ruby -r ./siteconf20161128-17526-tzlgio.rb extconf.rb 
checking for main() in -lstdc++... yes 
creating Makefile 

To see why this extension failed to compile, please check the mkmf.log which can be found here: 

    /opt/sensu/embedded/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/unf_ext-0.0.7.2/mkmf.log 

current directory: /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.7.2/ext/unf_ext 
make "DESTDIR=" clean 

current directory: /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.7.2/ext/unf_ext 
make "DESTDIR=" 
compiling unf.cc 
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default] 
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default] 
unf.cc:75:1: fatal error: error writing to /tmp/ccyXxObQ.s: No space left on device 
compilation terminated. 
make: *** [unf.o] Error 1 

make failed, exit code 2 

由於種種原因,我的/tmp/目錄是有意小。我想知道,有沒有辦法讓Ruby/gcc爲構建過程使用不同的臨時位置?

回答

0

是的。在編譯之前設置TMPDIR環境變量:

TMPDIR

如果TMPDIR設置,它指定用於 臨時文件的目錄。 GCC使用臨時文件來保存一個 編譯階段的輸出,該編譯階段將被用作下一階段的輸入: 例如預處理器的輸出,其是編譯器本身的輸入 。

來源:
https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html