Opened 8 years ago

Closed 7 years ago

#898 closed bug (invalid)

GHC compiles against Apple's readline, giving error

Reported by: doaitse Owned by: thorkilnaur
Priority: high Milestone: 6.6.1
Component: Build System Version: 6.5
Keywords: "OS X" Sockets Cc: wolfgang.thaller@…
Operating System: MacOS X Architecture: x86
Type of failure: Difficulty: Unknown
Test Case: N/A Blocked By:
Blocking: Related Tickets:

Description

rl_reset_terminal returns void in Apple's readline, giving the following:

../compiler/ghc-inplace -H16m -O  -istage2/utils  -istage2/basicTypes  -istage2/types  -istage2/hsSyn  -istage2/prelude  -istage2/rename  -istage2/typecheck  -istage2/deSugar  -istage2/coreSyn  -istage2/specialise  -istage2/simplCore  -istage2/stranal  -istage2/stgSyn  -istage2/simplStg  -istage2/codeGen  -istage2/main  -istage2/profiling  -istage2/parser  -istage2/cprAnalysis  -istage2/ndpFlatten  -istage2/iface  -istage2/cmm  -istage2/nativeGen  -istage2/ghci -Istage2 -DGHCI -DBREAKPOINT -package template-haskell -threaded -package readline -DUSE_READLINE -cpp -fglasgow-exts -fno-generics -Rghc-timing -I. -Iparser -package unix -package Cabal -package regex-compat -ignore-package lang -recomp -Rghc-timing  -H16M '-#include "cutils.h"' -package-name  ghc-6.5   -fgenerics  -fno-cse  -c ghci/InteractiveUI.hs -o stage2/ghci/InteractiveUI.o  -ohi stage2/ghci/InteractiveUI.hi
/tmp/ghc28340_0/ghc28340_0.hc: In function 'slM3_ret':

/tmp/ghc28340_0/ghc28340_0.hc:43149:0:
     error: void value not ignored as it ought to be
/tmp/ghc28340_0/ghc28340_0.hc: In function 'slLX_ret':

/tmp/ghc28340_0/ghc28340_0.hc:43181:0:
     error: void value not ignored as it ought to be
<<ghc: 779741800 bytes, 1303 GCs, 18829642/33857204 avg/max bytes residency (8 samples), 88M in use, 0.01 INIT (0.00 elapsed), 2.75 MUT (12.86 elapsed), 1.97 GC (2.10 elapsed) :ghc>>
make[2]: *** [stage2/ghci/InteractiveUI.o] Error 1
make[1]: *** [stage2] Error 2
make: *** [bootstrap2] Error 2

Also, configure was run with

./configure --with-readline-includes=/opt/local/include/              --with-readline-libraries=/opt/local/lib

so it should not have been using this readline at all.

Change History (8)

comment:1 Changed 8 years ago by gwright@…

  • Cc wolfgang.thaller@… added
  • Keywords "OS X" Sockets added

The bug is really that Apple symlinks libreadline to libedit, and libedit does not implement the
full readline API. I submitted a patch some time ago to detect whether the "libreadline" was really
libedit and to not link it if it was. Was this patch not applied or did it have an error?

The patch was sent to resolve ticket #766, closed by Simon M on 6 July.

Best Wishes,
Greg

comment:2 Changed 8 years ago by igloo

There are two problems. One is, as you say, that libreadline is actually libedit on OS X. But another is that the instruction to use a different libreadline is not getting propogated everywhere it needs to.

Your patch does seem to be applied.

Thanks
Ian

comment:3 Changed 8 years ago by simonpj

  • Milestone set to 6.8
  • Owner set to igloo

comment:4 Changed 8 years ago by simonmar

  • Milestone changed from 6.8 to 6.6.1
  • Priority changed from normal to high

comment:5 Changed 7 years ago by igloo

  • Test Case set to N/A

comment:6 Changed 7 years ago by thorkilnaur

  • Owner changed from igloo to thorkilnaur

comment:7 Changed 7 years ago by thorkilnaur

I cannot reproduce this under what I would consider fair circumstances.
On Mac OS X 10.4, with the masquerading in place:

Thorkil-Naurs-Computer:~/tn/GHCDarcsRepository/ghc-6.6/ghc thorkilnaur$ ls -l /usr/include/readline        
total 24
lrwxr-xr-x   1 root  wheel    10 Nov 22 21:35 history.h -> readline.h
-r--r--r--   1 root  wheel  6435 Dec 25  2005 readline.h
Thorkil-Naurs-Computer:~/tn/GHCDarcsRepository/ghc-6.6/ghc thorkilnaur$ ls -l /usr/lib/ | grep readline
lrwxr-xr-x    1 root  wheel        13 Nov 22 20:16 libreadline.dylib -> libedit.dylib
Thorkil-Naurs-Computer:~/tn/GHCDarcsRepository/ghc-6.6/ghc thorkilnaur$ 

I build GHC 6.6 without installing readline:

Thorkil-Naurs-Computer:~/tn/GHCDarcsRepository/ghc-6.6/ghc thorkilnaur$ find /opt/local/include -name '*readline*'
Thorkil-Naurs-Computer:~/tn/GHCDarcsRepository/ghc-6.6/ghc thorkilnaur$ find /opt/local/lib -name '*readline*'
Thorkil-Naurs-Computer:~/tn/GHCDarcsRepository/ghc-6.6/ghc thorkilnaur$ 

And I get a GHCi without readline support, as I am supposed to in this case: The readline configure
patched by gwright@…
(#766) correctly detects that readline is not installed:

...
configure: configuring in readline
configure: running /bin/sh './configure' --prefix=/usr/local  '--prefix=/usr/local' '--with-readline-includes=/opt/local/include/' '--with-readline-libraries=/opt/local/lib' '--cache-file=/dev/null' '--srcdir=.' --cache-file=/dev/null --srcdir=.
...
checking for readline in -lreadline... yes
checking for rl_readline_version in -lreadline... no
...

And no complaints from the build. So this case works as it should.
Then I install (actually: "port activate") GNU readline, as witnessed by:

Thorkil-Naurs-Computer:~/tn/GHCDarcsRepository/ghc-6.6/ghc thorkilnaur$ ls -l `find /opt/local/include -name '*readline*'`
-rw-r--r--   2 root  admin  34354 Nov 19 19:50 /opt/local/include/readline/readline.h

/opt/local/include/readline:
total 152
-rw-r--r--   2 root  admin   4684 Nov 19 19:50 chardefs.h
-rw-r--r--   2 root  admin  10207 Nov 19 19:50 history.h
-rw-r--r--   2 root  admin   3529 Nov 19 19:50 keymaps.h
-rw-r--r--   2 root  admin  34354 Nov 19 19:50 readline.h
-rw-r--r--   2 root  admin   2182 Nov 19 19:50 rlconf.h
-rw-r--r--   2 root  admin   1503 Nov 19 19:50 rlstdc.h
-rw-r--r--   2 root  admin   2977 Nov 19 19:50 rltypedefs.h
-rw-r--r--   2 root  admin   3167 Nov 19 19:50 tilde.h
Thorkil-Naurs-Computer:~/tn/GHCDarcsRepository/ghc-6.6/ghc thorkilnaur$ ls -l `find /opt/local/lib -name '*readline*'`
-r-xr-xr-x   2 root  admin  456876 Nov 19 19:50 /opt/local/lib/libreadline.5.1.dylib
lrwxr-xr-x   1 root  admin      21 Nov 24 00:06 /opt/local/lib/libreadline.5.dylib -> libreadline.5.1.dylib
-rw-r--r--   2 root  admin  657996 Nov 19 19:50 /opt/local/lib/libreadline.a
lrwxr-xr-x   1 root  admin      21 Nov 24 00:06 /opt/local/lib/libreadline.dylib -> libreadline.5.1.dylib
Thorkil-Naurs-Computer:~/tn/GHCDarcsRepository/ghc-6.6/ghc thorkilnaur$ 

And rebuild GHC 6.6 (configured --with-readline-includes=/opt/local/include/ --with-readline-libraries=/opt/local/lib).
The installed readline is detected:

...
configure: configuring in readline
configure: running /bin/sh './configure' --prefix=/usr/local  '--prefix=/usr/local' '--with-readline-includes=/opt/local/include/' '--with-readline-libraries=/opt/local/lib' '--cache-file=/dev/null' '--srcdir=.' --cache-file=/dev/null --srcdir=.
...
checking for readline in -lreadline... yes
checking for rl_readline_version in -lreadline... yes
checking for rl_erase_empty_line in -lreadline... yes
checking for rl_free_undo_list in -lreadline... yes
...

and I get a GHCi with readline support. So this case also works as it should.

To be sure, it is possible to get the reported error reaction: If I deactivate
the GNU readline after succesfully building GHCi with readline support and then
force a rebuild of InteractiveUI.o (rm compiler/stage2/ghci/InteractiveUI.o), I
get:

../compiler/stage1/ghc-inplace -H16m -O  -istage2/utils  -istage2/basicTypes  -istage2/types  -istage2/hsSyn  -istage2/prelude  -istage2/rename  -istage2/typecheck  -istage2/deSugar  -istage2/coreSyn  -istage2/specialise  -istage2/simplCore  -istage2/stranal  -istage2/stgSyn  -istage2/simplStg  -istage2/codeGen  -istage2/main  -istage2/profiling  -istage2/parser  -istage2/cprAnalysis  -istage2/ndpFlatten  -istage2/iface  -istage2/cmm  -istage2/nativeGen  -istage2/ghci -Istage2 -DGHCI -DBREAKPOINT -package template-haskell -threaded -package readline -DUSE_READLINE -cpp -fglasgow-exts -fno-generics -Rghc-timing -I. -Iparser -package unix -package Cabal -package regex-compat -ignore-package lang -recomp -Rghc-timing  -H16M '-#include "cutils.h"' -package-name  ghc-6.6   -fgenerics  -fno-cse  -c ghci/InteractiveUI.hs -o stage2/ghci/InteractiveUI.o  -ohi stage2/ghci/InteractiveUI.hi
/tmp/ghc9149_0/ghc9149_0.hc: In function 'smnS_ret':

/tmp/ghc9149_0/ghc9149_0.hc:45171:0:
     error: void value not ignored as it ought to be
/tmp/ghc9149_0/ghc9149_0.hc: In function 'smnM_ret':

/tmp/ghc9149_0/ghc9149_0.hc:45204:0:
     error: void value not ignored as it ought to be
<<ghc: 767097624 bytes, 2491 GCs, 16280232/32660728 avg/max bytes residency (8 samples), 83M in use, 0.02 INIT (0.00 elapsed), 19.63 MUT (96.28 elapsed), 35.13 GC (37.11 elapsed) :ghc>>
gmake[2]: *** [stage2/ghci/InteractiveUI.o] Error 1
gmake[2]: Leaving directory `/Users/thorkilnaur/tn/GHCDarcsRepository/ghc-6.6/ghc/compiler'
gmake[1]: *** [stage2] Error 2
gmake[1]: Leaving directory `/Users/thorkilnaur/tn/GHCDarcsRepository/ghc-6.6/ghc'
gmake: *** [bootstrap2] Error 2

However, if I simply remember to configure, all stays sane: The library/readline configure
correctly detects that GNU readline is not installed and, as a result, the build
of the stage 2 compiler refrains from assuming readline and simply produces a GHCi
without readline support.

comment:8 Changed 7 years ago by thorkilnaur

  • Resolution set to invalid
  • Status changed from new to closed

Based on the above, I am closing this, since the problem appears to be gone. Please feel free to reopen if it doesn't work for you.

Note: See TracTickets for help on using tickets.