mapbox / protozero

Minimalist protocol buffer decoder and encoder in C++
BSD 2-Clause "Simplified" License
292 stars 78 forks source link

Compiling error (memory?) #92

Closed mvexel closed 6 years ago

mvexel commented 6 years ago

I posted this downstream at https://github.com/osmcode/pyosmium/issues/72 but this may actually be the better location.

I run into a compiler error when compiling protozero:

protozero found in 'protozero-1.6.3'.
x86_64-linux-gnu-g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
error: Setup script exited with error: command 'x86_64-linux-gnu-g++' failed with exit status 4

My best guess is this is a memory constraint related error.. This is on a Linode 2G with (you guessed it) 2GB of RAM. Is there a way around this? I cannot easily upgrade this machine.

geeknik commented 6 years ago

Have you tried creating a swapfile?

sudo fallocate -l 2G /swapfile
sudo chmod 0600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
mvexel commented 6 years ago

Thanks for the suggestion. However:

Running osmium-2.14.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-72zioecy/osmium-2.14.3/egg-dist-tmp-x6f_78uu
libosmium found in 'libosmium-2.14.2'.
protozero found in 'protozero-1.6.3'.
virtual memory exhausted: Cannot allocate memory
error: Setup script exited with error: command 'x86_64-linux-gnu-g++' failed with exit status 1
geeknik commented 6 years ago

I don’t know about libosmium, but protozero compiles without error here on a Debian 9 and Ubuntu 18 VPS both with 512MB RAM and 2GB swap. Are you just running ‘make’ or something like ‘make -j2’? If the latter, try the former because while concurrency is faster it also uses more RAM. I have no other suggestions, maybe a Mapbox dev has an idea?

joto commented 6 years ago

No, this is the wrong location. You are not compiling protozero, you are compiling pyosmium.