Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyTrellis.cpp crashes c++: internal compiler error: Killed (program cc1plus) - Out of memory #122

Open
gojimmypi opened this issue Mar 3, 2020 · 0 comments

Comments

@gojimmypi
Copy link
Contributor

TL;DR; default Ubuntu 18.04 LTS 2GB VM runs out of memory during compile. Now needs at least 4GB.

I have this gist to setup the toolchain. At one point in the past, I believe I was able to do this with relatively little memory, even on a Raspberry Pi. 

Building CXX object CMakeFiles/pytrellis.dir/src/PyTrellis.cpp.o fails:

***************************************************************************************************
 prjtrellis (required for nextpnr-ecp5). Saving log to /home/gojimmypi/workspace/install_logs/ULX3S_WSL_Toolchain_prjtrellis_20200303_093548.log
***************************************************************************************************
Cloning into 'prjtrellis'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 4014 (delta 0), reused 1 (delta 0), pack-reused 4008
Receiving objects: 100% (4014/4014), 844.31 KiB | 957.00 KiB/s, done.
Resolving deltas: 100% (2508/2508), done.
Submodule 'database' (https://github.com/SymbiFlow/prjtrellis-db) registered for path 'database'
Cloning into '/home/gojimmypi/workspace/prjtrellis/database'...
remote: Enumerating objects: 50, done.        
remote: Counting objects: 100% (50/50), done.        
remote: Compressing objects: 100% (38/38), done.        
remote: Total 2572 (delta 28), reused 20 (delta 6), pack-reused 2522        
Receiving objects: 100% (2572/2572), 2.71 MiB | 1.43 MiB/s, done.
Resolving deltas: 100% (1758/1758), done.
Submodule path 'database': checked out '717478b757a702bbc7e3e11a5fbecee2a64f7922'
./ULX3S_WSL_Toolchain.sh: File 'Makefile' not found. Not cleaning...
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.9", minimum required is "3.5") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.6m.so (found suitable version "3.6.9", minimum required is "3.5") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   thread
--   program_options
--   system
--   chrono
--   date_time
--   atomic
CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1626 (message):
  No header defined for python-py369; skipping header check
Call Stack (most recent call first):
  CMakeLists.txt:48 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1626 (message):
  No header defined for python-py36; skipping header check
Call Stack (most recent call first):
  CMakeLists.txt:55 (find_package)


-- Configuring done
-- Generating done
-- Build files have been written to: /home/gojimmypi/workspace/prjtrellis/libtrellis
Ok! Exit code = [0] using params=
Scanning dependencies of target pytrellis
[  2%] Building CXX object CMakeFiles/pytrellis.dir/src/Bels.cpp.o
[  4%] Building CXX object CMakeFiles/pytrellis.dir/src/BitDatabase.cpp.o
[  6%] Building CXX object CMakeFiles/pytrellis.dir/src/Bitstream.cpp.o
[  9%] Building CXX object CMakeFiles/pytrellis.dir/src/CRAM.cpp.o
[ 11%] Building CXX object CMakeFiles/pytrellis.dir/src/Chip.cpp.o
[ 13%] Building CXX object CMakeFiles/pytrellis.dir/src/ChipConfig.cpp.o
[ 16%] Building CXX object CMakeFiles/pytrellis.dir/src/Database.cpp.o
[ 18%] Building CXX object CMakeFiles/pytrellis.dir/src/DedupChipdb.cpp.o
[ 20%] Building CXX object CMakeFiles/pytrellis.dir/src/PyTrellis.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
make[2]: *** [CMakeFiles/pytrellis.dir/src/PyTrellis.cpp.o] Error 4
CMakeFiles/pytrellis.dir/build.make:254: recipe for target 'CMakeFiles/pytrellis.dir/src/PyTrellis.cpp.o' failed
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pytrellis.dir/all' failed
make[1]: *** [CMakeFiles/pytrellis.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

this likely means we ran out of memory. check with dmesg and sure enough:

[ 8408.353412] [   2114]  1000  2114     5030        0    81920       95             0 ULX3S_WSL_Toolc
[ 8408.353413] [  13205]  1000 13205     7420       11   102400      381             0 bash
[ 8408.353414] [  13260]  1000 13260    10490        1   110592      153             0 make
[ 8408.353415] [  13263]  1000 13263    10490        0   110592      143             0 make
[ 8408.353415] [  13267]  1000 13267    10490        1   114688      162             0 make
[ 8408.353416] [  13310]  1000 13310     3920        0    65536       46             0 c++
[ 8408.353417] [  13311]  1000 13311   412838   354085  3305472    39523             0 cc1plus
[ 8408.353418] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/,task=cc1plus,pid=13311,uid=1000
[ 8408.353423] Out of memory: Killed process 13311 (cc1plus) total-vm:1651352kB, anon-rss:1416340kB, file-rss:0kB, shmem-rss:0kB
[ 8408.509854] oom_reaper: reaped process 13311 (cc1plus), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB

also fails with 3GB:

gojimmypi@ubuntu:~/workspace/prjtrellis/libtrellis$ free
              total        used        free      shared  buff/cache   available
Mem:        3035088      647896     1394648        2560      992544     2192812
Swap:        969960      632076      337884

with the same error:

[  288.756441] [   1910]  1000  1910    10490        0   118784      156             0 make
[  288.756441] [   1913]  1000  1913     3920        0    69632       46             0 c++
[  288.756442] [   1914]  1000  1914   704287   609739  5595136    65575             0 cc1plus
[  288.756443] [   1915]  1000  1915   235121     1503   724992        0             0 deja-dup-monito
[  288.756444] [   1927]  1000  1927    88455     1167   446464        0             0 baobab
[  288.756445] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/,task=cc1plus,pid=1914,uid=1000
[  288.756451] Out of memory: Killed process 1914 (cc1plus) total-vm:2817148kB, anon-rss:2438956kB, file-rss:0kB, shmem-rss:0kB
[  289.199777] oom_reaper: reaped process 1914 (cc1plus), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB

This issue can probably be closed with the known solution of simply adding more memory, but perhaps someone wants to peek at PyTrellis.cpp to see why now it needs so much memory to compile?
  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant