I have to compile C code which contains python function. I have a Ubuntu 19 64 bit machine and I need to compile the C code for my raspberry pi 3model b+ running raspbian stretch. To do that, I followed https://raspberrypi.stackexchange.com/a/109524/116139 to create a docker container with the stretch version I need. My docker stats
are:
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS14b303f257da DOCKER_CONTAINER 0.00% 13.68MiB / 7.776GiB 0.17% 6.51MB / 26.6kB 19.4MB / 41kB 2
Inside the container environment, running top
:
1 root 20 0 4241352 12308 4892 S 0.0 0.2 0:00.50 bash 133 root 0 0 4241096 12048 4972 R 0.0 0.1 0:00.00 top
In addition, running df -h
:
Filesystem Size Used Avail Use% Mounted onoverlay 30G 21G 7.6G 74% /tmpfs 64M 0 64M 0% /devtmpfs 3.9G 0 3.9G 0% /sys/fs/cgroupshm 64M 0 64M 0% /dev/shm/dev/sda1 30G 21G 7.6G 74% /etc/hoststmpfs 3.9G 0 3.9G 0% /proc/asoundtmpfs 3.9G 0 3.9G 0% /proc/acpitmpfs 3.9G 0 3.9G 0% /proc/scsitmpfs 3.9G 0 3.9G 0% /sys/firmware
So, I gave you all the memories information about my system. My gcc command runs out of memory in compiling my large C code:
gcc -Os $(python3-config --cflags --ldflags) CCODE.c -o EXECUTABLE_CODE cc1: out of memory allocating 66660800 bytes after a total of 290631680 bytes
Running just the gcc
command (without docker) in the RPi4 it works (while on RPi3b+ it fails reporting cc1: out of memory
). However, I need RPi3 which unfortunately has a different OS.I'm stuck in this problem for weeks. Does someone have any tips or different solutions? Thanks in advice.