On a fresh installation of FreeBSD 12.0, ruby-build fails with the following error:
$ rbenv install 2.5.1
Downloading ruby-2.5.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.bz2
Installing ruby-2.5.1...
BUILD FAILED (FreeBSD 12.0-RELEASE using ruby-build 20180822)
Inspect or clean up the working tree at /tmp/ruby-build.20181227204543.15196
Results logged to /tmp/ruby-build.20181227204543.15196.log
Last 10 log lines:
>>> probes.o:(.eh_frame): SHT_X86_64_UNWIND
>>> output section .eh_frame: SHT_PROGBITS
*** [ruby-glommed.o] Error code 1
make: stopped in /tmp/ruby-build.20181227204543.15196/ruby-2.5.1
--- transdb.h ---
transdb.h updated
1 error
make: stopped in /tmp/ruby-build.20181227204543.15196/ruby-2.5.1
The full build log is:
ruby-build.20181227204543.15196.log
A workaround that works for me is to force clang use with CC=clang rbenv install 2.5.1.
... but if I set CC=clang, then subsequent Gems fail, because _they_ depend upon gcc.
Both GCC 8 and GCC 6 have the same problem (default GCC on FreeBSD 12.0 is GCC 7).
I then thought it might be an obsolete rbenv or ruby-build, so removed the FreeBSD packages for both, and installed both from Git.
... and that fixed it. So the problem is with the ruby-build package in FreeBSD. Closing this issue.
I have tried rbenv-installer which installed rbenv/ruby-build from the git source, and then install 2.5.3, but have no luck. The same error as above.
637 Configuration summary for ruby version 2.5.3
1
2 * Installation prefix: /usr/local/var/rbenv/versions/2.5.3
3 * exec prefix: ${prefix}
4 * arch: x86_64-freebsd12.0
5 * site arch: ${arch}
6 * RUBY_BASE_NAME: ruby
7 * ruby lib prefix: ${libdir}/${RUBY_BASE_NAME}
8 * site libraries path: ${rubylibprefix}/${sitearch}
9 * vendor path: ${rubylibprefix}/vendor_ruby
10 * target OS: freebsd12.0
11 * compiler: /usr/local/bin/gcc7
12 * with pthread: yes
13 * enable shared libs: no
14 * dynamic library ext: so
15 * CFLAGS: ${optflags} ${debugflags} ${warnflags}
16 * LDFLAGS: -L. -L/usr/local/var/rbenv/versions/2.5.3/lib \
17 -fstack-protector -rdynamic
18 * optflags: -O3
19 * debugflags: -ggdb3
20 * warnflags: -Wall -Wextra -Wno-unused-parameter \
21 -Wno-parentheses -Wno-long-long \
22 -Wno-missing-field-initializers \
23 -Wno-tautological-compare \
24 -Wno-parentheses-equality \
25 -Wno-constant-logical-operand -Wno-self-assign \
26 -Wunused-variable -Wimplicit-int -Wpointer-arith \
27 -Wwrite-strings -Wdeclaration-after-statement \
28 -Wimplicit-function-declaration \
29 -Wdeprecated-declarations \
30 -Wmisleading-indentation \
31 -Wno-packed-bitfield-compat \
32 -Wsuggest-attribute=noreturn \
33 -Wsuggest-attribute=format \
34 -Wimplicit-fallthrough=0 -Wduplicated-cond \
35 -Wrestrict
36 * strip command: strip
37 * install doc: yes
38 * man page type: doc
4 ---
3 --- showflags ---
2 --- probes.h ---
1 --- .ext/.timestamp/.enc-trans.time ---
681 --- .ext/.timestamp/x86_64-freebsd12.0/.time ---
1 --- main.o ---
2 --- dmydln.o ---
3 --- miniinit.o ---
4 --- dmyext.o ---
5 --- showflags ---
6 CC = /usr/local/bin/gcc7
7 LD = ld
8 LDSHARED = /usr/local/bin/gcc7 -shared
9 CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-lon
g -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -W
no-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-
arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wde
precated-declarations -Wmisleading-indentation -Wno-packed-bitfield-compat -Wsuggest-att
ribute=noreturn -Wsuggest-attribute=format -Wimplicit-fallthrough=0 -Wduplicated-cond -W
restrict -std=gnu99
10 XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidd
en -fexcess-precision=standard -DRUBY_EXPORT -fPIE
11 CPPFLAGS = -I/usr/local/var/rbenv/versions/2.5.3/include -I. -I.ext/include/x86_64-
freebsd12.0 -I./include -I. -I./enc/unicode/10.0.0
12 DLDFLAGS = -L/usr/local/var/rbenv/versions/2.5.3/lib -Wl,--compress-debug-sections=zl
ib -Wl,-soname,showflags -fstack-protector -pie
13 SOLIBS =
14 LANG = en_US.UTF-8
15 LC_ALL = en_US.UTF-8
16 LC_CTYPE =
17 gcc7 (FreeBSD Ports Collection) 7.3.0
18 Copyright (C) 2017 Free Software Foundation, Inc.
19 This is free software; see the source for copying conditions. There is NO
20 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Re-opening as it looks like it's not just the FreeBSD packages.
@chagel I've re-opened this.
@duncan-bayne
Thanks. Also tried gcc6 to install 2.6.0 but failed with the same error.
ld: error: section type mismatch for .eh_frame
>>> probes.o:(.eh_frame): SHT_X86_64_UNWIND
>>> output section .eh_frame: SHT_PROGBITS
*** [ruby-glommed.o] Error code 1
Can you install 2.6.0 with rbenv? Do you recall any other libraries you may install during the incident?
The problem seems to be with DTrace support, specifically by the following lines in the Makefile, generated with a default ./configure (FreeBSD 12.0-RELEASE-p2):
# DTrace static library hacks described here:
# http://mail.opensolaris.org/pipermail/dtrace-discuss/2005-August/000207.html
ruby-glommed.$(OBJEXT):
@$(ECHO) generating a glommed object with DTrace probes for static library
$(Q) $(LD) -r -o $@ $(OBJS)
The link is dead, and lost to time (couldn't find it at archive.org either).
If you're ok with ruby without DTrace support, you can build it with:
RUBY_CONFIGURE_OPTS="--disable-dtrace" rbenv install 2.6.0
I've only tested this on FreeBSD 12, installing ruby 2.6.0
Can confirm that @lazau's workaround allows me to build Ruby 2.5.1 on FreeBSD 12.0, as well. I've added the workaround to my FreeBSD setup scripts for now.
Continues to fail on Ruby 2.6.2, but @lazau's workaround continues to work :)
I need to install ruby-1.8.7 on a FreeBSD-12 host. I have installed rbenv and ruby-build from the packaged ports collection. I have attempted to use the work-around provide by @lazau but hat has not worked for me:
RUBY_CONFIGURE_OPTS="--disable-dtrace" ruby-build -4 1.8.7-p375 ./.rbenv/versions
Checking out http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7...
Installing ruby-1.8.7-p375...
WARNING: ruby-1.8.7-p375 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
BUILD FAILED (FreeBSD 12.0-RELEASE-p10 using ruby-build 20190423)
Inspect or clean up the working tree at /tmp/ruby-build.20190916131749.12047
Results logged to /tmp/ruby-build.20190916131749.12047.log
Last 10 log lines:
Checked out revision 44351.
/tmp/ruby-build.20190916131749.12047/ruby-1.8.7-p375 /tmp/ruby-build.20190916131749.12047 ~
configure: WARNING: unrecognized options: --disable-dtrace, --with-readline-dir
checking build system type... x86_64-unknown-freebsd12.0
checking host system type... x86_64-unknown-freebsd12.0
checking target system type... x86_64-unknown-freebsd12.0
checking whether the C compiler works... no
configure: error: in `/tmp/ruby-build.20190916131749.12047/ruby-1.8.7-p375':
configure: error: C compiler cannot create executables
See `config.log' for more details
What else can I do to get this installed?
@byrnejb This looks like a different problem - perhaps raise a new issue? Tag me on it if you'd like; I'm busy setting up my FreeBSD dev environment and may be able to help you out.
(Also, do you _really_ need 1.8.7? That's old, and very likely to be insecure.)
(Also, do you _really_ need 1.8.7? That's old, and very likely to be insecure.)
The reason 1.8.7 is required is that the application uses Ruby on Rails 3. We tried converting the project to RoR-4 but ran into a roadblock, so long ago that I cannot recall what it was. So the thing has been running by itself in a virtualized CentOS-6 machine. As luck would have it we could not get a FreeBSD-12 Bhyve vm to boot a CentOS 6 image so we could not move it off its existing hardware. In the meantime both the primary host and backup host developed HDD errors. We have one running but the other is not coming back from the grave. The one that is running is likely about to fail and I need to simply get this thing onto a new box. As an interim measure I am provisioning a spare machine with CentOS-6.10 in order to transfer it to bare metal. But I would prefer to run it inside a FreeBSD jail on 12.0.
This looks like a different problem - perhaps raise a new issue?
Ok will do.
Hi all, I addressed this issue to the ruby-core tracker.
https://bugs.ruby-lang.org/issues/16674
It seems the bug of ruby-core.
Looks like the upstream bug is still open (just checked as I'm experiencing weirdness on FreeBSD still).
Upstream still open, and (AFAICT) the --disable-dtrace workaround is still needed on FreeBSD 12.1.
Right. There is no action with ruby-build. I'll close this.
Most helpful comment
The problem seems to be with DTrace support, specifically by the following lines in the Makefile, generated with a default
./configure(FreeBSD 12.0-RELEASE-p2):The link is dead, and lost to time (couldn't find it at archive.org either).
If you're ok with ruby without DTrace support, you can build it with:
I've only tested this on FreeBSD 12, installing ruby 2.6.0