asdf-vm / asdf-ruby

Ruby plugin for asdf version manager
https://github.com/asdf-vm/asdf
MIT License
650 stars 133 forks source link

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

Open KB1RD opened 7 months ago

KB1RD commented 7 months ago

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.

top-sigrid commented 4 months ago

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

Rffrench commented 4 months ago

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

andergtk commented 2 months ago

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