Showing posts with label GNU Readline. Show all posts
Showing posts with label GNU Readline. Show all posts

Saturday, November 27, 2010

GNU readline in Racket

My main operating system is Gentoo (2.6.32-gentoo-r7), which doesn't have the Racket programming language in its package repository, so I compiled it myself from the sources available on the racket website (another side note: Racket v5.0.1 won't compile if you have a newer version of libpng installed, but Racket v5.0.2 fixes the out-of-date function call). However, I ran into a slight problem when trying to install GNU Readline support by evaluating (require readline) in the racket prompt, where I was greeted by the following error:
ffi-lib: couldn't open "libreadline.so.5" (libreadline.so.5: cannot open shared object file: No such file or directory)
Which sounds rather foreboding, but fortunately has an easy fix. The problem is caused by a tendency of later GNU Readline installations to lack the shared object file named "libreadline.so.5", instead having a file named "libreadline.so.6", a newer version of the library. The simple (and as far as I have been able to tell, correct) fix is to modify line 11 in $RACKET_DIR/lib/racket/collects/readline/mzrl.rkt from:
(define libreadline (ffi-lib "libreadline" '("5" "4" ""))) 
to
(define libreadline (ffi-lib "libreadline" '("6" "5" "4" ""))).
Hope that keeps at least one Schemer from pulling their hair out in the near future.