Re: Bad control characters in GHCi 6.6 (Mac OS X PPC)

On 10/19/06, Simon Marlow
See this page that I just created:
I tried these instructions, first by using my existing (darwinports) readline in /opt/local, and when that failed by first installing readline in /usr/local per the instructions. Neither fixed the problem. I don't know why but perhaps I failed to remove the traces of my initial install completely. In the end I gave up and installed Greg Heartsfield's binary package which remedied my problems (thanks Greg!). Thanks anyway Simon, -Bjorn Buckwalter

On Oct 23, 2006, at 8:59 AM, Björn Buckwalter wrote:
On 10/19/06, Simon Marlow
wrote: See this page that I just created:
I tried these instructions, first by using my existing (darwinports) readline in /opt/local, and when that failed by first installing readline in /usr/local per the instructions. Neither fixed the problem. I don't know why but perhaps I failed to remove the traces of my initial install completely. In the end I gave up and installed Greg Heartsfield's binary package which remedied my problems (thanks Greg!).
I think I have this partially figured out.
When I install version 5.1 of readline, rl_readline_version is
defined as follows in
/* **************************************************************** */ /* */ /* Well Published Variables */ /* */ /* **************************************************************** */
/* The version of this incarnation of the readline library. */ extern const char *rl_library_version; /* e.g., "4.2" */ extern int rl_readline_version; /* e.g., 0x0402 */
However, in ghc-6.6, libraries/readline/configure has the following:
cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char rl_readline_version (); int main () { rl_readline_version (); ; return 0; } _ACEOF
which is looking for rl_readline_version as a *function*. This fails (at the link stage on Darwin/Intel), even though GNU readline is installed, because the symbol type is wrong. The configure script concludes that libedit is being used, even though it's using GNU Readline v5.1. Was rl_readline_version a function in earlier versions of GNU Readline? Deborah

On Oct 30, 2006, at 2:40 PM, Deborah Goldsmith wrote:
I think I have this partially figured out.
The following patch to libraries/readline/configure.ac seems to do
the trick for Darwin:
--- configure.ac.save 2006-10-10 12:09:04.000000000 -0700
+++ configure.ac 2006-11-02 17:32:50.000000000 -0800
@@ -43,7 +43,10 @@
dnl ** is our readline really readline, or is it BSD's libedit?
if test x"$HaveLibReadline" = xYES ; then
- AC_CHECK_LIB(readline, rl_readline_version, ReadlineIsLibedit=NO,
ReadlineIsLibedit=YES)
+ AC_CHECK_DECL(rl_readline_version, ReadlineIsLibedit=NO,
ReadlineIsLibedit=YES,
+[#include

Hello, I am trying to reproduce the problem reported as "#898: GHC compiles against Apple's readline, giving error". On my PPC Mac OS X 10.3 Panther, however, I have managed to build ghc-6.6 without running into this particular problem. Initially without gnu readline, the resulting GHCi is, of course, without readline support. And after installing readline 5.1 via Darwin/MacPorts into /opt/local, I can re-build and this time get a GHCi with readline support, provided I "./configure --with-readline-includes=/opt/local/include/ --with-readline-libraries=/opt/local/lib". The reason for the error is stated as "The bug is really that Apple symlinks libreadline to libedit", but my system does not contain such a symlink. Is it possible to set up this masquerading on a Mac OS X 10.3? Or would I need to upgrade to 10.4? Or could something else again be required? Thanks and regards Thorkil On Saturday 04 November 2006 00:14, Deborah Goldsmith wrote:
On Oct 30, 2006, at 2:40 PM, Deborah Goldsmith wrote:
I think I have this partially figured out.
The following patch to libraries/readline/configure.ac seems to do the trick for Darwin:
--- configure.ac.save 2006-10-10 12:09:04.000000000 -0700 +++ configure.ac 2006-11-02 17:32:50.000000000 -0800 @@ -43,7 +43,10 @@ dnl ** is our readline really readline, or is it BSD's libedit? if test x"$HaveLibReadline" = xYES ; then - AC_CHECK_LIB(readline, rl_readline_version, ReadlineIsLibedit=NO, ReadlineIsLibedit=YES) + AC_CHECK_DECL(rl_readline_version, ReadlineIsLibedit=NO, ReadlineIsLibedit=YES, +[#include
+#include +]) fi if test $HaveLibTermcap = YES && test x"$HaveLibReadline" = xYES && test x"$ReadlineIsLibedit" = xNO ; then @@ -56,9 +59,12 @@ AC_SUBST(READLINE_LIBS) if test x"$HaveLibReadline" = xYES && test x"$ReadlineIsLibedit" = xNO ; then - AC_CHECK_LIB(readline, rl_erase_empty_line, + AC_CHECK_DECL(rl_erase_empty_line, [AC_DEFINE([HAVE_READLINE_4], [1], [Define to 1 if readline has version >= 4.0.])], - [AC_DEFINE([HAVE_READLINE_4], [0], [Define to 1 if readline has version >= 4.0.])]) + [AC_DEFINE([HAVE_READLINE_4], [0], [Define to 1 if readline has version >= 4.0.])], +[#include +#include +]) AC_CHECK_LIB(readline, rl_free_undo_list, [AC_DEFINE([HAVE_READLINE_4_2], [1], [Define to 1 if readline has version >= 4.2.])], [AC_DEFINE([HAVE_READLINE_4_2], [0], [Define to 1 if readline has version >= 4.2.])]) When I build with this patch after configuring to look for GNU readline in /usr/local, everything works. I don't know if this particular patch will work well on other systems. Maybe folks could try it out?
Thanks, Deborah
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Hi Thorkil, On Nov 21, 2006, at 2:24 PM, Thorkil Naur wrote:
Hello,
I am trying to reproduce the problem reported as "#898: GHC compiles against Apple's readline, giving error". On my PPC Mac OS X 10.3 Panther, however, I have managed to build ghc-6.6 without running into this particular problem. Initially without gnu readline, the resulting GHCi is, of course, without readline support. And after installing readline 5.1 via Darwin/ MacPorts into /opt/local, I can re-build and this time get a GHCi with readline support, provided I "./configure --with-readline-includes=/opt/ local/include/ --with-readline-libraries=/opt/local/lib".
The reason for the error is stated as "The bug is really that Apple symlinks libreadline to libedit", but my system does not contain such a symlink. Is it possible to set up this masquerading on a Mac OS X 10.3? Or would I need to upgrade to 10.4? Or could something else again be required?
Libedit (and the symlink from /usr/lib/libreadline) were added in 10.4. 10.3 should not have this particular problem. The "./configure --with-readline-includes=<prefix>/include --with- readline-libraries=<prefix>/lib is what MacPorts uses internally to get ghc to use the readline installed by MacPorts. On 10.4, if you don't specify which readline to use by this method, the configuration process will grab /usr/lib/libreadline.dylib, which is really libedit. I submitted a patch to let configure determine if readline were libedit, and to reject it. This patch was applied for the 6.6 release. It evidently needs to be applied in more than one place. Best Wishes, Greg
Thanks and regards Thorkil
On Saturday 04 November 2006 00:14, Deborah Goldsmith wrote:
On Oct 30, 2006, at 2:40 PM, Deborah Goldsmith wrote:
I think I have this partially figured out.
The following patch to libraries/readline/configure.ac seems to do the trick for Darwin:
--- configure.ac.save 2006-10-10 12:09:04.000000000 -0700 +++ configure.ac 2006-11-02 17:32:50.000000000 -0800 @@ -43,7 +43,10 @@ dnl ** is our readline really readline, or is it BSD's libedit? if test x"$HaveLibReadline" = xYES ; then - AC_CHECK_LIB(readline, rl_readline_version, ReadlineIsLibedit=NO, ReadlineIsLibedit=YES) + AC_CHECK_DECL(rl_readline_version, ReadlineIsLibedit=NO, ReadlineIsLibedit=YES, +[#include
+#include +]) fi if test $HaveLibTermcap = YES && test x"$HaveLibReadline" = xYES && test x"$ReadlineIsLibedit" = xNO ; then @@ -56,9 +59,12 @@ AC_SUBST(READLINE_LIBS) if test x"$HaveLibReadline" = xYES && test x"$ReadlineIsLibedit" = xNO ; then - AC_CHECK_LIB(readline, rl_erase_empty_line, + AC_CHECK_DECL(rl_erase_empty_line, [AC_DEFINE([HAVE_READLINE_4], [1], [Define to 1 if readline has version >= 4.0.])], - [AC_DEFINE([HAVE_READLINE_4], [0], [Define to 1 if readline has version >= 4.0.])]) + [AC_DEFINE([HAVE_READLINE_4], [0], [Define to 1 if readline has version >= 4.0.])], +[#include +#include +]) AC_CHECK_LIB(readline, rl_free_undo_list, [AC_DEFINE([HAVE_READLINE_4_2], [1], [Define to 1 if readline has version >= 4.2.])], [AC_DEFINE([HAVE_READLINE_4_2], [0], [Define to 1 if readline has version >= 4.2.])]) When I build with this patch after configuring to look for GNU readline in /usr/local, everything works. I don't know if this particular patch will work well on other systems. Maybe folks could try it out?
Thanks, Deborah
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (4)
-
Björn Buckwalter
-
Deborah Goldsmith
-
Gregory Wright
-
Thorkil Naur