Subject: | Use readline installed via homebrew on OS X |
Quoting from: http://blogs.perl.org/users/aristotle/2013/07/easy-osx-termreadlinegnu.html
Show quoted text
> If you try to install Term::ReadLine::Gnu on Mac OS X, you will ordinarily run into this
> unpleasantry from the Makefile.PL (which will likely end up in such as ~/.cpanm/build.log):
>
> The libreadline you are using is the libedit library. Use the GNU Readline Library.
This happens because Apple installed libedit using the name libreadline. It happens even
if you have the real GNU readline installed via [homebrew](http://brew.sh); since the homebrew
library will conflict with the one that is part of OS X, homebrew does not link the homebrew
version into any of the standard locations.
The article above suggests forcing homebrew to link the libs into /usr/local, installing the distro,
and then unlinking the libs. While this works, it represents a special case that is ugly to automate.
The attached patch to the Makefile.PL adds a bit of code so that if the platform is darwin and the user
hasn't explicitly specified include and library directories (either explicitly or indirectly via --prefix) then
see if homebrew will provide a prefix for that library (`brew --prefix readline`) and if so, use it to
set RLLIB and RLINC.
I think that the special case is worth including in the Makefile.PL because it enables automated builds
on OS X using the current mainstream tools (e.g. homebrew).
Thanks,
g.
Subject: | bug-report-info.txt |
bash-3.2$ perl -V
Summary of my perl5 (revision 5 version 18 subversion 2) configuration:
Platform:
osname=darwin, osvers=14.0.0, archname=darwin-2level
uname='darwin pub-0mj250 14.0.0 darwin kernel version 14.0.0: fri sep 19 00:26:44 pdt 2014; root:xnu-2782.1.97~2release_x86_64 x86_64 '
config_args='-de -Dprefix=/Users/georgewh/perl5/perlbrew/perls/perl-5.18.2 -Aeval:scriptdir=/Users/georgewh/perl5/perlbrew/perls/perl-5.18.2/bin'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
optimize='-O3',
cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib
libs=-ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL
USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE
USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
Locally applied patches:
Devel::PatchPerl 1.32
Built under darwin
Compiled at Apr 6 2015 10:27:10
%ENV:
PERLBREW_BASHRC_VERSION="0.73"
PERLBREW_HOME="/Users/georgewh/.perlbrew"
PERLBREW_MANPATH="/Users/georgewh/perl5/perlbrew/perls/perl-5.18.2/man"
PERLBREW_PATH="/Users/georgewh/perl5/perlbrew/bin:/Users/georgewh/perl5/perlbrew/perls/perl-5.18.2/bin"
PERLBREW_PERL="perl-5.18.2"
PERLBREW_ROOT="/Users/georgewh/perl5/perlbrew"
PERLBREW_VERSION="0.73"
@INC:
/Users/georgewh/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/darwin-2level
/Users/georgewh/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2
/Users/georgewh/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/darwin-2level
/Users/georgewh/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2
.
bash-3.2$ perl Makefile.PL.ORIG verbose
Found `/usr/lib/libtermcap.dylib'.
cc -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -DHAVE_STRING_H rlver.c -o rlver -fstack-protector -L/usr/local/lib -lreadline -ltermcap
rlver.c:4:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main() { puts(rl_library_version); }
^
1 warning generated.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The libreadline you are using is the libedit library. Use the GNU Readline Library.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Subject: | patch-Makefile.PL |
--- Makefile.PL.ORIG 2015-05-12 12:31:48.000000000 -0700
+++ Makefile.PL 2015-05-12 14:15:53.000000000 -0700
@@ -57,6 +57,18 @@
$defs .= ' -DOS2_USEDLL';
$lddflags = '';
} else {
+ # if user hasn't provided RLLIB or RLINC....
+ # OS X uses libedit, but they've named it libreadline...
+ # see if user has installed gnu readline via homebrew
+ if ($Config{osname} eq 'darwin' && !($RLLIB || $RLINC)) {
+ my $homebrew_prefix = `brew --prefix readline`;
+ if ($homebrew_prefix) {
+ chomp $homebrew_prefix;
+ $RLLIB = "-L$homebrew_prefix/lib";
+ $RLINC = "-I$homebrew_prefix/include";
+ }
+ }
+
# Search libtermcap, libncurses, or libcurses in this order.
# I emulate the behavior of the configure script for bash, and don't
# know why AIX prefers curses.