php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60034 Build fails with apxs and readline
Submitted: 2011-10-10 22:41 UTC Modified: -
Votes:6
Avg. Score:4.0 ± 0.8
Reproduced:5 of 6 (83.3%)
Same Version:2 (40.0%)
Same OS:3 (60.0%)
From: notfornoone at gmail dot com Assigned:
Status: Open Package: Compile Failure
PHP Version: 5.4SVN-2011-10-10 (snap) OS: OS X (i386-apple-darwin10.8.0)
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-10-10 22:41 UTC] 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



Patches

readline_x86_64_fix (last revision 2012-11-22 07:14 UTC) by phpnet at jigsoft dot co dot za)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-22 07:50 UTC] 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!
 [2012-12-05 05:05 UTC] boboudreau at gmail dot com
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
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC