ruby can't find readline on OS X 10.6 - ruby

I'm running ruby 1.9.2 on OS X 10.6, and mostly things are working fine. But readline doesn't seem to be working, either in IRB or in the rails console. A few different posts suggested building readline as an extension, like this
cd <ruby-source-dir>/ext/readline
ruby extconf.rb
make
make install
So I did that, and here's what I get:
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... yes
checking for readline() in -ledit... no
and then
make: Nothing to be done for `all'
This makes me think it's not finding my readline install. Any ideas on how to get it to find readline?

I re-compiled readline and then tried the steps above again and everything worked fine. I think this may be because I had originally compiled readline for osx 10.5, when ruby was still 32 bits.

Related

Ruby build failed with rbenv - cannot locate make?

I have just wasted 2 days of my life trying to figure this out, and I need some help please!
I am a complete noob to ruby, and all I want to do is install octopress so that I can have a blog. I think I messed up my mac dev environment somehow - when I try to install ruby with rbenv, it fails and tells me that it cannot find make? How do I fix this?
Thanks for your help in advance.
Mike
Installing ruby-2.4.0...
BUILD FAILED (OS X 10.12.3 using ruby-build 20170201)
Inspect or clean up the working tree at /var/folders/d7/xhd01lr92rvglw0vw9hzkx1m0000gn/T/ruby-build.20170214143528.84918
Results logged to /var/folders/d7/xhd01lr92rvglw0vw9hzkx1m0000gn/T/ruby-build.20170214143528.84918.log
Last 10 log lines:
checking for sigsetjmp as a macro or function... yes
checking for setjmp type... _setjmp
checking for prefix of external symbols... _
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking if make is GNU make... ./configure: /usr/local/bin/make: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory
no
checking for safe null command for make... configure: error: no candidate for safe null command
/usr/local/bin/ruby-build: /usr/local/bin/make: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory
Here is the output of the following commands:
$ which ruby
/usr/bin/ruby
head /usr/local/bin/make
#!/usr/local/opt/ruby/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'make' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
And here is the output of echo $PATH:
/Users/michaelhenry/.rbenv/shims:/Users/michaelhenry/.rbenv/bin:/usr/local/bin:/Users/michaelhenry/.rbenv/shims:/Users/michaelhenry/.rbenv/bin:/usr/local/Cellar/coreutils/8.26/libexec/gnubin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

(Configuring Bitcoin core) configure: error: libdb_cxx headers missing

I've downloaded Bitcoin core from Github and am trying to set it up via instructions from Andreas Antonopoulos Bitcoin book Mastering Bitcoin Chapter 3 (The Bitcoin client)
Currently stuck on the configure step, when I run ./configure everything is looking good till it ends with the following error:
...
checking for stdio.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for strings.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for MSG_NOSIGNAL... no
checking for Berkeley DB C++ headers... no
configure: error: libdb_cxx headers missing
I'm using homebrew, how do I fix this error?
Ah figured it out, I didn't completely finish reading all the instructions in the build-osx.md file
#### Installing berkeley-db4 using Homebrew
The homebrew package for berkeley-db4 has been broken for some time. It will install without Java though.
Running this command takes you into brew's interactive mode, which allows you to configure, make, and install by hand:
```
$ brew install https://raw.github.com/mxcl/homebrew/master/Library/Formula/berkeley-db4.rb -–without-java
```
These rest of these commands are run inside brew interactive mode:
```
/private/tmp/berkeley-db4-UGpd0O/db-4.8.30 $ cd ..
/private/tmp/berkeley-db4-UGpd0O $ db-4.8.30/dist/configure -- prefix=/usr/local/Cellar/berkeley-db4/4.8.30 --mandir=/usr/local/Cellar/berkeley-db4/4.8.30/share/man --enable-cxx
/private/tmp/berkeley-db4-UGpd0O $ make
/private/tmp/berkeley-db4-UGpd0O $ make install
/private/tmp/berkeley-db4-UGpd0O $ exit
```
After exiting, you'll get a warning that the install is keg-only, which means it wasn't symlinked to /usr/local. You don't need it to link it to build bitcoin, but if you want to, here's how:
$ brew --force link berkeley-db4
brew install berkeley-db4
then
brew link berkeley-db4 --force
worked for me. not the ones proposed here
This is what worked for me:
sudo apt install libdb5.3++ libdb5.3++-dev
For those who uses fedora like me
sudo dnf install libdb-cxx-devel
and it may give warning about incompatible libdb version, you can ignore that with
./configure --with-incompatible-bdb

Installing glib from git in mac os x and gettext

I'm trying build glib from source in Mac OS X.
I've clone glib repo from gnome site.
The autogen.sh script seems to run fine. But when it starts it shows this message :
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
This seems spooky. However it finishes without showing any error. After spawning configure script it stops with the error :
checking libintl.h usability... no
checking libintl.h presence... no
checking for libintl.h... no
configure: error:
*** You must have either have gettext support in your C library, or use the
*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
Although i've install gettext from macports and it seems to be there :
arif#dev:~/sak/glib$ls /opt/local/lib/ | grep gettext
gettext
libgettextlib-0.18.3.dylib
libgettextlib.dylib
libgettextlib.la
libgettextpo.0.dylib
libgettextpo.a
libgettextpo.dylib
libgettextpo.la
libgettextsrc-0.18.3.dylib
libgettextsrc.dylib
libgettextsrc.la
One thing i've noticed that although gettext is installed, it does not have pkg-config file. Maybe that's why its happening .
arif#dev:~/sak/glib$ls /opt/local/lib/pkgconfig/ | grep gettext
comes out with nothing.
I ran into something similar and you might want to try to set CFLAGS="-L/opt/local/lib -I/opt/local/include". It seems that those are not included by default when running the gettext tests. You can either CFLAGS to the configure call or probably also to the autogen.sh

Compile Vim with GTK2 in Cygwin

I am trying to compile Vim on Cygwin, for Ruby and Python scripting support.
vim.exe --which is the terminal vim- compiles and runs fine, but gvim.exe does not. The problem is in the GTK+ 2 libraries, but I have them installed --from setup.exe of cygwin. I tried with higher and lower versions of GTK also.
Here is the relevant part from configure script. Any ideas are welcomed...
checking --enable-gui argument... GTK+ 2.x GUI support
checking --disable-gtktest argument... gtk test enabled
checking for GTK - version >= 2.2.0... no
checking X11/SM/SMlib.h usability... yes
checking X11/SM/SMlib.h presence... yes
checking for X11/SM/SMlib.h... yes
checking X11/xpm.h usability... yes
checking X11/xpm.h presence... yes
checking for X11/xpm.h... yes
checking X11/Sunkeysym.h usability... yes
checking X11/Sunkeysym.h presence... yes
checking for X11/Sunkeysym.h... yes
checking for XIMText in X11/Xlib.h... yes
no GUI selected; xim has been disabled
Install all the -devel packages required, including
gtk2
glib2
pangoo
atk
cairo
pixman
x11
libXt-devel
Install gcc4 cygwin package (solves libffi problem)
Run
./configure --prefix=/usr --enable-multibyte --enable-pythoninterp --enable-gui=gtk2 --enable-rubyinterp --disable-gtktest
gtktest has problems on cygwin, I didn't dig for the reasons
make && make install

How to fix this RVM error on a Macbook Pro i7 Running 10.6

I received the error described on this page http://www.fakingfantastic.com/2010/11/26/fixing-the-you-have-to-install-development-tools-first-error-with-nokogiri/ and in following their instructions i recieved the following error:
[2011-02-13 11:05:03] ./configure --prefix=/Users/MYNAME/.rvm/rubies/ruby-1.9.2-p136 --enable-shared
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/MYNAME/.rvm/src/ruby-1.9.2-p136':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
I thought that this : https://gist.github.com/767866 looked like an aswer but i cannot locate .rvmrc.
EDIT: i think the problem is i386. My the 1.8.2 install is x8x_64, it seems.
EDIT 2: after a bit more work i have it spitting this error out
[2011-02-13 11:51:05] ./configure --prefix=/Users/MYNAME/.rvm/rubies/ruby-1.9.2-p136 --enable-shared --build=i386-apple-darwin10.6.0 --host=i386-apple-darwin10.6.0
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for i386-apple-darwin10.6.0-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for i386-apple-darwin10.6.0-g++... no
checking for i386-apple-darwin10.6.0-c++... no
checking for i386-apple-darwin10.6.0-gpp... no
checking for i386-apple-darwin10.6.0-aCC... no
checking for i386-apple-darwin10.6.0-CC... no
checking for i386-apple-darwin10.6.0-cxx... no
checking for i386-apple-darwin10.6.0-cc++... no
checking for i386-apple-darwin10.6.0-cl.exe... no
checking for i386-apple-darwin10.6.0-FCC... no
checking for i386-apple-darwin10.6.0-KCC... no
checking for i386-apple-darwin10.6.0-RCC... no
checking for i386-apple-darwin10.6.0-xlC_r... no
checking for i386-apple-darwin10.6.0-xlC... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/Users/MYNAME/.rvm/src/ruby-1.9.2-p136':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
[2011-02-13 11:58:36] ./configure --prefix=/Users/MYNAME/.rvm/rubies/ruby-1.9.2-p136 --enable-shared
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/MYNAME/.rvm/src/ruby-1.9.2-p136':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
#eggie5 said:
I would put in your os x cd and install xcode again.
Do NOT install XCode from the DVD. The version that came on the 10.6 (Snow Leopard) disk is known to be buggy. Install the latest version from Apple's XCode site. You have to be registered to download, but it's a free registration.
I suspect you upgraded to 10.6, rather than it being installed by default when you bought your machine. 10.6 is 64-bit as is its related XCode version, so everything should have been 64-bit clean. Since it isn't it smells like regular Leopard or a pre-10.6 OS. That means all RVM hosted Rubies are suspicious and need to be cleaned up, along with any gems that were compiled prior to the upgrade and update of XCode.
After installing the XCode distribution, you'll need to uninstall, then install your RVM hosted Rubies. First, update RVM to the latest rev: Type rvm -v and note the revision number. Type rvm get head to load the latest version. When it has finished loading you should see a new revision number. RVM changes fast so you want to update to the latest pretty regularly.
This is from the RVM FAQ which is very good information for working with RVM, especially the comments about using sudo with gems:
My ruby is compiling as 32 bit but I am on Mac OS X Snow Leopard which has heavy advertisement that it is 64 bit!!!
RVM compiles to your current running kernel's architecture. This means that if your kernel is running as a 32 bit kernel (uname -m) it will compile 32 bit. You can override this behavior by placing the following in your ~/.rvmrc before installing the ruby interpreter:
rvm_archflags="-arch x86_64"
I think it's a good idea to set that rather than rely on defaults, since you're probably going to be on 64-bit from now on.
Type rvm reload or close your terminal window and reopen a session.
Type rvm notes and read it. This gives you a list of prerequisites you need for a smooth install of Ruby, based on your operating system. Failure to install those means various features might not work in Ruby, which will result in random, weird failures.
Type rvm list and make note of your installed Ruby versions. Pretend your first one is ruby-1.8.7-p330. Type:
rvm uninstall ruby-1.8.7-p330
rvm install ruby-1.8.7-p330
Repeat for each one you have installed. When you are done type rvm info and see if what it says passes sanity checks.
If everything looks good, it's time to rebuild the native drivers for your gems.
Both of these steps are optional, but are part of a good periodic house-keeping:
You might want to give your gems an update if you haven't run gem update for a while. rvm ruby 'gem update' will walk through the installed Rubies, updating them.
People accumulate old gems but often don't clean them up, so, to speed up rebuilding your gems you probably should clean out your old ones. You'll have to pay attention to what its telling you as it processes, because it will let you know about dependencies that will not be met. rvm ruby 'gem clean' will walk through the installed Rubies, and clean out the old stuff.
To rebuild the native drivers type rvm ruby 'gem pristine --all', which will reinstall all your gems.
Afterward, run rvm info and make sure it's returning sane information again.
Also, as an emergency escape hatch, it's entirely safe to blow away your ~/.rvm directory, either by typing rm -f ~/.rvm or using rvm implode, then starting over. Reinstalling a Ruby is the longest part of the process, and RVM makes it pretty painless once the supporting libraries are there.
I would put in your os x cd and install xcode again.

Resources