Ruby-build: 2.2.2 fails on FreeBSD 11-CURRENT

Created on 8 Sep 2015  Â·  17Comments  Â·  Source: rbenv/ruby-build

After looking at the logs, if there's anything else I can check for, let me know!

$ uname -a; freebsd-version
FreeBSD z600 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r286893: Tue Aug 18 18:44:28 UTC 2015     [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64
11.0-CURRENT
$ rbenv install 2.2.2 -v > ~/freebsd222build.log
Downloading ruby-2.2.2.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/5ffc0f317e429e6b29d4a98ac521c3ce65481bfd22a8cf845fa02a7b113d9b44
load: 0.58  cmd: curl 46215 [select] 2.37r 0.07u 0.03s 1% 9184k
giInstalling ruby-2.2.2...

BUILD FAILED (FreeBSD 11.0-CURRENT using ruby-build 20150818)

Inspect or clean up the working tree at /tmp/ruby-build.20150908103654.46184
Results logged to /tmp/ruby-build.20150908103654.46184.log

Last 10 log lines:
                              power_assert-0.2.2.gem
installing rdoc:              /usr/home/tony/.rbenv/versions/2.2.2/share/ri/2.2.0/system
installing capi-docs:         /usr/home/tony/.rbenv/versions/2.2.2/share/doc/ruby
The Ruby readline extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
  --prefix=/usr/home/tony/.rbenv/versions/2.2.2
  CFLAGS= -O3 -Wno-error=shorten-64-to-32 
  LDFLAGS=-L/usr/home/tony/.rbenv/versions/2.2.2/lib 
  CPPFLAGS=-I/usr/home/tony/.rbenv/versions/2.2.2/include 

Verbose Log: https://gist.github.com/tony/07fa8415f3f74e1d39f6

x-platform

Most helpful comment

We could change ruby-build to include --with-opt-dir=/usr/local on FreeBSD by default if no explicit --with-opt-dir was specified. That would take care of the problem temporarily. Future Ruby versions might fix this in their build process. What does everyone think about this?

All 17 comments

Have you tried installing libreadline or readline-devel using the package manager for FreeBSD? It seems that might fix the problem

I had the same problem as tony. I have readline installed, and it still fails.

readline was installed when I posted the original issue. I get the same response from rbenv install 2.2.2. Here are more details on readline (You can also see where the libs install to)

$ pkg info readline-6.3.8 
readline-6.3.8
Name           : readline
Version        : 6.3.8
Installed on   : Tue Sep  8 10:21:36 CDT 2015
Origin         : devel/readline
Architecture   : freebsd:11:x86:64
Prefix         : /usr/local
Categories     : devel
Licenses       : GPLv3
Maintainer     : [email protected]
WWW            : http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html 
Comment        : Library for editing command lines as they are typed
Options        :
    DOCS           : on
    TERMCAP        : on
Shared Libs provided:
    libreadline.so.6
    libhistory.so.6

$ pkg info -l readline-6.3.8 
readline-6.3.8:
    /usr/local/include/readline/chardefs.h
    /usr/local/include/readline/history.h
    /usr/local/include/readline/keymaps.h
    /usr/local/include/readline/readline.h
    /usr/local/include/readline/rlconf.h
    /usr/local/include/readline/rlstdc.h
    /usr/local/include/readline/rltypedefs.h
    /usr/local/include/readline/tilde.h
    /usr/local/info/history.info
    /usr/local/info/readline.info
    /usr/local/info/rluserman.info
    /usr/local/lib/libhistory.a
    /usr/local/lib/libhistory.so
    /usr/local/lib/libhistory.so.6
    /usr/local/lib/libreadline.a
    /usr/local/lib/libreadline.so
    /usr/local/lib/libreadline.so.6
    /usr/local/man/man3/history.3.gz
    /usr/local/man/man3/readline.3.gz
    /usr/local/share/doc/readline/CHANGES
    /usr/local/share/doc/readline/INSTALL
    /usr/local/share/doc/readline/README
    /usr/local/share/licenses/readline-6.3.8/GPLv3
    /usr/local/share/licenses/readline-6.3.8/LICENSE
    /usr/local/share/licenses/readline-6.3.8/catalog.mk
    /usr/local/share/readline/excallback.c
    /usr/local/share/readline/fileman.c
    /usr/local/share/readline/hist_erasedups.c
    /usr/local/share/readline/hist_purgecmd.c
    /usr/local/share/readline/histexamp.c
    /usr/local/share/readline/manexamp.c
    /usr/local/share/readline/rl-callbacktest.c
    /usr/local/share/readline/rl-fgets.c
    /usr/local/share/readline/rl.c
    /usr/local/share/readline/rlcat.c
    /usr/local/share/readline/rlevent.c
    /usr/local/share/readline/rlptytest.c
    /usr/local/share/readline/rltest.c
    /usr/local/share/readline/rlversion.c

@tony Thanks for sharing this info. Can you try specifying RUBY_CONFIGURE_OPTS=--with-readline-dir=/usr/local/include/readline?

@hsbt This might be a Ruby build bug on FreeBSD. Do you know anything about that?

@tony @mislav It seems issue of Ruby core extension. I will report our tracker.

ref. https://bugs.ruby-lang.org/issues/11546

@tony @apotheon In the meantime, try RUBY_CONFIGURE_OPTS=--disable-install-doc to skip the RDoc generation phase. Ruby might still be compiled without readline support, but most of your programs should work fine.

@tony Can you provide ext/readline/mkmf.log ? It exists under /tmp/ruby-build.20150908103654.46184/ruby-2.2.2 directory.

@hsbt:

$ cat /tmp/ruby-build.20150908103654.46184/ruby-2.2.2/ext/readline/mkmf.log 
have_library: checking for tgetnum() in -lncurses... -------------------- yes

"cc -o conftest -I../../.ext/include/x86_64-freebsd11.0 -I../.././include -I../.././ext/readline -I/usr/home/tony/.rbenv/versions/2.2.2/include     -O3 -Wno-error=shorten-64-to-32  conftest.c  -L. -L../.. -L. -L/usr/home/tony/.rbenv/versions/2.2.2/lib  -fstack-protector -rdynamic     -Wl,-R/usr/home/tony/.rbenv/versions/2.2.2/lib -L/usr/home/tony/.rbenv/versions/2.2.2/lib -lruby-static -lncurses  -lelf -lexecinfo -lprocstat -lthr -lcrypt -lm   -lc"
conftest.c:13:57: error: use of undeclared identifier 'tgetnum'
int t(void) { void ((*volatile p)()); p = (void ((*)()))tgetnum; return 0; }
                                                        ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))tgetnum; return 0; }
/* end */

"cc -o conftest -I../../.ext/include/x86_64-freebsd11.0 -I../.././include -I../.././ext/readline -I/usr/home/tony/.rbenv/versions/2.2.2/include     -O3 -Wno-error=shorten-64-to-32  conftest.c  -L. -L../.. -L. -L/usr/home/tony/.rbenv/versions/2.2.2/lib  -fstack-protector -rdynamic     -Wl,-R/usr/home/tony/.rbenv/versions/2.2.2/lib -L/usr/home/tony/.rbenv/versions/2.2.2/lib -lruby-static -lncurses  -lelf -lexecinfo -lprocstat -lthr -lcrypt -lm   -lc"
conftest.c:13:15: warning: implicit declaration of function 'tgetnum' is invalid in C99 [-Wimplicit-function-declaration]
int t(void) { tgetnum(); return 0; }
              ^
1 warning generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { tgetnum(); return 0; }
/* end */

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

have_header: checking for readline/readline.h... -------------------- no

"cc -E -I../../.ext/include/x86_64-freebsd11.0 -I../.././include -I../.././ext/readline -I/usr/home/tony/.rbenv/versions/2.2.2/include     -O3 -Wno-error=shorten-64-to-32   conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'readline/readline.h' file not found
#include <readline/readline.h>
         ^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <readline/readline.h>
/* end */

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

have_header: checking for editline/readline.h... -------------------- no

"cc -E -I../../.ext/include/x86_64-freebsd11.0 -I../.././include -I../.././ext/readline -I/usr/home/tony/.rbenv/versions/2.2.2/include     -O3 -Wno-error=shorten-64-to-32   conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'editline/readline.h' file not found
#include <editline/readline.h>
         ^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <editline/readline.h>
/* end */

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

readline nor libedit not found
Failed to configure readline. It will not be installed.

You need to pass --with-opt-dir=/usr/local option to configure.
I don't know how it can with rbenv.

@nobu

RUBY_CONFIGURE_OPTS=--with-opt-dir=/usr/local

Works.

Is this something that'd be fixed here or want us to do it via our packaging?

$ RUBY_CONFIGURE_OPTS=--with-opt-dir=/usr/local  rbenv install 2.2.2
Downloading ruby-2.2.2.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/5ffc0f317e429e6b29d4a98ac521c3ce65481bfd22a8cf845fa02a7b113d9b44
Installing ruby-2.2.2...
Installed ruby-2.2.2 to /usr/home/tony/.rbenv/versions/2.2.2

We could change ruby-build to include --with-opt-dir=/usr/local on FreeBSD by default if no explicit --with-opt-dir was specified. That would take care of the problem temporarily. Future Ruby versions might fix this in their build process. What does everyone think about this?

Sounds good.

If we can make a new tag I'll make a patch to update the port package as
well.

On Sun, Sep 27, 2015 at 7:46 AM, Mislav Marohnić [email protected]
wrote:

We could change ruby-build to include --with-opt-dir=/usr/local on
FreeBSD by default if no explicit --with-opt-dir was specified. That
would take care of the problem temporarily. Future Ruby versions might fix
this in their build process. What does everyone think about this?

—
Reply to this email directly or view it on GitHub
https://github.com/sstephenson/ruby-build/issues/805#issuecomment-143547211
.

As an update, FreeBSD-11 has released and the problem does remain. When rbenv installed out of my home directory, the above RUBY_CONFIGURE_OPTS did not work for me.

Okay, I'm a liar. I have just run the following after reading the bin scripts.

RUBY_CONFIGURE_OPTS=--with-readline-dir="/usr/local" rbenv install 2.2.5

Which has resulted in a functional ruby in my users home directory on FreeBSD 11-RELEASE.

The option I'd tried before was RUBY_CONFIGURE_OPTS=--with-opt-dir=/usr/local, which didn't work.

I confirm to build with --with-opt-dir on FreeBSD 11

[freebsd@chkbuild015 ~]$ RUBY_CONFIGURE_OPTS=--with-opt-dir=/usr/local rbenv install 2.2.5
Downloading ruby-2.2.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.5.tar.bz2
Installing ruby-2.2.5...
Installed ruby-2.2.5 to /home/freebsd/.rbenv/versions/2.2.5

I couldn't reproduce this issue.

We have a solution of this issue on FreeBSD 11, I close this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dpaluy picture dpaluy  Â·  6Comments

fguillen picture fguillen  Â·  5Comments

edap picture edap  Â·  3Comments

arpitchauhan picture arpitchauhan  Â·  4Comments

k0kubun picture k0kubun  Â·  3Comments