Skip to content

Instantly share code, notes, and snippets.

@tonosaman
Last active October 22, 2016 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonosaman/4791ece468170af7fc8652e3bb833ba7 to your computer and use it in GitHub Desktop.
Save tonosaman/4791ece468170af7fc8652e3bb833ba7 to your computer and use it in GitHub Desktop.
NetBSD7.0.1 で LLVM-3.9 をビルドしたい人の備忘録(2)

NetBSD7.0でLLVM-3.9 をビルドしたい人の備忘録(2)

1GBだとメモリ足りなくてOOMキラーにわからん殺しされるので4GBにした話

仮想マシン(vagrant)にビルド環境を作ってやっているのですが、 ホストのソースツリーをNFSマウントしてビルドしてるとそこでもメモリを喰われますよね。 一旦ゲストを立ち上げ直して、続きからビルドしたらあっさり通ったりします。

症状: LLVMPassesをビルドしようとしてcc1plus内部エラー

Scanning dependencies of target LLVMPasses
[ 50%] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
c++: internal compiler error: Killed (program cc1plus)
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.NetBSD.org/support/send-pr.html> for instructions.
*** Error code 4

Stop.
make[2]: stopped in /vagrant/build
*** Error code 1

Stop.
make[1]: stopped in /vagrant/build
*** Error code 1

Stop.
make: stopped in /vagrant/build

調査ログ

$ /vagrant/cmake-3.6.2/bin/cmake --build /vagrant/build/ --target LLVMPasses -- -n
/vagrant/cmake-3.6.2/bin/cmake -H/vagrant/llvm/dist/llvm -B/vagrant/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/make -f CMakeFiles/Makefile2 LLVMPasses

$ /vagrant/cmake-3.6.2/bin/cmake --build /vagrant/build/ --target LLVMPasses -- -deFstdout
[ 75%] Built target LLVMSupport
[ 75%] Built target LLVMTableGen
[100%] Built target obj.llvm-tblgen
[100%] Built target llvm-tblgen
[100%] Built target intrinsics_gen
[100%] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
c++: internal compiler error: Killed (program cc1plus)
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.NetBSD.org/support/send-pr.html> for instructions.

*** Failed target:  lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
*** Failed command: cd /vagrant/build/lib/Passes && /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vagrant/build/lib/Passes -I/vagrant/llvm/dist/llvm/lib/Passes -I/vagrant/build/include -I/vagrant/llvm/dist/llvm/include -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -std=c++11 -g -fno-exceptions -fno-rtti -o CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o -c /vagrant/llvm/dist/llvm/lib/Passes/PassBuilder.cpp
*** Error code 4

Stop.
make[3]: stopped in /vagrant/build

*** Failed target:  lib/Passes/CMakeFiles/LLVMPasses.dir/all
*** Failed command: /usr/bin/make -f lib/Passes/CMakeFiles/LLVMPasses.dir/build.make lib/Passes/CMakeFiles/LLVMPasses.dir/build
*** Error code 1

Stop.
make[2]: stopped in /vagrant/build

*** Failed target:  lib/Passes/CMakeFiles/LLVMPasses.dir/rule
*** Failed command: /usr/bin/make -f CMakeFiles/Makefile2 lib/Passes/CMakeFiles/LLVMPasses.dir/all
*** Error code 1

Stop.
make[1]: stopped in /vagrant/build

*** Failed target:  LLVMPasses
*** Failed command: /usr/bin/make -f CMakeFiles/Makefile2 LLVMPasses
*** Error code 1

Stop.
make: stopped in /vagrant/build
$ cd /vagrant/build/lib/Passes
$ gdb
(gdb) file /usr/bin/c++
(gdb) run -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vagrant/build/lib/Passes -I/vagrant/llvm/dist/llvm/lib/Passes -I/vagrant/build/include -I/vagrant/llvm/dist/llvm/include -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -std=c++11 -g -fno-exceptions -fno-rtti -o CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o -c /vagrant/llvm/dist/llvm/lib/Passes/PassBuilder.cpp

スタックごと死ぬ場合は、OOMキラーを疑えってことかー

log

  • 備忘録(1) BSD系カーネルは動的リンク時の$ORIGIN未対応
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment