[solved] C++ compiler killed at build stage

Hi,

I am now having another problem in my snapcraft journey :slight_smile:

At some point, cmake of Gnuradio failed on:

 83%] Built target blocks_swig4
Scanning dependencies of target fec_swig
[ 83%] Building CXX object gr-fec/swig/CMakeFiles/fec_swig.dir/CMakeFiles/fec_swig.dir/fec_swigPYTHON_wrap.cxx.o
/root/parts/gnuradio/build/gr-fec/swig/CMakeFiles/fec_swig.dir/fec_swigPYTHON_wrap.cxx: In function ‘PyObject* _wrap_generic_encoder_sptr_base_unique_id_get(PyObject*, PyObject*)’:
/root/parts/gnuradio/build/gr-fec/swig/CMakeFiles/fec_swig.dir/fec_swigPYTHON_wrap.cxx:6459:50: warning: variable ‘arg1’ set but not used [-Wunused-but-set-variable]
   boost::shared_ptr< gr::fec::generic_encoder > *arg1 = (boost::shared_ptr< gr::fec::generic_encoder > *) 0 ;
                                                  ^~~~
/root/parts/gnuradio/build/gr-fec/swig/CMakeFiles/fec_swig.dir/fec_swigPYTHON_wrap.cxx: In function ‘PyObject* _wrap_generic_decoder_sptr_base_unique_id_get(PyObject*, PyObject*)’:
/root/parts/gnuradio/build/gr-fec/swig/CMakeFiles/fec_swig.dir/fec_swigPYTHON_wrap.cxx:7176:50: warning: variable ‘arg1’ set but not used [-Wunused-but-set-variable]
   boost::shared_ptr< gr::fec::generic_decoder > *arg1 = (boost::shared_ptr< gr::fec::generic_decoder > *) 0 ;
                                                  ^~~~
[ 83%] Linking CXX shared module _blocks_swig7.so
[ 83%] Built target blocks_swig7
Scanning dependencies of target fft_swig
[ 84%] Building CXX object gr-fft/swig/CMakeFiles/fft_swig.dir/CMakeFiles/fft_swig.dir/fft_swigPYTHON_wrap.cxx.o
[ 84%] Linking CXX shared module _fec_swig.so
[ 84%] Built target fec_swig
Scanning dependencies of target filter_swig
[ 84%] Building CXX object gr-filter/swig/CMakeFiles/filter_swig.dir/CMakeFiles/filter_swig.dir/filter_swigPYTHON_wrap.cxx.o
[ 84%] Linking CXX shared module _fft_swig.so
[ 84%] Built target fft_swig
Scanning dependencies of target analog_swig
[ 84%] Building CXX object gr-analog/swig/CMakeFiles/analog_swig.dir/CMakeFiles/analog_swig.dir/analog_swigPYTHON_wrap.cxx.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.
gr-filter/swig/CMakeFiles/filter_swig.dir/build.make:62: recipe for target 'gr-filter/swig/CMakeFiles/filter_swig.dir/CMakeFiles/filter_swig.dir/filter_swigPYTHON_wrap.cxx.o' failed
make[2]: *** [gr-filter/swig/CMakeFiles/filter_swig.dir/CMakeFiles/filter_swig.dir/filter_swigPYTHON_wrap.cxx.o] Error 4
CMakeFiles/Makefile2:6076: recipe for target 'gr-filter/swig/CMakeFiles/filter_swig.dir/all' failed
make[1]: *** [gr-filter/swig/CMakeFiles/filter_swig.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 84%] Linking CXX shared module _analog_swig.so
[ 84%] Built target analog_swig
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Failed to run 'cmake --build . -- -j2' for 'gnuradio': Exited with code 2.
Verify that the part is using the correct parameters and try again.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute 'sudo -i env SNAPCRAFT_HAS_TTY=True snapcraft build' with 'multipass': returned exit code 2.

I think the relevant line is:

c++: internal compiler error: Killed (program cc1plus)

Generic references on Internet point out that it could be a lack of memory, so I tried to set:

export SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=8G

But no luck.

I cannot reproduce this error on my 18.04 host, with the same libs and source code.

So, I believe this is really related to the build environement.

Any idea please?

did you run snapcraft clean before trying to build again ? it needs to be a full clean run that removes and re-creates the multipass VM, else the 8G you gave the VM will not be used.

Indeed, it worked and having more RAM solved the compilation issue.
Thank you!