2017-08-10 119 views
1

我試圖按照Web程序集指令(http://webassembly.org/getting-started/developers-guide/)安裝emsdk。這一切都在編譯OSX很好,但我遇到了以下錯誤,當我試圖建立它在Ubuntu 16.04:嘗試在Ubuntu上構建emsdk時出錯16.04

[ 94%] Built target llvm-lto2 
[ 94%] Built target llvm-diff 
[ 94%] Linking CXX executable ../../bin/llvm-c-test 
collect2: error: ld returned 1 exit status 
tools/llvm-c-test/CMakeFiles/llvm-c-test.dir/build.make:425: recipe for target 'bin/llvm-c-test' failed 
make[2]: *** [bin/llvm-c-test] Error 1 
CMakeFiles/Makefile2:15474: recipe for target 'tools/llvm-c-test/CMakeFiles/llvm-c-test.dir/all' failed 
make[1]: *** [tools/llvm-c-test/CMakeFiles/llvm-c-test.dir/all] Error 2 
Makefile:149: recipe for target 'all' failed 
make: *** [all] Error 2 
Build failed due to exception! 
Working directory: /opt/emsdk/clang/fastcomp/build_incoming_64 
Command '['make', '-j1']' returned non-zero exit status 2 
Installation failed! 

有誰知道這是怎麼回事?

回答

0

對於我來說,構建emsdk的主要問題是交換,因爲它看起來像安裝腳本檢測4個邏輯處理器核心並啓動3線程編譯。當一切都編譯完成時,幾個鏈接器進程(ld)似乎同時啓動,它們耗盡了我的8Gb內存(至少當Firefox中有很多標籤同時運行時)。系統變得沒有響應,我必須停止使用它,並等待或終止ld進程之一,然後在我的情況下,其他兩個將完成鏈接,雖然安裝將失敗,當我重新運行它時,有2個較少的二進制文件鏈接:) 。

我試圖模擬內存耗盡不交換與

$ ulimit -v 2000000 
$ ./emsdk install sdk-incoming-64bit 

,並得到了同樣的錯誤collect2: error: ld returned 1 exit status但之前它像/usr/bin/ld: failed to set dynamic section sizes: Memory exhausted

我完全無法確定您的正是這個問題(特別是因爲你沒有任何Memory exhausted消息,並要執行單線程彙編(make -j1)),但也有可能可能當內存是其他故障在ld用盡了。您可以重新運行安裝,同時觀察另一個終端上的top輸出,檢查空閒內存+ buff/cache幾乎變爲0(只是空閒內存幾乎爲0可能沒問題)。如果是這樣,你可以嘗試使用交換分區或文件。不幸的是,你不能使用終止ld進程之一的技巧,因爲你已經有了單線程編譯(make -j1)。

+0

謝謝!這是一個徹底的解釋! :)我也能夠通過直接向網上的程序員請求幫助來解決這個問題:https://github.com/WebAssembly/website/issues/103 –