Project

General

Profile

Bug #21611

Updated by watson1978 (Shizuo Fujita) about 14 hours ago

Arch Linux provides GCC 15.2.1. 
 https://archlinux.org/packages/core/x86_64/gcc/ 

 When I build Ruby 3.4.6 with GCC 15.2.1, it cause error: 

 ### How to Reproduce 
 Here is a Dockerfile to reproduce the error: 

 ``` 
 FROM archlinux:latest 

 RUN pacman -Syu --noconfirm 
 RUN pacman -S --noconfirm curl base-devel libffi zlib openssl readline libyaml 
 RUN curl -O https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.6.tar.gz 
 RUN tar -xvzf ruby-3.4.6.tar.gz 
 RUN cd ruby-3.4.6 && ./configure && make -j && make install 
 ``` 

 Then, run `docker build -t ruby . --platform=linux/amd64` command to reproduce the error. 

 ``` 
 $ docker build -t ruby . --platform=linux/amd64 
 [+] Building 362.6s (9/9) FINISHED                                                                                       docker:desktop-linux 
  => [internal] load build definition from Dockerfile                                                                                     0.0s 
  => => transferring dockerfile: 332B                                                                                                     0.0s 
  => [internal] load metadata for docker.io/library/archlinux:latest                                                                      0.3s 
  => [internal] load .dockerignore                                                                                                        0.0s 
  => => transferring context: 2B                                                                                                          0.0s 
  => [1/6] FROM docker.io/library/archlinux:latest@sha256:8fe9851fcd8bd23ea0e6bfa99483d8778e40b45e0fd7bb8188c94cbdd8c25a38                0.0s 
  => => resolve docker.io/library/archlinux:latest@sha256:8fe9851fcd8bd23ea0e6bfa99483d8778e40b45e0fd7bb8188c94cbdd8c25a38                0.0s 
  => CACHED [2/6] RUN pacman -Syu --noconfirm                                                                                             0.0s 
  => [3/6] RUN pacman -S --noconfirm curl base-devel libffi zlib openssl readline libyaml                                                24.4s 
  => [4/6] RUN curl -O https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.6.tar.gz                                                         1.2s 
  => [5/6] RUN tar -xvzf ruby-3.4.6.tar.gz                                                                                                1.1s 
  => ERROR [6/6] RUN cd ruby-3.4.6 && ./configure && make -j && make install                                                            335.5s 
 ------ 
  > [6/6] RUN cd ruby-3.4.6 && ./configure && make -j && make install: 
 0.765 checking for ruby... false 
 0.888 checking build system type... x86_64-pc-linux-gnu 
 1.452 checking host system type... x86_64-pc-linux-gnu 
 1.452 checking target system type... x86_64-pc-linux-gnu 

 ... 

 288.3 compiling enc/ascii.c 
 300.8 gcc: fatal error: Killed signal terminated program cc1 
 301.1 compilation terminated. 
 301.2 gcc: fatal error: Killed signal terminated program cc1 
 301.2 compilation terminated. 
 301.5 make: *** [Makefile:489: complex.o] Error 1 
 301.5 In file included from ./include/ruby/internal/assume.h:29, 
 301.5                    from ./include/ruby/backward/2/assume.h:24, 
 301.5                    from ./include/ruby/defines.h:72, 
 301.5                    from ./include/ruby/ruby.h:25, 
 301.5                    from ./include/ruby/encoding.h:19, 
 301.5                    from encindex.h:14, 
 301.5                    from compile.c:19: 
 301.5 compile.c: In function ‘ibf_load_catch_table’: 
 301.6 make: *** Waiting for unfinished jobs.... 
 301.6 make: *** [Makefile:489: io.o] Error 1 
 301.7 compile.c:13163:39: warning: taking address of packed member of ‘struct iseq_catch_table’ may result in an unaligned pointer value [-Waddress-of-packed-member] 
 301.7 13163 |               RB_OBJ_WRITE(parent_iseq, &table->entries[i].iseq, catch_iseq); 
 301.7 ./include/ruby/internal/cast.h:31:29: note: in definition of macro ‘RBIMPL_CAST’ 
 301.7      31 | # define RBIMPL_CAST(expr) (expr) 
 301.7         |                               ^~~~ 
 301.7 compile.c:13163:13: note: in expansion of macro ‘RB_OBJ_WRITE’ 
 301.7 13163 |               RB_OBJ_WRITE(parent_iseq, &table->entries[i].iseq, catch_iseq); 
 301.7         |               ^~~~~~~~~~~~ 
 301.8 gcc: fatal error: Killed signal terminated program cc1 
 301.8 compilation terminated. 
 301.9 make: *** [Makefile:489: process.o] Error 1 
 309.6 gcc: fatal error: Killed signal terminated program cc1 
 309.6 compilation terminated. 
 309.6 make: *** [Makefile:489: vm.o] Error 1 
 313.7 gcc: fatal error: Killed signal terminated program cc1 
 313.7 compilation terminated. 
 313.7 make: *** [Makefile:489: string.o] Error 1 
 334.5 At top level: 
 334.5 cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics 
 334.5 cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics 
 334.5 cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics 
 ------ 
 Dockerfile:7 
 -------------------- 
    5 |       RUN curl -O https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.6.tar.gz 
    6 |       RUN tar -xvzf ruby-3.4.6.tar.gz 
    7 | >>> RUN cd ruby-3.4.6 && ./configure && make -j && make install 
    8 | 
 -------------------- 
 ERROR: failed to build: failed to solve: ResourceExhausted: process "/bin/sh -c cd ruby-3.4.6 && ./configure && make -j && make install" did not complete successfully: cannot allocate memory 
 ``` 

 ### Workaround 
 Set `-Wno-address-of-packed-member` to `CFLAGS` environment variable, then I was able to build with successful 

 ``` 
 FROM archlinux:latest 

 RUN pacman -Syu --noconfirm 
 RUN pacman -S --noconfirm curl base-devel libffi zlib openssl readline libyaml 
 RUN curl -O https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.6.tar.gz 
 RUN tar -xvzf ruby-3.4.6.tar.gz 
 RUN cd ruby-3.4.6 && CFLAGS='-Wno-address-of-packed-member' ./configure && make -j && make install 
 ```

Back