Tag Archives: Linux C++ Compile Error

[Solved] Linux C++ Compile Error: c++: internal compiler error: Killed (program cc1plus)

Compilation error:

/home/service/rpc/goya-rpc/src/rpc_server_impl.cc: In member function ‘void goya::rpc::RpcServerImpl::OnCallbackDone(google::protobuf::Message*, boost::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp> >)’:
/home/service/rpc/goya-rpc/src/rpc_server_impl.cc:101:44: warning: ‘int google::protobuf::MessageLite::ByteSize() const’ is deprecated (declared at /home/service/rpc/goya-rpc/thirdparty/install/include/google/protobuf/message_lite.h:430): Please use ByteSizeLong() instead [-Wdeprecated-declarations]
   int serialized_size = resp_msg->ByteSize();
                                            ^
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make[2]: *** [src/CMakeFiles/goya-rpc.dir/rpc_server_impl.cc.o] Error 4
make[1]: *** [src/CMakeFiles/goya-rpc.dir/all] Error 2
make: *** [all] Error 2

The reason for the error is that the compiling machine is running out of memory, and a large number of template extensions need enough memory.

#View linux memory usage by.
1.ps aux --sort -rss
2.free -m
3.top  Press [shift + M keys] to arrange them in reverse order
4.cat /proc/meminfo

Solution:

You can solve this problem by temporarily using swap partitions:

=[step 1: operate as follows]=========================================

Sudo DD if=/dev/zero of=/swapfile bs=64m count=16
\count is the size of the increased swap space. 64M is the block size, so the space size is bs*count=1024mb
sudo mkswap /swapfile \

=[step 2: close release] ==================================================================================

Sudo swapoff /swapfile
sudo RM /swapfile
then continue to perform your relevant operations…

Note: if you still prompt “g++: internal compiler error: killed (program cc1plus)” after creating the temporary space, it may be because the allocated space is not large enough. You can continue to allocate more space.