ruby / psych

A libyaml wrapper for Ruby
MIT License
566 stars 205 forks source link

No such file or directory - /usr/local/bundle/gems/psych-5.1.2-java/deps.lst #690

Open kriechi1992 opened 1 month ago

kriechi1992 commented 1 month ago

I have a Dockerfile where I want to setup my environment. Therefore I have to install some gems. When installing psych it crashes with the error: No such file or directory - /usr/local/bundle/gems/psych-5.1.2-java/deps.lst

My setup: Apple M3 Pro macOS 14.6.1 Docker 4.34.2 (167172)

I also tried another base image (eclipse-temurin), but there's the same problem.

I don't know what I can do to make this work.

I simplified that Dockerfile so that it boils down to the problem:

FROM amazoncorretto:21-alpine
ENV BUNDLE_WITH=development

ENV JRUBY_VERSION=9.4.8.0

RUN apk add --update curl \
    libpng-dev \
    libjpeg-turbo-dev \
    tiff-dev \
    libwebp-dev \
    libdjvulibre \
    libheif-dev \
    fontconfig-dev \
    freetype-dev \
    lcms2-dev \
    openexr-libopenexr \
    libxml2-dev \
    bash \
    dpkg \
    git \
    build-base \
    gcompat \
    jemalloc \
    vips \
    vips-tools \
    alpine-baselayout && \
    apk cache clean

ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2

ENV GEM_HOME=/usr/local/bundle
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"

ENV PATH=$GEM_HOME/bin:$PATH
ENV JRUBY_SHA256=347b6692bd9c91c480a45af25ce88d77be8b6e4ac4a77bc94870f2c5b54bc929

RUN mkdir /opt/jruby && \
    curl https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz -o /tmp/jruby.tar.gz && \
    echo "$JRUBY_SHA256 /tmp/jruby.tar.gz" | sha256sum -c - && \
    tar -zx --strip-components=1 -f /tmp/jruby.tar.gz -C /opt/jruby && \
    update-alternatives --install /usr/local/bin/ruby ruby /opt/jruby/bin/jruby 1 && \
    rm /tmp/jruby.tar.gz

ENV PATH=/opt/jruby/bin:$PATH

WORKDIR /work

RUN gem update --system 3.5.21
RUN gem install bundler -v 2.3.5 --no-document
RUN gem install psych -v 5.1.2 --no-document

Run command:

docker build --progress=plain --build-arg BUNDLE_WITH=development -t my-img -f Dockerfile .

And this is the error message:

#11 [8/8] RUN gem install psych -v 5.1.2 --no-document
#11 2.732   jar dependencies for psych-5.1.2-java.gemspec . . .
#11 2.732 Installing gem 'ruby-maven' . . .
#11 3.541 Successfully installed ruby-maven-libs-3.3.9
#11 3.600 Successfully installed ruby-maven-3.3.13
#11 3.602 
#11 3.602 using maven for the first time results in maven
#11 3.602 downloading all its default plugin and can take time.
#11 3.602 as those plugins get cached on disk and further execution
#11 3.602 of maven is much faster then the first time.
#11 3.602 
#11 9.221 #
#11 9.221 # A fatal error has been detected by the Java Runtime Environment:
#11 9.221 #
#11 9.221 #  SIGSEGV (0xb) at pc=0x0000000000005e30, pid=61, tid=67
#11 9.221 #
#11 9.221 # JRE version: OpenJDK Runtime Environment Corretto-21.0.4.7.1 (21.0.4+7) (build 21.0.4+7-LTS)
#11 9.221 # Java VM: OpenJDK 64-Bit Server VM Corretto-21.0.4.7.1 (21.0.4+7-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
#11 9.221 # Problematic frame:
#11 9.221 # C  [jffi4590902286812642138.so+0x7f7c]  jffi_throwExceptionByName+0xfc
#11 9.221 #
#11 9.221 # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#11 9.221 #
#11 9.221 # An error report file with more information is saved as:
#11 9.221 # /work/hs_err_pid61.log
#11 9.228 #
#11 9.228 # If you would like to submit a bug report, please visit:
#11 9.228 #   https://github.com/corretto/corretto-21/issues/
#11 9.228 # The crash happened outside the Java Virtual Machine in native code.
#11 9.228 # See problematic frame for where to report the bug.
#11 9.228 #
#11 9.237 ERROR:  While executing gem ... (Errno::ENOENT)
#11 9.237     No such file or directory - /usr/local/bundle/gems/psych-5.1.2-java/deps.lst
#11 9.239       org/jruby/RubyIO.java:1278:in `sysopen'
#11 9.239       org/jruby/RubyIO.java:4264:in `read'
#11 9.239       /opt/jruby/lib/ruby/stdlib/jars/installer.rb:69:in `load_from_maven'
#11 9.239       /opt/jruby/lib/ruby/stdlib/jars/installer.rb:235:in `install_dependencies'
#11 9.239       /opt/jruby/lib/ruby/stdlib/jars/installer.rb:224:in `do_install'
#11 9.239       /opt/jruby/lib/ruby/stdlib/jars/installer.rb:170:in `vendor_jars'
#11 9.239       /opt/jruby/lib/ruby/stdlib/jars/post_install_hook.rb:28:in `block in <main>'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/installer.rb:367:in `block in run_post_install_hooks'
#11 9.239       org/jruby/RubyArray.java:1981:in `each'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/installer.rb:366:in `run_post_install_hooks'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/installer.rb:335:in `install'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/resolver/specification.rb:105:in `install'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/request_set.rb:195:in `block in install'
#11 9.239       org/jruby/RubyArray.java:1981:in `each'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/request_set.rb:183:in `install'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:207:in `install_gem'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:223:in `block in install_gems'
#11 9.239       org/jruby/RubyArray.java:1981:in `each'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:216:in `install_gems'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:162:in `execute'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/command.rb:326:in `invoke_with_build_args'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/command_manager.rb:248:in `invoke_command'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/command_manager.rb:194:in `process_args'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/command_manager.rb:152:in `run'
#11 9.239       /opt/jruby/lib/ruby/stdlib/rubygems/gem_runner.rb:56:in `run'
#11 9.239       /opt/jruby/bin/gem:12:in `<main>'
#11 ERROR: process "/bin/sh -c gem install psych -v 5.1.2 --no-document" did not complete successfully: exit code: 1
------
 > [8/8] RUN gem install psych -v 5.1.2 --no-document:
9.239   /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:223:in `block in install_gems'
9.239   org/jruby/RubyArray.java:1981:in `each'
9.239   /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:216:in `install_gems'
9.239   /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:162:in `execute'
9.239   /opt/jruby/lib/ruby/stdlib/rubygems/command.rb:326:in `invoke_with_build_args'
9.239   /opt/jruby/lib/ruby/stdlib/rubygems/command_manager.rb:248:in `invoke_command'
9.239   /opt/jruby/lib/ruby/stdlib/rubygems/command_manager.rb:194:in `process_args'
9.239   /opt/jruby/lib/ruby/stdlib/rubygems/command_manager.rb:152:in `run'
9.239   /opt/jruby/lib/ruby/stdlib/rubygems/gem_runner.rb:56:in `run'
9.239   /opt/jruby/bin/gem:12:in `<main>'
------
Dockerfile:50
--------------------
  48 |     RUN gem update --system 3.5.21
  49 |     RUN gem install bundler -v 2.3.5 --no-document
  50 | >>> RUN gem install psych -v 5.1.2 --no-document
  51 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c gem install psych -v 5.1.2 --no-document" did not complete successfully: exit code: 1
Failed to deploy '<unknown> Dockerfile: Dockerfile.base': Image build failed with exit code 1.
hsbt commented 1 month ago

@headius @enebo Can you look this?

olleolleolle commented 1 month ago

Linking: I believe this Issue in the JRuby repository refers to the same problem: https://github.com/jruby/jruby/issues/7059

kriechi1992 commented 3 weeks ago

Any updates on this? This is a real blocker for me.

The really strange thing is: On Intel machines it works ... just not in ARM.

@headius ... I also tried installing ruby-maven and ruby-maven-libs manually before installing psych ... but that also did not work.