Edit report at https://bugs.php.net/bug.php?id=60034&edit=1
ID: 60034
Comment by: boboudreau at gmail dot com
Reported by: notfornoone at gmail dot com
Summary: Build fails with apxs and readline
Status: Open
Type: Bug
Package: Compile Failure
Operating System: OS X (i386-apple-darwin10.8.0)
PHP Version: 5.4SVN-2011-10-10 (snap)
Block user comment: N
Private report: N
New Comment:
I had a similar problem, and this bug came up in my Google search results. To
help anyone else with the solution, I'll post the problem and solution here.
Here's what my build output contained when trying to add '--with-readline':
Undefined symbols:
"_rl_completion_matches", referenced from:
__readline_completion_cb in readline.o
_cli_code_completion in readline_cli.o
"_rl_mark", referenced from:
_rl_mark$non_lazy_ptr in readline.o
"_rl_on_new_line", referenced from:
_zif_readline_on_new_line in readline.o
"_rl_pending_input", referenced from:
_rl_pending_input$non_lazy_ptr in readline.o
"_history_list", referenced from:
_zif_readline_list_history in readline.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
>From what I can tell, the problem building --with-readline on a Mac is that
libreadline.dylib in /usr/lib is not technically the readline library. It's a
symlink to libedit.dylib in the same directory.
So I managed to install another, actual readline library using fink (you could
compile it yourself), and temporarily changed the symlink in /usr/lib:
me:/usr/lib # unlink libreadline.dylib
me:/usr/lib # ln -s /path/to/my/other/libreadlinelib.dylib libreadline.dylib
once that's done, it builds and links. you can put back the old symlink once
you're done:
me:/usr/lib # unlink libreadline.dylib
me:/usr/lib # ln -s libedit.dylib libreadline.dylib
Previous Comments:
------------------------------------------------------------------------
[2012-11-22 07:50:17] phpnet at jigsoft dot co dot za
from nickl:
I can't take all the credit, thanks goes to Areverie who discovered the
solution
and documented it on his blog
http://weblog.areverie.org/blog/2012/03/18/fun-stuff-about-php/ in March of 2012
What he found was that if we move the variable $(MH_BUNDLE_FLAGS) to the end of
the list of compiler flags the build
will succeed.
The submitted patch modifies Makefile.global, the origin of the bug produced
after running the ./configure script.
This now successfully completes make and the resulting php binary reports the
desired extension correctly, as
expected.
readline
Readline Support => enabled
Readline library => 6.2
patch and testing done against PHP 5.4.8 on Mac OS X 10.8.2
nJoy!
------------------------------------------------------------------------
[2011-10-10 22:41:18] notfornoone at gmail dot com
Description:
------------
When compiling on 10.6 with the following configure args the build fails:
./configure '--prefix=/Users/me/Desktop/php54test' '--disable-all' '--with-
apxs2=/usr/sbin/apxs' '--with-readline=/usr/local/Cellar/readline/6.2.1'
make
Fails with this error:
Undefined symbols for architecture x86_64:
"_rl_on_new_line", referenced from:
_zif_readline_on_new_line in readline.o
"_history_list", referenced from:
_zif_readline_list_history in readline.o
"_rl_mark", referenced from:
_zif_readline_info in readline.o
"_rl_pending_input", referenced from:
_zif_readline_info in readline.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1
I've also tried:
* Using an earler version of readline (6.1) fails with the same error
* Compiling on 10.7 Lion results in the same error
* Using the same configure options using the 5.3 branch builds fine
* Compiling with configure options "--with-libedit" enabled instead of the "--
with-readline" option builds fine
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60034&edit=1