Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaml.h not found and psych.rb:455:in parse_stream: undefined method parse for #<Psych::Parser #597

Closed
dorianmariecom opened this issue Dec 5, 2022 · 9 comments

Comments

@dorianmariecom
Copy link

Hi,

I'm getting two different errors on different environments (both Linux) when upgrading to Psych 5 but it works fine on macOS.

First error is:


I'm getting this output when upgrading psych from 4 to 5:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
494 |  
495 | current directory: /usr/local/bundle/gems/skylight-5.3.4/ext
496 | /usr/local/bin/ruby -I /usr/local/lib/ruby/3.1.0 -r
497 | ./siteconf20221205-17-o7zxoa.rb extconf.rb
498 | musl libc (x86_64)
499 | Version 1.2.3
500 | Dynamic Program Loader
501 | Usage: /lib/ld-musl-x86_64.so.1 [options] [--] pathname
502 | *** extconf.rb failed ***
503 | Could not create Makefile due to some reason, probably lack of necessary
504 | libraries and/or headers.  Check the mkmf.log file for more details.  You may
505 | need configuration options.
506 |  
507 | Provided configuration options:
508 | --with-opt-dir
509 | --without-opt-dir
510 | --with-opt-include
511 | --without-opt-include=${opt-dir}/include
512 | --with-opt-lib
513 | --without-opt-lib=${opt-dir}/lib
514 | --with-make-prog
515 | --without-make-prog
516 | --srcdir=.
517 | --curdir
518 | --ruby=/usr/local/bin/$(RUBY_BASE_NAME)
519 | /usr/local/lib/ruby/3.1.0/psych.rb:455:in `parse_stream': undefined method
520 | `parse' for #<Psych::Parser:0x00007f870c732950
521 | @handler=#<Psych::Handlers::DocumentStream:0x00007f870c732b58 @stack=[],
522 | @last=nil, @root=nil, @start_line=nil, @start_column=nil, @end_line=nil,
523 | @end_column=nil, @block=#<Proc:0x00007f870c7329c8
524 | /usr/local/lib/ruby/3.1.0/psych.rb:399>>, @external_encoding=0> (NoMethodError)
525 |  
526 | parser.parse yaml, filename
527 | ^^^^^^
528 | from /usr/local/lib/ruby/3.1.0/psych.rb:399:in `parse'
529 | from /usr/local/lib/ruby/3.1.0/psych.rb:324:in `safe_load'
530 | from /usr/local/lib/ruby/3.1.0/psych.rb:370:in `load'
531 | from /usr/local/lib/ruby/3.1.0/psych.rb:671:in `block in load_file'
532 | from /usr/local/lib/ruby/3.1.0/psych.rb:670:in `open'
533 | from /usr/local/lib/ruby/3.1.0/psych.rb:670:in `load_file'
534 | from extconf.rb:121:in `<main>'
535 | I, [2022-12-05T09:14:41.592907 #3150]  INFO -- :
536 | SKYLIGHT_HDR_PATH=/usr/local/bundle/gems/skylight-5.3.4/ext;
537 | SKYLIGHT_LIB_PATH=/usr/local/bundle/gems/skylight-5.3.4/lib/skylight/native/x86_64-linux-musl
538

And second error is:

  Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
  
  current directory:
  /home/runner/work/albaik-web/albaik-web/vendor/bundle/ruby/3.1.0/gems/psych-5.0.0/ext/psych
  /opt/hostedtoolcache/Ruby/3.1.2/x64/bin/ruby -I
  /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/3.1.0 -r
  ./siteconf20221205-2458-sr1mb3.rb extconf.rb
  checking for yaml.h... no
  yaml.h not found
  *** extconf.rb failed ***
  Could not create Makefile due to some reason, probably lack of necessary
  libraries and/or headers.  Check the mkmf.log file for more details.  You may
  need configuration options.
  
  Provided configuration options:
  	--with-opt-dir
  	--without-opt-dir
  	--with-opt-include
  	--without-opt-include=${opt-dir}/include
  	--with-opt-lib
  	--without-opt-lib=${opt-dir}/lib
  	--with-make-prog
  	--without-make-prog
  	--srcdir=.
  	--curdir
  	--ruby=/opt/hostedtoolcache/Ruby/3.1.2/x64/bin/$(RUBY_BASE_NAME)
  	--with-libyaml-source-dir
  	--without-libyaml-source-dir
  	--with-yaml-0.1-dir
  	--without-yaml-0.1-dir
  	--with-yaml-0.1-include
  	--without-yaml-0.1-include=${yaml-0.1-dir}/include
  	--with-yaml-0.1-lib
  	--without-yaml-0.1-lib=${yaml-0.1-dir}/lib
  	--with-yaml-0.1-config
  	--without-yaml-0.1-config
  	--with-pkg-config
  	--without-pkg-config
  	--with-libyaml-dir
  	--without-libyaml-dir
  	--with-libyaml-include
  	--without-libyaml-include=${libyaml-dir}/include
  	--with-libyaml-lib
  	--without-libyaml-lib=${libyaml-dir}/lib

See skylightio/skylight-ruby#437

@sebbASF
Copy link

sebbASF commented Dec 5, 2022

I'm seeing undefined method `_native_parse' for #Psych::Parser:0x......

@hosamaly
Copy link

hosamaly commented Dec 5, 2022

Could this be related to #541? Is libyaml-dev installed? Is it up to date (i.e. v0.2.5)?

@kbarrette
Copy link

I'm also seeing problems with missing libyaml - the Ubuntu image that dependabot uses doesn't seem to include libyaml, which makes psych 5.0.0 install fail, which means dependabot can't check my dependencies for projects that use latest psych.

Not quite sure what needs to be fixed: psych, dependabot, or the image?

@bryansoto
Copy link

Ran into the "yaml.h not found" error with the RubyInstaller for Windows which uses MINGW. For others in the same boat, you will need to run pacman -S libyaml-devel mingw-w64-ucrt-x86_64-libyaml in a MINGW prompt. After that, the upgrade to psych 5 succeeded for me.

@dorianmariecom
Copy link
Author

Could this be related to #541? Is libyaml-dev installed? Is it up to date (i.e. v0.2.5)?

With libyaml-dev installed I get the same error on AWS and on GitHub Actions (related to the Skylight gem)

@kbarrette
Copy link

Anyone like me who got here via a failing github action may be interested in ruby/setup-ruby#409 and actions/runner-images#6725

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Dec 9, 2022

@bryansoto

JFYI, on Windows, I think pacman -S mingw-w64-ucrt-x86_64-libyaml will suffice, as libyaml-devel is an MSYS package.

Quite a few packages on Ubuntu are split into 'runtime' packages (the standard one), and a 'dev' package. With MSYS2 and vcpkg, they are often a single package...

@dometto
Copy link

dometto commented Dec 22, 2022

I'm still seeing the undefined method parse issue on Github Actions with the ubuntu-latest image, even after the addition of libyaml-dev in actions/runner-images#6725, but only on ruby 3.0.0. Is this a bug or am I missing another dependency?

@hsbt hsbt changed the title yaml.h not found and psych.rb:455:in parse_stream': undefined method parse' for #<Psych::Parser yaml.h not found and psych.rb:455:in parse_stream: undefined method parse for #<Psych::Parser Dec 22, 2022
white-gecko added a commit to AKSW/aksw.github.io that referenced this issue Jan 3, 2023
@tindron
Copy link

tindron commented Jan 6, 2023

I'm seeing this with ubuntu-20.04 and ubuntu-latest and ruby 3.1.3. I got around it by removing rdoc to get rid of the psych dependency.

@ruby ruby locked and limited conversation to collaborators Jan 7, 2023
@hsbt hsbt converted this issue into discussion #607 Jan 7, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Development

No branches or pull requests

8 participants