0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ERROR: `GLIBC_2.29' not found |Ruby AWS SAM で Nokogiri 使用時の回避方法

Posted at

AWS SAMでLambdaを動かそうとした時、以下のエラーが出たため修正した。
M1だと発生するのかもしれない。

$ sam local invoke HelloWorldFunction --event events/event.json
Invoking app.lambda_handler (ruby2.7)
Local image was not found.
Removing rapid images for repo public.ecr.aws/sam/emulation-ruby2.7
Building image...................................................................................................................................................................................................................................
Using local image: public.ecr.aws/lambda/ruby:2.7-rapid-arm64.

Mounting /Users/xxx/Develop/environment/xxx/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container
START RequestId: 97ccf28f-352a-4c64-883f-7687591f6825 Version: $LATEST

ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system
       with an unsupported version of glibc.

  /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-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.

Init error when loading handler app.lambda_handler
{
  "errorMessage": "/lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/2.7/nokogiri.so",
  "errorType": "Init<LoadError>",
  "stackTrace": [
    "/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/extension.rb:7:in `require_relative'",
    "/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/extension.rb:7:in `<top (required)>'",
    "/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri.rb:8:in `require_relative'",
    "/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri.rb:8:in `<top (required)>'",
    "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:162:in `require'",
    "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:162:in `rescue in require'",
    "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:152:in `require'",
    "/var/task/app.rb:3:in `<top (required)>'",
    "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:88:in `require'",
    "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:88:in `require'"
  ]
}
16 Feb 2023 12:03:38,157 [ERROR] (rapid) Init failed error=Runtime exited with error: exit status 252 InvokeID=

ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system
       with an unsupported version of glibc.

  /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-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.

Init error when loading handler app.lambda_handler
{
  "errorMessage": "/lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/2.7/nokogiri.so",
  "errorType": "Init<LoadError>",
  "stackTrace": [
    "/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/extension.rb:7:in `require_relative'",
    "/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/extension.rb:7:in `<top (required)>'",
    "/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri.rb:8:in `require_relative'",
    "/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri.rb:8:in `<top (required)>'",
    "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:162:in `require'",
    "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:162:in `rescue in require'",
    "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:152:in `require'",
    "/var/task/app.rb:3:in `<top (required)>'",
    "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:88:in `require'",
    "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:88:in `require'"
  ]
}
{"errorMessage":"/lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/2.7/nokogiri.so","errorType":"Init<LoadError>","stackTrace":["/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/extension.rb:7:in `require_relative'","/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri/extension.rb:7:in `<top (required)>'","/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri.rb:8:in `require_relative'","/var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.14.2-aarch64-linux/lib/nokogiri.rb:8:in `<top (required)>'","/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:162:in `require'","/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:162:in `rescue in require'","/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:152:in `require'","/var/task/app.rb:3:in `<top (required)>'","/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:88:in `require'","/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:88:in `require'"]}END RequestId: 043a3453-ce0f-430c-a865-f9432b943106
REPORT RequestId: 043a3453-ce0f-430c-a865-f9432b943106	Init Duration: 0.06 ms	Duration: 516.77 ms	Billed Duration: 517 ms	Memory Size: 128 MB	Max Memory Used: 128 MB

回避方法

$ cd hello_world
$ bundle config set force_ruby_platform true

実際に見るGemfileはrootではなくhello_world配下なので注意。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?