asdf-ruby icon indicating copy to clipboard operation
asdf-ruby copied to clipboard

Build failed: `psych` Could not be configured. It will not be installed.

Open KB1RD opened this issue 1 year ago • 7 comments

Using instructions from https://asdf-vm.com/guide/getting-started.html. Then, I ran asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby. Finally, I ran asdf install ruby latest, which failed as seen below:

==> Downloading ruby-3.3.0.tar.gz...
-> curl -q -fL -o ruby-3.3.0.tar.gz https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21.0M  100 21.0M    0     0  19.9M      0  0:00:01  0:00:01 --:--:-- 19.9M
==> Installing ruby-3.3.0...
-> ./configure "--prefix=$HOME/.asdf/installs/ruby/3.3.0" --enable-shared --with-ext=openssl,psych,+
-> make -j 8
*** Following extensions are not compiled:
psych:
	Could not be configured. It will not be installed.
	Check /tmp/ruby-build.20240205150155.58895.3MNQVx/ruby-3.3.0/ext/psych/mkmf.log for more details.

BUILD FAILED (Ubuntu 20.04 on x86_64 using ruby-build 20240119)

You can inspect the build directory at /tmp/ruby-build.20240205150155.58895.3MNQVx
See the full build log at /tmp/ruby-build.20240205150155.58895.log

Logs from psych configure:

pkg_config: checking for pkg-config for yaml-0.1... -------------------- not found

LD_LIBRARY_PATH=.:../.. pkg-config --exists yaml-0.1
package configuration for yaml-0.1 is not found
--------------------

find_header: checking for yaml.h... -------------------- no

LD_LIBRARY_PATH=.:../.. "gcc -o conftest -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/psych    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef  -fPIC conftest.c  -L. -L../.. -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/home/kb1rd/.asdf/installs/ruby/3.3.0/lib -L/home/kb1rd/.asdf/installs/ruby/3.3.0/lib -lruby-static -lz -lrt -lrt -lgmp -ldl -lcrypt -lm -lpthread   -lm -lpthread  -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

LD_LIBRARY_PATH=.:../.. "gcc -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/psych    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef  -fPIC   -c conftest.c"
conftest.c:3:10: fatal error: yaml.h: No such file or directory
    3 | #include <yaml.h>
      |          ^~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <yaml.h>
/* end */

--------------------

Workaround is to install libyaml-dev on Ubuntu.

The provided error message should either be more descriptive (since I had to dig through log files to find this), or there should be something in the documentation.

KB1RD avatar Feb 06 '24 03:02 KB1RD

For the record, I got the same error on MacOS Sonoma and installing libyaml via brew install libyaml also solved the issue.

top-sigrid avatar Apr 17 '24 15:04 top-sigrid

If anyone is trying to install Ruby on Ubuntu 22.x, just don't install version 3.31.

  • sudo apt install libyaml-dev
  • Install 3.30 from https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.gz

Rffrench avatar May 07 '24 01:05 Rffrench

These are the libs I had to install to make asdf install ruby latest work:

sudo apt-get install libz-dev libssl-dev libffi-dev libyaml-dev

andergtk avatar Jun 29 '24 05:06 andergtk

@Rffrench can report it's still the same on Ubuntu 24.x, with 3.2.2. ;)

@andergtk Thanks. libffi was the issue I ran into just before looking into this and solved that part the same way.

JMCQ87 avatar Nov 16 '24 17:11 JMCQ87

I also ran into this issue. On fedora

sudo dnf install libyaml-devel

azinke avatar Jan 25 '25 13:01 azinke

This is also failing on ruby 3.3.6 for Mac OS Sequoia

lauracallahan-wk avatar Jun 23 '25 16:06 lauracallahan-wk

Actually it's already documented in Install section of the README : https://github.com/asdf-vm/asdf-ruby?tab=readme-ov-file#install

Please make sure you have the required system dependencies installed before trying to install Ruby.

n-rodriguez avatar Jul 17 '25 21:07 n-rodriguez