Cannot install readline on Mac OS X

After a recent upgrade of Mac OS X from Tiger to Snow Leopard, I installed the Haskell Platform. I installed genuine readline using MacPorts. Now I cannot install the readline package, due to the well-known problem that configure finds the fake readline that comes with Mac OS X and refuses to proceed. I have tried the various solutions suggested in: http://hackage.haskell.org/trac/ghc/ticket/3121 http://www.haskell.org/pipermail/libraries/2009-May/011595.html http://hackage.haskell.org/trac/hackage/ticket/631 and various combinations of them. Nothing helped, the same problem always occurred. Any new ideas? Thanks, Yitz

On Mon, Apr 26, 2010 at 4:50 AM, Yitzchak Gale
After a recent upgrade of Mac OS X from Tiger to Snow Leopard, I installed the Haskell Platform. I installed genuine readline using MacPorts.
Now I cannot install the readline package, due to the well-known problem that configure finds the fake readline that comes with Mac OS X and refuses to proceed.
I have tried the various solutions suggested in:
http://hackage.haskell.org/trac/ghc/ticket/3121 http://www.haskell.org/pipermail/libraries/2009-May/011595.html http://hackage.haskell.org/trac/hackage/ticket/631
and various combinations of them. Nothing helped, the same problem always occurred.
Any new ideas?
This worked for me on Snow Leopard: export CFLAGS=-m32 cabal install readline --configure-option=--with-readline-includes=/opt/local/include --configure-option=--with-readline-libraries=/opt/local/lib I had previously set MacPorts to compile all of its libraries 32-bit, which makes the first line necessary for the configure script to link properly. -Judah

Hi Judah, On Mon, Apr 26, 2010 at 8:27 PM, Judah Jacobson wrote:
This worked for me on Snow Leopard: export CFLAGS=-m32 cabal install readline --configure-option=--with-readline-includes=/opt/local/include --configure-option=--with-readline-libraries=/opt/local/lib
Thanks. That got me further - but not all the way. Now readline seemed to build and install OK. But when I then compiled a program that uses readline, I got: Linking pileonText ... ld: warning: in /opt/local/lib/libreadline.dylib, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /opt/local/lib/libncurses.dylib, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /opt/local/lib/libiconv.dylib, file was built for unsupported file format which is not the architecture being linked (i386) Undefined symbols: "_rl_filename_quote_characters", referenced from: _rl_filename_quote_characters$non_lazy_ptr in libHSreadline-1.0.1.0.a(Readline.o) <hundreds more undefined symbols> I made sure that all of the .o and .hi files were deleted for the modules being compiled. No FFI involved. Thanks, Yitz

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Apr 26, 2010, at 16:31 , Yitzchak Gale wrote:
Linking pileonText ... ld: warning: in /opt/local/lib/libreadline.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
This is characteristic of ABI mismatches between ports and ghc. Last I checked, ghc didn't work in 64-bit mode on Snow Leopard, but if you have a (development/prerelease?) version that does then you need to rebuild all of MacPorts with +universal. - -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) iEYEARECAAYFAkvV/c4ACgkQIn7hlCsL25VskwCfTIqr9wmFRF2UYfio4m3bYfSH YykAn1ZhFvSRREVuvA5ACujIf2LC6Eu9 =l/DE -----END PGP SIGNATURE-----

Brandon S. Allbery KF8NH wrote:
This is characteristic of ABI mismatches between ports and ghc. Last I checked, ghc didn't work in 64-bit mode on Snow Leopard, but if you have a (development/prerelease?) version that does
I'm using whatever came with the Haskell Platform for the Mac. But anyway...
then you need to rebuild all of MacPorts with +universal.
OK, continuing to move forward. Based on various error messages I have gotten, I did: sudo port -f install readline +universal ncurses + universal libiconv +universal Then I reinstalled the readline package, using Judah's incantation from earlier in this thread and adding --reinstall (and sudo and --global, in my case) to the cabal install command. Now when compiling my Haskell program I get: Linking pileonText ... Undefined symbols: "_iconv_close", referenced from: _hs_iconv_close in libHSbase-4.2.0.0.a(iconv.o) (maybe you meant: _hs_iconv_close) "_iconv_open", referenced from: _hs_iconv_open in libHSbase-4.2.0.0.a(iconv.o) (maybe you meant: _hs_iconv_open) "_iconv", referenced from: _hs_iconv in libHSbase-4.2.0.0.a(iconv.o) (maybe you meant: _hs_iconv_close, _hs_iconv_open , _hs_iconv ) ld: symbol(s) not found collect2: ld returned 1 exit status Trying to take the hint, I did cabal install --reinstall --global base-4.2.0.0 but that resulted in configure: creating ./config.status config.status: error: cannot find input file: base.buildinfo.in cabal: Error: some packages failed to install: base-4.2.0.0 failed during the configure step. The exception was: ExitFailure 1 Now what? Thanks, Yitz

On Apr 27, 2010, at 09:35 , Yitzchak Gale wrote:
Linking pileonText ... Undefined symbols: "_iconv_close", referenced from: _hs_iconv_close in libHSbase-4.2.0.0.a(iconv.o) (maybe you meant: _hs_iconv_close) "_iconv_open", referenced from: _hs_iconv_open in libHSbase-4.2.0.0.a(iconv.o) (maybe you meant: _hs_iconv_open) "_iconv", referenced from: _hs_iconv in libHSbase-4.2.0.0.a(iconv.o) (maybe you meant: _hs_iconv_close, _hs_iconv_open , _hs_iconv ) ld: symbol(s) not found collect2: ld returned 1 exit status
This is actually a problem with finding/using the correct iconv library. See http://code.google.com/p/gpsee/issues/detail?id=19 for a (Haskell-related, even) discussion. I don't have SL so can't really help with this. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

I wrote:
Linking pileonText ... Undefined symbols: "_iconv_close", referenced from: _hs_iconv_close in libHSbase-4.2.0.0.a(iconv.o) (maybe you meant: _hs_iconv_close) [and similar for _iconv_open and _iconv] ld: symbol(s) not found collect2: ld returned 1 exit status
Brandon S. Allbery KF8NH
This is actually a problem with finding/using the correct iconv library. See http://code.google.com/p/gpsee/issues/detail?id=19 for a (Haskell-related, even) discussion. I don't have SL so can't really help with this.
Thanks for the link. I don't see the Haskell connection - it's a JavaScript interpreter with its own FFI. But anyway... If this is the same problem, then I don't see how to proceed. In their case, it was two modules within their own project that were linking to the two different copies of iconv. They just needed to get the two modules to agree. But in our case, MacPorts readline is linking to MacPorts iconv as it should, and HP base is linking to native iconv as it should. So i've abandoned MacPorts readline, and I'm trying to build GNU readline manually. So far, I haven't been able to get this to work either. I have a number of questions: What version of GNU readline should I use? The current version is 6.1, but the Haskell readline package doesn't seem to support that. The highest version mentioned in HsReadlineConfig.h.in is 5.0. I tried 6.1 anyway, but unsurprisingly, Haskell readline didn't recognize it. What version should I use? Older versions of readline stubbornly refuse to build shared libraries on Snow Leopard. The make fails with: i686-apple-darwin10-gcc-4.2.1: -compatibility_version only allowed with -dynamiclib But I can't figure out how to pass the flag it wants. When I put it in CFLAGS or LDFLAGS, configure fails right at the start with configure: error: cannot run C compiled programs. Also - should I use -m32 or not when building readline? Could be that the real solution is to go back to Judah's GNUreadline.framework idea, and to arrange for the readline package to use it on the Mac. The only difference is that now the framework is not required for GHC as it was in the past, only for the readline package. It's clear that it is currently at least extremely difficult and non-intuitive, if not impossible, to use the readline package on Snow Leopard. That needs to be fixed. Thanks, Yitz
participants (3)
-
Brandon S. Allbery KF8NH
-
Judah Jacobson
-
Yitzchak Gale