Project

General

Profile

Actions

Bug #19434

closed

Fix YJIT compilation for Alpine Linux 3.17.2

Added by bkuhlmann (Brooke Kuhlmann) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Assignee:
Target version:
-
[ruby-core:112368]

Description

Overview

Hello. 👋 With the recent Alpine Linux 3.17.2 patch release -- which includes OpenSSL security patches -- I'm no longer able to build an Alpine Linux Docker image with YJIT enabled for Ruby. Prior to the 3.17.2 patch release, I could build Ruby + YJIT without issue. Here's the error I'm seeing when building locally:

#0 409.6 gcc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924
#0 409.6 Copyright (C) 2022 Free Software Foundation, Inc.
#0 409.6 This is free software; see the source for copying conditions.  There is NO
#0 409.6 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#0 409.6
#0 409.7 compiling ./main.c
#0 409.7 compiling dmydln.c
#0 409.7 compiling miniinit.c
#0 409.7 compiling dmyext.c
#0 410.1 making dummy probes.h
#0 410.2 compiling ast.c
#0 410.7 compiling bignum.c
#0 410.8 compiling class.c
#0 411.8 compiling compar.c
#0 414.1 compiling compile.c
#0 414.9 compiling complex.c
#0 421.0 compiling cont.c
#0 421.7 In file included from cont.c:38:
#0 421.7 yjit.h:24:3: error: #error YJIT unsupported platform
#0 421.7    24 | # error YJIT unsupported platform
#0 421.7       |   ^~~~~

...but what I see in the yjit.h source code is:

// We generate x86 assembly
#if defined(_WIN32) ? defined(_M_AMD64) : defined(__x86_64__)
// x86_64 platforms without mingw/msys or x64-mswin
#else
# error YJIT unsupported platform
#endif

...so AMD 64 should still be supported.

Steps to Recreate

Probably the simplest way to recreate this, locally, is to use my Docker project:

  1. Run: git clone https://github.com/bkuhlmann/docker-alpine-ruby
  2. Run: cd docker-alpine-ruby
  3. Edit the top of the Dockerfile so it says: FROM bkuhlmann/alpine-base:2.0.3 (this ensures Alpine Linux 3.17.2 is being used).
  4. Run docker build --platform linux/amd64 .
  5. Wait for the build to fail.

Environment

macOS

macOS 13.2

Docker

Client:
 Cloud integration: v1.0.29
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:28:41 2022
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.16.2 (95914)
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:25:43 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.14
  GitCommit:        9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Updated by k0kubun (Takashi Kokubun) over 1 year ago

  • Assignee set to yjit

Updated by maximecb (Maxime Chevalier-Boisvert) over 1 year ago

Hello @bkuhlmann (Brooke Kuhlmann). Could you provide the full output of the ./configure script? We do support Linux and macOS on arm64 (though only from Ruby 3.2 onwards). We think the issue may be that you are accidentally cross-compiling, or that the system configuration is somehow not properly reflected inside the docker container.

Updated by bkuhlmann (Brooke Kuhlmann) over 1 year ago

Hey Maxime. So, after you mentioned the cross-compiling issue, I got worried and ended up rebuilding my Docker Alpine Base image and then rebuilding my Docker Alpine Ruby on top of that build. I'm not exactly sure what went wrong in the build process but something must have failed when building the original image (despite no errors issued). I'm definitely cross-compiling when doing this. Here's the full command if you are curious:

docker build --platform linux/arm64,linux/amd64 .

This image is fully built on Alpine Linux 3.17.2 with Ruby 3.2.1 plus YJIT enabled. I have no errors now.

Feel free to close this issue due to user error. Sorry for the trouble but thanks for the prompt to help me resolve this. 🙇🏻‍♂️

Actions #4

Updated by k0kubun (Takashi Kokubun) over 1 year ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0