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

Freebsd 10 impossible to compile Ruby from ruby-Build #496

Closed
jeezs opened this issue Jan 28, 2014 · 32 comments · Fixed by #630
Closed

Freebsd 10 impossible to compile Ruby from ruby-Build #496

jeezs opened this issue Jan 28, 2014 · 32 comments · Fixed by #630

Comments

@jeezs
Copy link

jeezs commented Jan 28, 2014

Ruby-Build failed to install ruby 2.0.0-p247 or any other ruby 2.
the error message is : The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
Is there any way to install Ruby using Ruby-Build on freebsd 10.
Thanks

@mislav
Copy link
Member

mislav commented Jan 28, 2014

How do you install packages on FreeBSD (I forgot)? Install the "openssl" package and try again. When successful, let us know what you did so we can add these instructions to the wiki.

@hsbt
Copy link
Member

hsbt commented Jan 29, 2014

I think this issue is similar to https://bugs.ruby-lang.org/issues/9301

@jeezs What's version number of openssl on FreeBSD 10?

@jeezs
Copy link
Author

jeezs commented Jan 29, 2014

I install first with git using this command : git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build using the Freebsd build in version of openSSL (1.0.1e)
Then I reinstall Freebsd from scratch using the build in Rbenv and ruby-build in Freebsd ports
And I always have the SSL error
At least I reinstall OpenSSL from port (this is also version 1.0.1e) and retry to install ruby 2.0.0-p247 with ruby-build without any success.
Finally for verififcation I try install RUBY20 from port which install nicely, no openSSL error here.

@mislav
Copy link
Member

mislav commented Jan 29, 2014

@caleb Do you have positive experiences building Ruby on FreeBSD? What were the steps involved?

@caleb
Copy link

caleb commented Jan 29, 2014

I have some experience, and I just upgraded to FreeBSD 10, so I'll do some investigation.

@jeezs
Copy link
Author

jeezs commented Jan 29, 2014

I never have such problem with Freebsd 9.It install without any problem

@anandamd
Copy link

My 2 cents on this, I upgraded my FreeBSD O/S from 9.2 to 10.0 and installed Ruby 2.0.0-p247. The installation went through fine but all of gem commands are giving the following error

ERROR: Loading command: update (LoadError) /home/anand/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/x86_64-freebsd10.0/zlib.so: Undefined symbol "inflateReset" - /home/anand/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/x86_64-freebsd10.0/zlib.so ERROR: While executing gem ... (NoMethodError) undefined method invoke_with_build_args' for nil:NilClass`

Installing 2.1.0 gives the same error about missing OpenSSL that @jeezs is experiencing.

@hsbt
Copy link
Member

hsbt commented Jan 30, 2014

I noticed this issue to ruby core team: https://twitter.com/hsbt/status/428439636713553920 (available only japanese infomation)

summary:

  • it works when 2.1.0 standalone install like a ./configure && make
  • this issue is only ruby-build
  • some libraries didn't link system libraries.

@shugo
Copy link

shugo commented Jan 30, 2014

With ruby-build, the value of the -Wl,-soname option, is empty, and thus openssl.so is not linked with libssl.so correctly.

excelsior:~$ cd /tmp/ruby-build.20140130105457.74022/ruby-2.1.0/ext/openssl
excelsior:openssl$ ldd ../../.ext/x86_64-freebsd10.0/openssl.so
../../.ext/x86_64-freebsd10.0/openssl.so:
        libcrypto.so.8 => /usr/local/lib/libcrypto.so.8 (0x801650000)
        libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x801a4b000)
        libthr.so.3 => /lib/libthr.so.3 (0x801c4e000)
        libcrypt.so.5 => /lib/libcrypt.so.5 (0x801e73000)
        libm.so.5 => /lib/libm.so.5 (0x802093000)
        libc.so.7 => /lib/libc.so.7 (0x80081d000)
        libelf.so.1 => /usr/lib/libelf.so.1 (0x8022b9000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x8024ce000)
excelsior:openssl$ grep 'cc -shared.*openssl\.so' /tmp/ruby-build.20140130105457.74022.log
cc -shared -o ../../.ext/x86_64-freebsd10.0/openssl.so ossl_ssl_session.o ossl_ocsp.o ossl_x509req.o ossl_ns_spki.o ossl_x509revoked.o ossl_pkcs12.o ossl_pkcs5.o ossl_pkcs7.o ossl_pkey_ec.o ossl_bn.o ossl_config.o ossl.o ossl_bio.o ossl_pkey.o ossl_ssl.o ossl_digest.o ossl_x509attr.o ossl_x509ext.o ossl_x509store.o ossl_x509.o ossl_cipher.o ossl_hmac.o ossl_pkey_dh.o ossl_asn1.o ossl_x509name.o openssl_missing.o ossl_engine.o ossl_rand.o ossl_pkey_dsa.o ossl_pkey_rsa.o ossl_x509crl.o ossl_x509cert.o -L. -L../.. -L. -L/home/shugo/.rbenv/versions/2.1.0/lib  -fstack-protector -rdynamic -L/usr/local/lib -Wl,-soname,    -lssl -lcrypto -lexecinfo -lthr -lcrypt -lm   -lc

With -Wl,-soname,openssl.so, openssl.so is linked with libssl.so correctly.

excelsior:openssl$ cc -shared -o ../../.ext/x86_64-freebsd10.0/openssl.so ossl_ssl_session.o ossl_ocsp.o ossl_x509req.o ossl_ns_spki.o ossl_x509revoked.o ossl_pkcs12.o ossl_pkcs5.o ossl_pkcs7.o ossl_pkey_ec.o ossl_bn.o ossl_config.o ossl.o ossl_bio.o ossl_pkey.o ossl_ssl.o ossl_digest.o ossl_x509attr.o ossl_x509ext.o ossl_x509store.o ossl_x509.o ossl_cipher.o ossl_hmac.o ossl_pkey_dh.o ossl_asn1.o ossl_x509name.o openssl_missing.o ossl_engine.o ossl_rand.o ossl_pkey_dsa.o ossl_pkey_rsa.o ossl_x509crl.o ossl_x509cert.o -L. -L../.. -L. -L/home/shugo/.rbenv/versions/2.1.0/lib  -fstack-protector -rdynamic -L/usr/local/lib -Wl,-soname,openssl.so    -lssl -lcrypto -lexecinfo -lthr -lcrypt -lm   -lc
excelsior:openssl$ ldd ../../.ext/x86_64-freebsd10.0/openssl.so
../../.ext/x86_64-freebsd10.0/openssl.so:
        libssl.so.8 => /usr/local/lib/libssl.so.8 (0x801650000)
        libcrypto.so.8 => /usr/local/lib/libcrypto.so.8 (0x8018b6000)
        libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x801cb1000)
        libthr.so.3 => /lib/libthr.so.3 (0x801eb4000)
        libcrypt.so.5 => /lib/libcrypt.so.5 (0x8020d9000)
        libm.so.5 => /lib/libm.so.5 (0x8022f9000)
        libc.so.7 => /lib/libc.so.7 (0x80081d000)
        libelf.so.1 => /usr/lib/libelf.so.1 (0x80251f000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x802734000)
excelsior:openssl$ 

I don't know why the value of the -Wl,-soname option is not set with ruby-build.

@shugo
Copy link

shugo commented Jan 30, 2014

Ah, I see. It's because gmake is used instead of make by ruby-build.

@shugo
Copy link

shugo commented Jan 30, 2014

I guess the following steps can be used as a workaround.

$ export MAKE="make"
$ rbenv install 2.0.0-p247

@hsbt
Copy link
Member

hsbt commented Jan 30, 2014

this issue fixed by ruby/ruby@3511a17

@mislav
Copy link
Member

mislav commented Jan 30, 2014

We default to gmake on FreeBSD because it was reported to us that make was incompatible. #270

@nagachika
Copy link
Contributor

I backported the changeset to ruby_2_0_0 at pachlevel 391.
Please try with 2.0.0-dev.

Thanks.

@jeezs
Copy link
Author

jeezs commented Jan 30, 2014

I just try to install Ruby 2.0.0-dev from ruby-buld but no way it doesn't work, though I didn't find 2.0.0 patch level 391 so I dunno if it a new version or still the same. anyway here is the error message:
BUILD FAILED
Inspect or clean up the working tree at /tmp/ruby-build.20140128223542.73055
Results logged to /tmp/ruby-build.20140128223542.73055.log

Last 10 log lines:
/tmp/ruby-build.20140128223542.73055 ~
Cloning into 'ruby-2.0.0-dev'...
/tmp/ruby-build.20140128223542.73055/ruby-2.0.0-dev /tmp/ruby-build.20140128223542.73055 ~
/home/jeezs/.rbenv/plugins/ruby-build/bin/ruby-build: line 419: autoconf: command not found

@mislav
Copy link
Member

mislav commented Jan 30, 2014

@jeezs For 2.0.0-dev, you'll need autoconf. It's probablly installable as a package on your system.

@caleb
Copy link

caleb commented Jan 30, 2014

I was able to build plain old 2.1.0 on FreeBSD 10 by just setting MAKE=make.

Fascinating, since BSD make was always a problem in the past!

FreeBSD 10 updated their OpenSSL to a version that ruby should be able to use, and they did change their make program (to bmake), but presumably it is fairly compatible with the old version.

@shugo
Copy link

shugo commented Jan 31, 2014

@mislav You need not change the default because this is a problem of Ruby.

@jeezs
Copy link
Author

jeezs commented Jan 31, 2014

I just install autoconf for freebsd but it still don't compile 2.0.0-dev.
here is the terminal error:
BUILD FAILED

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

Last 10 log lines:
checking whether -fPIE is accepted as CFLAGS... yes
checking whether -pie is accepted as LDFLAGS... yes
checking whether dtrace USDT is available... no
checking for prefix of external symbols... NONE
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking if gmake is GNU make... ./configure: gmake: not found
no
checking for safe null command for gmake... configure: error: no candidate for safe null command

@mislav
Copy link
Member

mislav commented Jan 31, 2014

@jeezs I'm confused why didn't you get this error before, if you really don't have gmake:

checking if gmake is GNU make... ./configure: gmake: not found

@jeezs
Copy link
Author

jeezs commented Jan 31, 2014

I have install gmake but still no luck:
BUILD FAILED

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

Last 10 log lines:
CPPFLAGS = -I/home/jeezs/.rbenv/versions/2.0.0-dev/include -I. -I.ext/include/x86_64-freebsd10.0 -I./include -I.
DLDFLAGS = -Wl,-soname,showflags -fstack-protector -pie
SOLIBS =
compiling main.c
compiling dmydln.c
compiling dmyencoding.c
generating miniprelude.c
executable host ruby is required. use --with-baseruby option.
gmake: *** [miniprelude.c] Error 1
gmake: *** Waiting for unfinished jobs....

@mislav
Copy link
Member

mislav commented Jan 31, 2014

People in this thread are reporting that compiling with MAKE=make worked for them, not gmake. gmake would usually work, but in Ruby 2.x there seems this weird issue which we're stuck with for now.

Any suggestions how to avoid the issue within ruby-build are welcome. Change gmake to make if we're on FreeBSD and compiling Ruby 2.x?

@shugo
Copy link

shugo commented Feb 1, 2014

@jeezs You need ruby to build 2.0.0-dev.

# pkg install ruby

@shugo
Copy link

shugo commented Feb 1, 2014

@mislav rbenv install 1.9.3-p484 succeeded on FreeBSD 10.0-RELEASE, but openssl.so is not linked with libssl.so correctly.

excelsior:1.9.3$ ruby -v -r openssl -e 0
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-freebsd10.0]
/home/shugo/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': /home/shugo/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/x86_64-freebsd10.0/openssl.so: Undefined symbol "SSL_connect" - /home/shugo/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/x86_64-freebsd10.0/openssl.so (LoadError)
    from /home/shugo/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/shugo/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/openssl.rb:17:in `<top (required)>'
    from /home/shugo/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/shugo/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'

I guess installation of any version by gmake fails on FreeBSD 10, without ruby/ruby@3511a17.
The behavior of linker may be changed in FreeBSD 10.

I'm not sure whether installation by BSD make on older versions of FreeBSD succeeds or not, so how about to use BSD make only on FreeBSD 10 or later?

release=`uname -r`
major=`expr $release : '\([0-9][0-9]*\)'`
if expr $major '>=' 10 > /dev/null; then
  export MAKE="make"
else
  export MAKE="gmake"
fi

@jeezs
Copy link
Author

jeezs commented Feb 1, 2014

if finally succeed to install rubies using autoconf, gmake and, pkg instal ruby as root.
any ruby can be install gem works.
seems to fix all the mess i've experience
Great

@mislav
Copy link
Member

mislav commented Feb 1, 2014

so how about to use BSD make only on FreeBSD 10 or later?

Do you think it's safe and that make is able to compile and Ruby version on FreeBSD 10? I don't have a VM to test in right now to check that hypothesis.

@shugo
Copy link

shugo commented Feb 1, 2014

@mislav I haven't seen build errors with BSD make on my FreeBSD 10 box, and my site works well on ruby-trunk built by BSD make.

@shugo
Copy link

shugo commented Feb 1, 2014

Naruse-san, the release manager of 2.1.0, said there's no problem with BSD make.
If you find any problem with BSD make, please report us.

@jeezs
Copy link
Author

jeezs commented Feb 2, 2014

for me as long as autoconf, gmake and native ruby are installed, rbenv install is safe.
i've repeat the whole install process with different rubies and it works without any problem.

@mbsmith
Copy link

mbsmith commented Feb 8, 2014

export MAKE=make works fine with 2.1.0 for me as well (fresh 10.0 install).

@geoffgarside
Copy link

export MAKE=make works fine with 1.9.3 on a fresh 10.0 install, gmake resulted in psych.so linking errors when running.

@dcamp314
Copy link

dcamp314 commented May 4, 2014

I've successfully used ruby-build on FreeBSD 9.2 but have hit the same snag with 10.0 as geoffgarside in #issuecomment-37649080 above regarding gmake. I pkg-installed gmake and that lets ruby build, but gem didn't work. I removed gmake and instead successfully used make:

% rbenv install 1.9.3-p545
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
Installing yaml-0.1.6...

BUILD FAILED

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

Last 10 log lines:
config.status: creating yaml-0.1.pc
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating Makefile
config.status: creating tests/Makefile
config.status: creating win32/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
/home/dcamp/.rbenv/plugins/ruby-build/bin/ruby-build: line 426: gmake: command not found
# pkg install gmake
Checking integrity... done
[1/1] Installing gmake-3.82_1... done
% rbenv install 1.9.3-p545
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /home/dcamp/.rbenv/versions/1.9.3-p545

Downloading ruby-1.9.3-p545.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/8e8f6e4d7d0bb54e0edf8d9c4120f40c
Installing ruby-1.9.3-p545...
Installed ruby-1.9.3-p545 to /home/dcamp/.rbenv/versions/1.9.3-p545

% rbenv global  1.9.3-p545
% rbenv which gem
/home/dcamp/.rbenv/versions/1.9.3-p545/bin/gem
% gem -v
/home/dcamp/.rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/x86_64-freebsd10.0/psych.so: Undefined symbol "yaml_get_version"
% export MAKE="make"
% rbenv install 1.9.3-p545
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /home/dcamp/.rbenv/versions/1.9.3-p545

Downloading ruby-1.9.3-p545.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/8e8f6e4d7d0bb54e0edf8d9c4120f40c
Installing ruby-1.9.3-p545...
Installed ruby-1.9.3-p545 to /home/dcamp/.rbenv/versions/1.9.3-p545

% gem -v
1.8.23.2

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

Successfully merging a pull request may close this issue.

10 participants