cc1 메모리 부족 오류

cc1 메모리 부족 오류

Xubuntu 64비트를 실행하는 컴퓨터가 있고 꽤 긴 C 코드를 컴파일하려고 합니다. 을 사용하고 있습니다 gcc.

실행 코드는 내 Raspberry PI 3 모델 B+에서 실행되어야 하기 때문에 Raspbian Stretch 환경에서 루트를 지정했습니다. chroot하려면 다음 지침을 따랐습니다.

sudo mount /dev/sdb2 /mnt
sudo apt-get install qemu qemu-user qemu-user-static
sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/ 
sudo chroot /mnt

Raspbian 환경에 들어간 후 다음을 실행했습니다.

gcc -Os $(python3-config --cflags --ldflags) Code.c -o ExecutableCode

그리고 다음과 같은 결과를 얻었습니다.

cc1: out of memory allocating 32324 bytes after a total of 543821824 bytes

내 컴퓨터의 계산 능력은 상당히 높기 때문에(내 PC는 워크스테이션입니다) 메모리가 부족하다고는 생각하지 않습니다. 누군가 아이디어가 있습니까?

답변1

문서 읽기: man 1 qemu-user-static:

qemu-user-static(1)                                   Debian                                  qemu-user-static(1)

NAME
       qemu-user-static - QEMU User Emulator (static version)

SYNOPSIS
       qemu-user-static [options] program [program-arguments...]

DESCRIPTION
       The  qemu-user-static emulator can run binaries for other architectures but with the same operating system
       as the current one.

OPTIONS
       -h     Print this help.

       -g <port>
              Wait gdb connection to port port.

       -L <path>
              Set the elf interpreter prefix (default=/etc/qemu-binfmt/%M).

       -s <size>
              Set the stack size in bytes (default=524288).

       -d <options>
              Activate log (logfile=/tmp/qemu.log)

       -p <pagesize>
              Set the host page size to 'pagesize'.

SEE ALSO
       qemu-system(1) (in qemu-system-common package).

에 인수를 전달하지 않았으므로 qemu메모리 및 Cie에 기본값을 사용했습니다. 기본값이 꽤 낮아서 컴파일 작업이 기본값을 초과한 것 같습니다.

스위치를 사용하여 내 플랫폼에서 실행하면 다음 -h이 제공됩니다.

$ sudo chroot /tmp/root/ /qemu-arm-static
usage: qemu-arm [options] program [arguments...]
Linux CPU emulator (compiled for arm emulation)

Options and associated environment variables:

Argument             Env-variable      Description
-h                                     print this help
-help                                  
-g port              QEMU_GDB          wait gdb connection to 'port'
-L path              QEMU_LD_PREFIX    set the elf interpreter prefix to 'path'
-s size              QEMU_STACK_SIZE   set the stack size to 'size' bytes
-cpu model           QEMU_CPU          select CPU (-cpu help for list)
-E var=value         QEMU_SET_ENV      sets targets environment variable (see below)
-U var               QEMU_UNSET_ENV    unsets targets environment variable (see below)
-0 argv0             QEMU_ARGV0        forces target process argv[0] to be 'argv0'
-r uname             QEMU_UNAME        set qemu uname release string to 'uname'
-B address           QEMU_GUEST_BASE   set guest_base address to 'address'
-R size              QEMU_RESERVED_VA  reserve 'size' bytes for guest virtual address space
-d item[,...]        QEMU_LOG          enable logging of specified items (use '-d help' for a list of items)
-dfilter range[,...] QEMU_DFILTER      filter logging based on address range
-D logfile           QEMU_LOG_FILENAME write logs to 'logfile' (default stderr)
-p pagesize          QEMU_PAGESIZE     set the host page size to 'pagesize'
-singlestep          QEMU_SINGLESTEP   run in singlestep mode
-strace              QEMU_STRACE       log system calls
-seed                QEMU_RAND_SEED    Seed for pseudo-random number generator
-trace               QEMU_TRACE        [[enable=]<pattern>][,events=<file>][,file=<file>]
-version             QEMU_VERSION      display version information and exit

Defaults:
QEMU_LD_PREFIX  = /etc/qemu-binfmt/arm
QEMU_STACK_SIZE = 8388608 byte

You can use -E and -U options or the QEMU_SET_ENV and
QEMU_UNSET_ENV environment variables to set and unset
environment variables for the target process.
It is possible to provide several variables by separating them
by commas in getsubopt(3) style. Additionally it is possible to
provide the -E and -U options multiple times.
The following lines are equivalent:
    -E var1=val2 -E var2=val2 -U LD_PRELOAD -U LD_DEBUG
    -E var1=val2,var2=val2 -U LD_PRELOAD,LD_DEBUG
    QEMU_SET_ENV=var1=val2,var2=val2 QEMU_UNSET_ENV=LD_PRELOAD,LD_DEBUG
Note that if you provide several changes to a single variable
the last change will stay in effect.

See <https://qemu.org/contribute/report-a-bug> for how to report bugs.
More information on the QEMU project at <https://qemu.org>.

QEMU_STACK_SIZE가 너무 낮을 수도 있습니다.

관련 정보