[ruby-core:116696] [Ruby master Bug#20264] Segfault installing RMagick on M1 Mac

Issue #20264 has been reported by andy@andyjeffries.co.uk (Andy Jeffries). ---------------------------------------- Bug #20264: Segfault installing RMagick on M1 Mac https://bugs.ruby-lang.org/issues/20264 * Author: andy@andyjeffries.co.uk (Andy Jeffries) * Status: Open * Priority: Normal * ruby -v: 3.3 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- I raised a bug at RMagick, they said to go to pkg-config. I raised a bug there, and they said to raise it here. Hopefully this is the right place... https://github.com/ruby-gnome/pkg-config/issues/24 Simplest reproduction steps (although a full backtrace of a Rails app trying to do it is at the link above): ``` $ docker run -it --platform=linux/arm64 registry.docker.com/library/ruby:3.3-slim bash root@163711a82570:/# apt-get update root@163711a82570:/# apt-get install --no-install-recommends -y build-essential pkg-config libmagickwand-dev root@163711a82570:/# gem install rmagick ``` -- https://bugs.ruby-lang.org/

Issue #20264 has been updated by byroot (Jean Boussier). The interesting parts from the upstream ticket: ``` Segmentation fault at 0x0067ffffb37006c0 ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [aarch64-linux] -- Control frame information ----------------------------------------------- c:0012 p:---- s:0068 E:002060 CFUNC :next c:0011 p:0005 s:0064 e:000063 BLOCK /usr/local/bundle/ruby/3.3.0/gems/pkg-config-1.5.6/lib/pkg-config.rb:439 c:0010 p:0018 s:0060 e:000059 METHOD <internal:kernel>:187 c:0009 p:0014 s:0055 e:000054 METHOD /usr/local/bundle/ruby/3.3.0/gems/pkg-config-1.5.6/lib/pkg-config.rb:438 c:0008 p:0035 s:0048 e:000047 METHOD /usr/local/bundle/ruby/3.3.0/gems/pkg-config-1.5.6/lib/pkg-config.rb:403 c:0007 p:0003 s:0039 e:000038 METHOD /usr/local/bundle/ruby/3.3.0/gems/pkg-config-1.5.6/lib/pkg-config.rb:297 c:0006 p:0007 s:0033 e:000032 METHOD /usr/local/bundle/ruby/3.3.0/gems/pkg-config-1.5.6/lib/pkg-config.rb:603 c:0005 p:0108 s:0028 e:000025 METHOD extconf.rb:111 c:0004 p:0018 s:0016 e:000015 METHOD extconf.rb:53 [FINISH] c:0003 p:---- s:0012 e:000011 CFUNC :new c:0002 p:0067 s:0008 E:000f60 EVAL extconf.rb:449 [FINISH] c:0001 p:0000 s:0003 E:000520 DUMMY [FINISH] ``` Unfortunately, no C-level backtrace included. So it's crashing in `Enumerator#next` on this line https://github.com/ruby-gnome/pkg-config/blob/eff47c9f57f8411b5e3c535cae0d8e... ```ruby def normalize_cflags(cflags) normalized_cflags = [] enumerator = cflags.to_enum begin loop do cflag = enumerator.next # CRASH! normalized_cflags << cflag case cflag when "-I" normalized_cflags << enumerator.next end end rescue StopIteration end normalized_cflags end ``` I haven't tried to repro yet. ---------------------------------------- Bug #20264: Segfault installing RMagick on M1 Mac https://bugs.ruby-lang.org/issues/20264#change-106711 * Author: andy@andyjeffries.co.uk (Andy Jeffries) * Status: Open * Priority: Normal * ruby -v: 3.3 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- I raised a bug at RMagick, they said to go to pkg-config. I raised a bug there, and they said to raise it here. Hopefully this is the right place... https://github.com/ruby-gnome/pkg-config/issues/24 Simplest reproduction steps (although a full backtrace of a Rails app trying to do it is at the link above): ``` $ docker run -it --platform=linux/arm64 registry.docker.com/library/ruby:3.3-slim bash root@163711a82570:/# apt-get update root@163711a82570:/# apt-get install --no-install-recommends -y build-essential pkg-config libmagickwand-dev root@163711a82570:/# gem install rmagick ``` -- https://bugs.ruby-lang.org/

Issue #20264 has been updated by byroot (Jean Boussier). Coincidentally, I'm pretty sure that code is useless: https://github.com/ruby-gnome/pkg-config/pull/25. ---------------------------------------- Bug #20264: Segfault in Enumerator#next while installing RMagick on M1 Mac https://bugs.ruby-lang.org/issues/20264#change-106713 * Author: andy@andyjeffries.co.uk (Andy Jeffries) * Status: Open * Priority: Normal * ruby -v: 3.3 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- I raised a bug at RMagick, they said to go to pkg-config. I raised a bug there, and they said to raise it here. Hopefully this is the right place... https://github.com/ruby-gnome/pkg-config/issues/24 Simplest reproduction steps (although a full backtrace of a Rails app trying to do it is at the link above): ``` $ docker run -it --platform=linux/arm64 registry.docker.com/library/ruby:3.3-slim bash root@163711a82570:/# apt-get update root@163711a82570:/# apt-get install --no-install-recommends -y build-essential pkg-config libmagickwand-dev root@163711a82570:/# gem install rmagick ``` -- https://bugs.ruby-lang.org/

Issue #20264 has been updated by sorah (Sorah Fukumori). seems like https://github.com/ruby/ruby/pull/9385 https://bugs.ruby-lang.org/issues/20085 ---------------------------------------- Bug #20264: Segfault in Enumerator#next while installing RMagick on M1 Mac https://bugs.ruby-lang.org/issues/20264#change-106717 * Author: andy@andyjeffries.co.uk (Andy Jeffries) * Status: Open * Priority: Normal * ruby -v: 3.3 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- I raised a bug at RMagick, they said to go to pkg-config. I raised a bug there, and they said to raise it here. Hopefully this is the right place... https://github.com/ruby-gnome/pkg-config/issues/24 Simplest reproduction steps (although a full backtrace of a Rails app trying to do it is at the link above): ``` $ docker run -it --platform=linux/arm64 registry.docker.com/library/ruby:3.3-slim bash root@163711a82570:/# apt-get update root@163711a82570:/# apt-get install --no-install-recommends -y build-essential pkg-config libmagickwand-dev root@163711a82570:/# gem install rmagick ``` -- https://bugs.ruby-lang.org/

Issue #20264 has been updated by hsbt (Hiroshi SHIBATA). I could install `rmagick` with `linux/amd64`. ``` $ docker run -it --platform=linux/amd64 registry.docker.com/library/ruby:3.3-slim bash ``` This may be fixed with #20085 with @sorah 's suggestion. ---------------------------------------- Bug #20264: Segfault in Enumerator#next while installing RMagick on M1 Mac https://bugs.ruby-lang.org/issues/20264#change-106745 * Author: andy@andyjeffries.co.uk (Andy Jeffries) * Status: Open * Priority: Normal * ruby -v: 3.3 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- I raised a bug at RMagick, they said to go to pkg-config. I raised a bug there, and they said to raise it here. Hopefully this is the right place... https://github.com/ruby-gnome/pkg-config/issues/24 Simplest reproduction steps (although a full backtrace of a Rails app trying to do it is at the link above): ``` $ docker run -it --platform=linux/arm64 registry.docker.com/library/ruby:3.3-slim bash root@163711a82570:/# apt-get update root@163711a82570:/# apt-get install --no-install-recommends -y build-essential pkg-config libmagickwand-dev root@163711a82570:/# gem install rmagick ``` -- https://bugs.ruby-lang.org/

Issue #20264 has been updated by andy@andyjeffries.co.uk (Andy Jeffries). hsbt (Hiroshi SHIBATA) wrote in #note-6:
I could install `rmagick` with `linux/amd64`.
``` $ docker run -it --platform=linux/amd64 registry.docker.com/library/ruby:3.3-slim bash ```
This may be fixed with #20085 with @sorah 's suggestion.
This is definitely an arm64 issue, our production containers use amd64 and I agree it works fine on that platform. ---------------------------------------- Bug #20264: Segfault in Enumerator#next while installing RMagick on M1 Mac https://bugs.ruby-lang.org/issues/20264#change-106755 * Author: andy@andyjeffries.co.uk (Andy Jeffries) * Status: Open * Priority: Normal * ruby -v: 3.3 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- I raised a bug at RMagick, they said to go to pkg-config. I raised a bug there, and they said to raise it here. Hopefully this is the right place... https://github.com/ruby-gnome/pkg-config/issues/24 Simplest reproduction steps (although a full backtrace of a Rails app trying to do it is at the link above): ``` $ docker run -it --platform=linux/arm64 registry.docker.com/library/ruby:3.3-slim bash root@163711a82570:/# apt-get update root@163711a82570:/# apt-get install --no-install-recommends -y build-essential pkg-config libmagickwand-dev root@163711a82570:/# gem install rmagick ``` -- https://bugs.ruby-lang.org/

Issue #20264 has been updated by sorah (Sorah Fukumori). Status changed from Open to Feedback there's no workaround right now (AFAIK affected platform is Linux VM on Apple Silicon), need to wait 3.3.1 to be shipped (any estimates?) ---------------------------------------- Bug #20264: Segfault in Enumerator#next while installing RMagick on M1 Mac https://bugs.ruby-lang.org/issues/20264#change-106775 * Author: andy@andyjeffries.co.uk (Andy Jeffries) * Status: Feedback * Priority: Normal * ruby -v: 3.3 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- I raised a bug at RMagick, they said to go to pkg-config. I raised a bug there, and they said to raise it here. Hopefully this is the right place... https://github.com/ruby-gnome/pkg-config/issues/24 Simplest reproduction steps (although a full backtrace of a Rails app trying to do it is at the link above): ``` $ docker run -it --platform=linux/arm64 registry.docker.com/library/ruby:3.3-slim bash root@163711a82570:/# apt-get update root@163711a82570:/# apt-get install --no-install-recommends -y build-essential pkg-config libmagickwand-dev root@163711a82570:/# gem install rmagick ``` -- https://bugs.ruby-lang.org/
participants (4)
-
andy@andyjeffries.co.uk (Andy Jeffries)
-
byroot (Jean Boussier)
-
hsbt (Hiroshi SHIBATA)
-
sorah (Sorah Fukumori)