rails / rails-dev-box

A virtual machine for Ruby on Rails core development
MIT License
2.05k stars 580 forks source link

Error building native extensions when running bundle install #210

Closed arielj closed 10 months ago

arielj commented 1 year ago

I just cloned the project, setup Virtualbox 7 and Vagrant following the instructions.

I cloned my rails fork and sshd into the virtual machine.

When I run bundle install, it fails to install the gems with this error related to psych's native extensions:

vagrant@rails-dev-box:/vagrant/rails$ bundle install
Following files may not be writable, so sudo is needed:
  /usr/local/bin
  /var/lib/gems/3.0.0
  /var/lib/gems/3.0.0/bin
  /var/lib/gems/3.0.0/build_info
  /var/lib/gems/3.0.0/cache
  /var/lib/gems/3.0.0/doc
  /var/lib/gems/3.0.0/extensions
  /var/lib/gems/3.0.0/gems
  /var/lib/gems/3.0.0/plugins
  /var/lib/gems/3.0.0/specifications
Fetching gem metadata from https://rubygems.org/.........
Using rake 13.0.6
Using base64 0.1.1
Using concurrent-ruby 1.1.10
Using connection_pool 2.3.0
Using ruby2_keywords 0.0.5
Using minitest 5.19.0
Using mutex_m 0.1.2
Using bigdecimal 3.1.4
Using builder 3.2.4
Using racc 1.6.2
Using crass 1.0.6
Using rack 3.0.8
Using nio4r 2.5.9
Using websocket-extensions 0.1.5
Using zeitwerk 2.6.6
Using timeout 0.4.0
Using marcel 1.0.2
Using mini_mime 1.1.2
Using date 3.3.3
Using public_suffix 5.0.1
Using amq-protocol 2.3.2
Using ast 2.4.2
Using aws-eventstream 1.2.0
Using aws-partitions 1.691.0
Using jmespath 1.6.2
Using faraday-em_http 1.0.0
Using faraday-em_synchrony 1.0.0
Using faraday-excon 1.1.0
Using faraday-httpclient 1.0.1
Using multipart-post 2.2.3
Using faraday-net_http 1.0.1
Using faraday-net_http_persistent 1.2.0
Using faraday-patron 1.0.0
Using faraday-rack 1.0.0
Using faraday-retry 1.0.3
Using beaneater 1.1.3
Using dante 0.2.0
Using bcrypt 3.1.18
Using benchmark-ips 2.10.0
Using bindex 0.8.1
Using msgpack 1.7.0
Using bundler 2.3.22
Using rbtree 0.4.6
Using set 1.0.3
Using matrix 0.4.2
Using regexp_parser 2.6.2
Using cgi 0.3.6
Using rexml 3.2.5
Using io-console 0.6.0
Using webrick 1.8.1
Using thor 1.2.2
Using dalli 3.2.3
Using declarative 0.0.20
Using digest-crc 0.6.4
Using event_emitter 0.2.6
Using execjs 2.8.1
Using ffi 1.15.5
Using raabro 1.4.0
Using jwt 2.6.0
Using memoist 0.16.2
Using multi_json 1.15.0
Using os 1.1.4
Using httpclient 2.8.3
Using trailblazer-option 0.1.2
Using uber 0.1.0
Using retriable 3.1.2
Using google-cloud-errors 1.3.0
Using hashdiff 1.0.1
Using mini_magick 4.12.0
Using json 2.6.3
Using libxml-ruby 4.0.0
Using rb-fsevent 0.11.2
Using mixlib-cli 2.1.8
Using tomlrb 2.0.3
Using path_expander 1.1.1
Using mono_logger 1.1.1
Using mysql2 0.5.4
Using parallel 1.22.1
Using pg 1.5.3
Using stringio 3.0.7
Using rainbow 3.1.1
Using redcarpet 3.2.3
Using erubi 1.12.0
Using ruby-progressbar 1.13.0
Using unicode-display_width 2.4.2
Using rubyzip 2.3.2
Using websocket 1.2.9
Using sigdump 0.2.4
Using sqlite3 1.6.3 (x86_64-linux)
Using stackprof 0.2.23
Using trilogy 2.5.0
Using drb 2.1.1
Using i18n 1.12.0
Using tzinfo 2.0.5
Using net-http-persistent 4.0.1
Using chef-utils 18.1.29
Using minitest-server 1.0.7
Using minitest-ci 3.4.0
Using minitest-retry 0.2.2
Using redis-client 0.12.0
Using sucker_punch 3.1.0
Using nokogiri 1.15.2 (x86_64-linux)
Using rack-session 2.0.0
Using rack-test 2.1.0
Using websocket-driver 0.7.5
Using net-protocol 0.2.1
Using addressable 2.8.1
Using aws-sigv4 1.5.2
Using faraday-multipart 1.0.4
Using backburner 1.6.0
Using bootsnap 1.15.0
Using sorted_set 1.0.3
Using crack 0.4.5
Using reline 0.3.2
Using rackup 2.1.0
Using representable 3.2.0
Using ruby-vips 2.1.4
Using kramdown 2.4.0
Using rb-inotify 0.10.1
Using parser 3.2.1.1
Using puma 6.3.0
Using rack-cache 1.14.0
Using sinatra 1.0
Using sprockets 4.2.0
Using terser 1.1.13
Using mixlib-config 3.0.27
Using rouge 4.1.0
Using queue_classic 4.0.0
Using activesupport 7.1.0.alpha from source at `.`
Using loofah 2.21.3
Using net-imap 0.3.6
Using net-pop 0.1.2
Using net-smtp 0.3.3
Using aws-sdk-core 3.168.4
Using faraday 1.10.2
Using bunny 2.20.2
Using xpath 3.2.0
Using irb 1.6.2
Using et-orbi 1.2.7
Using image_processing 1.12.2
Using kramdown-parser-gfm 1.1.0
Using listen 3.8.0
Using mixlib-shellout 3.2.7
Using minitest-bisect 1.6.0
Using redis 5.0.5
Using rubocop-ast 1.28.0
Using selenium-webdriver 4.11.0
Using serverengine 2.0.7
Using sidekiq 7.0.3
Using w3c_validators 1.3.7
Using webmock 3.18.1
Using websocket-client-simple 0.3.0 from https://github.com/matthewd/websocket-client-simple.git (at close-race@e161305)
Using rails-dom-testing 2.2.0
Using rails-html-sanitizer 1.6.0
Using globalid 1.1.0
Using activemodel 7.1.0.alpha from source at `.`
Installing psych 5.1.0 with native extensions
Using mail 2.8.0.1
Using aws-sdk-kms 1.61.0
Using aws-sdk-sns 1.57.0
Using faraday_middleware 1.2.0
Using capybara 3.39.2
Using debug 1.7.1
Using delayed_job 4.1.11
Using fugit 1.8.0
Using signet 0.17.0
Using google-cloud-env 1.6.0
Using mdl 0.12.0
Using redis-namespace 1.10.0
Using rubocop 1.48.1
Using sneakers 2.11.0
Using actionview 7.1.0.alpha from source at `.`
Using activejob 7.1.0.alpha from source at `.`
Using activerecord 7.1.0.alpha from source at `.`
Using aws-sdk-s3 1.117.2
Using azure-storage-common 2.0.4
Using rufus-scheduler 3.8.2
Using googleauth 1.3.0
Using google-cloud-core 1.6.0
Using actionpack 7.1.0.alpha from source at `.`
Using azure-storage-blob 2.0.3
Using delayed_job_active_record 4.1.7
Using google-apis-core 0.9.4
Using jbuilder 2.11.5
Using resque 2.4.0
Using rubocop-md 1.2.0
Using rubocop-minitest 0.29.0
Using rubocop-packaging 0.5.2
Using rubocop-performance 1.16.0
Using rubocop-rails 2.18.0
Using actioncable 7.1.0.alpha from source at `.`
Using activestorage 7.1.0.alpha from source at `.`
Using actionmailer 7.1.0.alpha from source at `.`
Using railties 7.1.0.alpha from source at `.` and installing its executables
Using google-apis-iamcredentials_v1 0.16.0
Using google-apis-storage_v1 0.19.0
Using resque-scheduler 4.7.0
Using sprockets-rails 3.4.2
Using actionmailbox 7.1.0.alpha from source at `.`
Using actiontext 7.1.0.alpha from source at `.`
Using cssbundling-rails 1.1.2
Using dartsass-rails 0.4.1
Using importmap-rails 1.1.5
Using jsbundling-rails 1.1.1
Using propshaft 0.6.4
Using stimulus-rails 1.2.1
Using tailwindcss-rails 2.0.21 (x86_64-linux)
Using turbo-rails 1.3.2
Using web-console 4.2.0
Using google-cloud-storage 1.44.0
Using rails 7.1.0.alpha from source at `.`
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /tmp/bundler20230905-29261-na9i1epsych-5.1.0/gems/psych-5.1.0/ext/psych
/usr/bin/ruby3.0 -I /usr/lib/ruby/vendor_ruby -r ./siteconf20230905-29261-ohet3k.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=/usr/bin/$(RUBY_BASE_NAME)3.0
    --with-libyaml-source-dir
    --without-libyaml-source-dir
    --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

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /tmp/bundler20230905-29261-na9i1epsych-5.1.0/extensions/x86_64-linux/3.0.0/psych-5.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20230905-29261-na9i1epsych-5.1.0/gems/psych-5.1.0 for inspection.
Results logged to /tmp/bundler20230905-29261-na9i1epsych-5.1.0/extensions/x86_64-linux/3.0.0/psych-5.1.0/gem_make.out

  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:95:in `run'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/ext_conf_builder.rb:47:in `block in build'
  /usr/lib/ruby/3.0.0/tempfile.rb:317:in `open'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:164:in `build_extension'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:198:in `block in build_extensions'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:195:in `each'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:195:in `build_extensions'
  /usr/lib/ruby/vendor_ruby/rubygems/installer.rb:851:in `build_extensions'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/source/rubygems.rb:207:in `install'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/installer/gem_installer.rb:54:in `install'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/installer/parallel_installer.rb:186:in `do_install'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/worker.rb:62:in `apply_func'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/worker.rb:57:in `block in process_queue'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/worker.rb:54:in `loop'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/worker.rb:54:in `process_queue'
  /var/lib/gems/3.0.0/gems/bundler-2.3.22/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing psych (5.1.0), and Bundler cannot continue.

In Gemfile:
  sdoc was resolved to 3.0.0.alpha, which depends on
    rdoc was resolved to 6.5.0, which depends on
      psych

I understand it should work out of the box, right? or am I missing some dependency?

EDIT: when I try to check this file /tmp/bundler20230905-29261-na9i1epsych-5.1.0/extensions/x86_64-linux/3.0.0/psych-5.1.0/mkmf.log, it doesn't exist

arielj commented 1 year ago

I had to run apt-get install libyaml and now it's working.

EDIT: I see there's a PR adding libyaml https://github.com/rails/rails-dev-box/pull/209 (I didn't need the other dependency so far)

yahonda commented 10 months ago

211 has been merged to the master branch that should address this issue.

yahonda commented 10 months ago

I'm closing this issue because https://github.com/rails/rails-dev-box/pull/211 should have taken care of it. Please let us know if this issue still exists.