Skip to content
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

Install FreeBSD Ruby 3.2.2 #463

Open
kaiquekandykoga opened this issue Sep 2, 2023 · 3 comments
Open

Install FreeBSD Ruby 3.2.2 #463

kaiquekandykoga opened this issue Sep 2, 2023 · 3 comments

Comments

@kaiquekandykoga
Copy link

Description

I think it is related to rbenv/ruby-build#2184.

Steps To Reproduce

$ ruby-install 3.2.2

Expected Behavior

Install 3.2.2.

Actual Behavior


*** Following extensions are not compiled:
fiddle:
        Could not be configured. It will not be installed.
        /usr/home/kandy/src/ruby-3.2.2/ext/fiddle/extconf.rb:73: missing libffi. Please install libffi or use --with-libffi-source-dir with libffi source location.
        Check ext/fiddle/mkmf.log for more details.
psych:
        Could not be configured. It will not be installed.
        Check ext/psych/mkmf.log for more details.
readline:
        Could not be configured. It will not be installed.
        /usr/home/kandy/src/ruby-3.2.2/ext/readline/extconf.rb:62: Neither readline nor libedit was found
        Check ext/readline/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.

...

Ignoring debug-1.6.3 because its extensions are not built. Try: gem pristine debug --version 1.6.3
Ignoring rbs-2.7.0 because its extensions are not built. Try: gem pristine rbs --version 2.7.0
/usr/home/kandy/src/ruby-3.2.2/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
uh-oh! RDoc had a problem:
cannot load such file -- psych

run with --debug for full backtrace
*** Error code 1

Stop.
make: stopped in /usr/home/kandy/src/ruby-3.2.2
!!! Compiling ruby 3.2.2 failed!

Environment

[kandy@freebsd ~]$ ruby-install --version
ruby-install: 0.9.0

[kandy@freebsd ~]$ uname -a
FreeBSD freebsd 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64

[kandy@freebsd ~]$ cc --version
FreeBSD clang version 13.0.0 ([email protected]:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)
Target: x86_64-unknown-freebsd13.1
Thread model: posix
InstalledDir: /usr/bin

[kandy@freebsd ~]$ pkg info --prefix libyaml
libyaml-0.2.5                  /usr/local

[kandy@freebsd ~]$ pkg info --prefix libffi
libffi-3.4.4                   /usr/local

[kandy@freebsd ~]$ pkg info --prefix readline
readline-8.2.1                 /usr/local
@postmodern
Copy link
Owner

This is odd. libyaml and libffi are definitely dependencies for FreeBSD's pkg util and they appear to be installed. Ruby's ./configure should be able to find them in /usr/local.

@nanaya
Copy link

nanaya commented Dec 9, 2023

As mentioned in the linked issue, /usr/local isn't included in search path by default.

If one has pkgconf installed, some gems (including psych and fiddle) may still be successfully installed when the gem checks for additional flags through it using pkg_config method from mkmf. readline doesn't though so it must have the prefix explicitly specified.

That said, all this thing is generally a minefield so I just set these env when building ruby (not needed when building gems):

export cflags="-I/usr/local/include"
export LDFLAGS="-L/usr/local/lib"
# just setting the two above is probably enough
export cxxflags="${cflags}"
export cppflags="${cflags}"
export LIBS="-L/usr/local/lib"

With the env above any native extensions will have /usr/local included during build (including readline) without needing to specify the path manually.

(note that it should probably use $(sysctl -n user.localbase) instead of hardcoding /usr/local)

@postmodern
Copy link
Owner

@nanaya I think you should report this upstream to https://bugs.ruby-lang.org/ CRuby should be able to link against libraries in /usr/local which is a standard FHS directory. I want to avoid patching/working-around CRuby issues that could be fixed upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants