# I Get A Ruby Trunk Make Error On Readline

**URL:** <https://www.ruby-forum.com/t/i-get-a-ruby-trunk-make-error-on-readline/127307>\
**Category:** Ruby\
**Created:** [January 28, 2008, 3:11am UTC](https://www.ruby-forum.com/t/i-get-a-ruby-trunk-make-error-on-readline/127307 "2008-01-28T03:11:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bogojoker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a88e57/32.png) [@bogojoker](https://www.ruby-forum.com/u/bogojoker)\
**Post date:** [January 28, 2008, 3:11am UTC](https://www.ruby-forum.com/t/i-get-a-ruby-trunk-make-error-on-readline/127307/1 "2008-01-28T03:11:29Z")

</div>

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/](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.

---

<div class="post-metadata">

**Author:** ![bogojoker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a88e57/32.png) [@bogojoker](https://www.ruby-forum.com/u/bogojoker)\
**Post date:** [January 28, 2008, 4:11am UTC](https://www.ruby-forum.com/t/i-get-a-ruby-trunk-make-error-on-readline/127307/2 "2008-01-28T04:11:22Z")

</div>

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](http://rubyforge.org/tracker/?group_id=426&atid=1698&func=detail&aid=1883)

Also I just found this in Google G. (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](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 K.’ solution  
to correct a Leopard bug with gcc . So here is what you need to do:

1. download readline from somewhere like here:  
[Readline 8.1 Free Download, Linux | IceWalkers](http://www.icewalkers.com/Linux/Software/515340/readline.html)

2. Make Han K.’ 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

1. Now because of the gcc bug (Noticed by Sean at  
[http://www.weblogs.uhi.ac.uk/sm00sm/?p=291](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.

1. 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 P.

---

<div class="post-metadata">

**Author:** ![bogojoker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a88e57/32.png) [@bogojoker](https://www.ruby-forum.com/u/bogojoker)\
**Post date:** [January 28, 2008, 4:20am UTC](https://www.ruby-forum.com/t/i-get-a-ruby-trunk-make-error-on-readline/127307/3 "2008-01-28T04:20:41Z")

</div>

Mikel L. wrote:

> I wrote it up at:  
> [http://www.lindsaar.net/2008/1/18/installing-ruby-1-9-on-mac-osx](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

---

<div class="post-metadata">

**Author:** ![bogojoker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a88e57/32.png) [@bogojoker](https://www.ruby-forum.com/u/bogojoker)\
**Post date:** [January 28, 2008, 5:10am UTC](https://www.ruby-forum.com/t/i-get-a-ruby-trunk-make-error-on-readline/127307/4 "2008-01-28T05:10:09Z")

</div>

On Jan 28, 2008 2:20 PM, Joseph P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Mikel L. wrote:
> 
> > I wrote it up at:  
> > [http://www.lindsaar.net/2008/1/18/installing-ruby-1-9-on-mac-osx](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.

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 🙂

Regards

Mikel

---

<div class="post-metadata">

**Author:** ![bogojoker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a88e57/32.png) [@bogojoker](https://www.ruby-forum.com/u/bogojoker)\
**Post date:** [January 28, 2008, 4:12am UTC](https://www.ruby-forum.com/t/i-get-a-ruby-trunk-make-error-on-readline/127307/5 "2008-01-28T04:12:03Z")

</div>

On Jan 28, 2008 1:11 PM, Joseph P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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:

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](http://www.lindsaar.net/2008/1/18/installing-ruby-1-9-on-mac-osx)

Regards

Mikel

---

<div class="post-metadata">

**Author:** ![bogojoker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a88e57/32.png) [@bogojoker](https://www.ruby-forum.com/u/bogojoker)\
**Post date:** [January 28, 2008, 5:15am UTC](https://www.ruby-forum.com/t/i-get-a-ruby-trunk-make-error-on-readline/127307/6 "2008-01-28T05:15:52Z")

</div>

Mikel L. 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 🙂
> 
> 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](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
