I Get A Ruby Trunk Make Error On Readline

I have had difficulties with a number of programs since I installed Ruby
version 1.9 so I decided to rebuild completely from the svn trunk. In
case it is relevant I am running Mac OS X Leopard 10.5.1. Here are the
steps I followed:

1) Checkout from trunk using:
$ svn co http://svn.ruby-lang.org/repos/ruby/trunk/ ruby

2) Go into the new ruby directory and create the configure file
$ cd ruby
$ autoconf

3) Run the configure script
$ ./configure

4) Now the next step is make and I always get the following error:
$ make
...
compiling readline
gcc -I. -I../../.ext/include/i686-darwin9.1.0 -I../.././include
-I../.././ext/readline -DRUBY_EXTCONF_H=\"extconf.h\" -fno-common -g
-O2 -pipe -fno-common -o readline.o -c readline.c
readline.c: In function ‘filename_completion_proc_call’:
readline.c:658: error: ‘filename_completion_function’ undeclared (first
use in this function)
readline.c:658: error: (Each undeclared identifier is reported only once
readline.c:658: error: for each function it appears in.)
readline.c:658: warning: assignment makes pointer from integer without a
cast
readline.c: In function ‘username_completion_proc_call’:
readline.c:683: error: ‘username_completion_function’ undeclared (first
use in this function)
readline.c:683: warning: assignment makes pointer from integer without a
cast
make[1]: *** [readline.o] Error 1
make: *** [all] Error 1

5) I can't seem to get around this error. I checked where all the
occurrence of "filename_completion_function" are in the repository
(using ack which is a lot like grep) and they are only in readline
files:
$ ack filename_completion_function
ext/readline/extconf.rb
45:have_func("rl_filename_completion_function")

ext/readline/readline.c
37:# define rl_filename_completion_function filename_completion_function
658: rl_filename_completion_function);

Please, please, please help me out or point me in the right direction to
getting this resolved.

···

--
Posted via http://www.ruby-forum.com/.

I don't know if it is the problem, but I had similar problems until I
updated Readline. But I am on 10.4, not 10.5 so YMMV

I wrote it up at::
http://www.lindsaar.net/2008/1/18/installing-ruby-1-9-on-mac-osx

Regards

Mikel

···

On Jan 28, 2008 1:11 PM, Joseph Pecoraro <joepeck02@gmail.com> wrote:

I have had difficulties with a number of programs since I installed Ruby
version 1.9 so I decided to rebuild completely from the svn trunk. In
case it is relevant I am running Mac OS X Leopard 10.5.1. Here are the
steps I followed:

Maybe I should have posted this in Ruby Core.

Also it may be the same as this bug:
http://rubyforge.org/tracker/?group_id=426&atid=1698&func=detail&aid=1883

Also I just found this in Google Groups (I don't know how I missed it in
the first place, its actually embarrassing that I missed this cause now
you guys will think I didn't research this) and sure enough this has the
solution:
http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/b35a326bf65f8aa5

I'll layout the steps here to solve this problem to build Ruby 1.9 on
Mac OS X Leopard 10.5.1

FIRST:
Install the newest readline (version 5.2) and use Han Kessels' solution
to correct a Leopard bug with gcc . So here is what you need to do:

1) download readline from somewhere like here:

2) Make Han Kessels' changes to support/shobj-conf (in the download you
just did). Here was his words:

Building readline5.2 on Leopard is broken. It checks for the OS
explicitly, but this check does not exclude darwin9 (Leopard). It is
easily fixed though, by patching support/shobj-conf:
--- support/shobj-conf 2007-12-26 18:30:46.000000000 +0900
+++ support/shobj-conf.new 2007-12-26 18:30:39.000000000 +0900
@@ -142,7 +142,7 @@
        ;;
# Darwin/MacOS X
-darwin8*)
+darwin89*)
        SHOBJ_STATUS=supported
        SHLIB_STATUS=supported
@@ -171,7 +171,7 @@
        SHLIB_LIBSUFF='dylib'
        case "${host_os}" in
- darwin[78]*) SHOBJ_LDFLAGS=''
+ darwin[789]*) SHOBJ_LDFLAGS=''
                        SHLIB_XLDFLAGS='-dynamiclib -arch_only
`/usr/bin/arch` -
install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$
(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
                        ;;
        *) SHOBJ_LDFLAGS='-dynamic'
Cheers,
Han

3) Now because of the gcc bug (Noticed by Sean at
http://www.weblogs.uhi.ac.uk/sm00sm/?p=291) you must do a "make static"
and "make static-install". If you already tried just "make" then you
can do "make clean" and start over with make static. If make
static-install doesn't work then just "make install" should be fine.

SECOND:
Once you have the new readline installed you can make Ruby 1.9. This
still requires you to give some hints to the configure. Here is what
you need to do now:

1) Go into the ruby directory [see first post if you want to know how to
get here from checking out the trunk]. If you already tryed a make
clean things up with "make clean"

2) Use the following configure command: [Thanks to Hans for this]
./configure --prefix=/usr/local --with-readline-dir=/usr/local

Now --prefix=/usr/local is the normal installation destination. The
only trick here is that you're telling configure where the readline-dir
is. It will be using your newly built readline.

3) Once configure ends you can just do "make" and "sudo make install"

···

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

I really hope this helps someone out if they want to install Ruby 1.9.
If you have any questions about any of this you can post a reply, I have
email notifications so I'll get notified, and I'll see what I can do to
help.

Thanks,
Joseph Pecoraro
--
Posted via http://www.ruby-forum.com/.

Mikel Lindsaar wrote:

I wrote it up at:
http://www.lindsaar.net/2008/1/18/installing-ruby-1-9-on-mac-osx

Mikel

Mike, your write-up is perfect. Nice, short and sweet. I wish that I
came across that before and I'll bookmark it and link some people to it
in the future. I think the only difference might be that in Leopard I
think you have to do make static with readline. Just a regular make
failed for me.

Thanks for the tip,
Joe P

···

--
Posted via http://www.ruby-forum.com/\.

No problems, could you leave a comment on what you had to do to make
it work on Leopard?

That would be good for others... and me when I upgrade :slight_smile:

Regards

Mikel

···

On Jan 28, 2008 2:20 PM, Joseph Pecoraro <joepeck02@gmail.com> wrote:

Mikel Lindsaar wrote:
> I wrote it up at:
> http://www.lindsaar.net/2008/1/18/installing-ruby-1-9-on-mac-osx
Mike, your write-up is perfect. Nice, short and sweet. I wish that I
came across that before and I'll bookmark it and link some people to it
in the future. I think the only difference might be that in Leopard I
think you have to do make static with readline. Just a regular make
failed for me.

Mikel Lindsaar wrote:

No problems, could you leave a comment on what you had to do to make
it work on Leopard?

That would be good for others... and me when I upgrade :slight_smile:

Regards

Mikel

Yup, just that when building readline use "make static" instead of just
"make". A more in depth explanation is available here:
http://www.weblogs.uhi.ac.uk/sm00sm/?p=291

Its possible that this will be fixed soon (maybe even 10.5.2 which is
rumored to be coming very soon), but in the very least that was the only
thing I had to do differently then your walkthrough.

Leopard is a very fine OS. I hope you get to upgrade soon and enjoy its
enhancements.
- Joe P

···

--
Posted via http://www.ruby-forum.com/\.