rails-lambda / lamby-cookiecutter

🐑🛤 AWS SAM Cookiecutter to Quick Start Rails & Lambda
https://lamby.cloud/docs/quick_start
37 stars 18 forks source link

It looks like you're trying to use Nokogiri as a precompiled native gem on a system with glibc < 2.17 #18

Closed jcavalieri closed 1 year ago

jcavalieri commented 2 years ago

Hi Custom Ink devs,

I am going through the lamby quickstart. And I believe I'm encountering an issue because I'm using Apple Silicon. I'll keep looking into it but I thought I would share.

On the ./bin/deploy step I am getting the following error (note I changed set -x to set -eux):

== Asset Hosts & Precompiling ==
+ NODE_ENV=production
+ ./bin/rails assets:precompile

ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system with glibc < 2.17:

  /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so

  If that's the case, then please install Nokogiri via the `ruby` platform gem:
      gem install nokogiri --platform=ruby
  or:
      bundle config set force_ruby_platform true

  Please visit https://nokogiri.org/tutorials/installing_nokogiri.html for more help.

ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system with glibc < 2.17:

  /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so

  If that's the case, then please install Nokogiri via the `ruby` platform gem:
      gem install nokogiri --platform=ruby
  or:
      bundle config set force_ruby_platform true

  Please visit https://nokogiri.org/tutorials/installing_nokogiri.html for more help.

rails aborted!
LoadError: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/
jcavalieri commented 2 years ago

I got this working with Apple Silicon with two changes.

I removed this line:

bundle lock --add-platform x86_64-linux https://github.com/customink/lamby-cookiecutter/blob/master/lambify/bin/_build#L12

And added this to the template.yaml under the RailsLambda Properties:

      Architectures:
        - arm64
jordan-brough commented 2 years ago

I was able to get this to work on an M1 by adding --platform=linux/amd64 to the New Rails Application command (docker run ... gh:customink/lamby-cookiecutter), and running export DOCKER_DEFAULT_PLATFORM=linux/amd64 in my terminal.

CodySwannGT commented 2 years ago

@jordan-brough did this actually work? I followed your instructions and got:

"errorMessage": "Could not find nio4r-2.5.8, websocket-driver-0.7.5, nokogiri-1.13.8, digest-3.1.0, strscan-3.0.4, mini_portile2-2.8.0, racc-1.6.0 in locally installed gems", After deploy finished

metaskills commented 1 year ago

New cookiecutter and docs site just landed. Removes a lot of this complexity.