Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to upgrade PHP on my Mac. I have downloaded PHP 5.4.14 and have no problems with the configuration command:

./configure \
 --prefix=/usr \
 --mandir=/usr/share/man \
 --infodir=/usr/share/info \
 --sysconfdir=/private/etc \
 --with-apxs2=/usr/sbin/apxs \
 --enable-cli \
 --with-config-file-path=/etc \
 --with-libxml-dir=/usr \
 --with-openssl=/usr \
 --with-kerberos=/usr \
 --with-zlib=/usr \
 --enable-bcmath \
 --with-bz2=/usr \
 --enable-calendar \
 --with-curl=/usr \
 --enable-dba \
 --enable-exif \
 --enable-ftp \
 --with-gd \
 --with-freetype-dir=/usr/X11 \
 --with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-66.6~1/Root/usr/local \
 --with-png-dir=/usr/X11 \
 --enable-gd-native-ttf \
 --with-icu-dir=/usr \
 --with-iodbc=/usr \
 --with-ldap=/usr \
 --with-ldap-sasl=/usr \
 --with-libedit=/usr \
 --enable-mbstring \
 --enable-mbregex \
 --with-mysql=mysqlnd \
 --with-mysqli=mysqlnd \
 --without-pear \
 --with-pdo-mysql=mysqlnd \
 --with-mysql-sock=/var/mysql/mysql.sock \
 --with-readline=/usr \
 --enable-shmop \
 --with-snmp=/usr \
 --enable-soap \
 --enable-sockets \
 --enable-sysvmsg \
 --enable-sysvsem \
 --enable-sysvshm \
 --with-tidy \
 --enable-wddx \
 --with-xmlrpc \
 --without-iconv \
 --with-xsl=/usr \
 --enable-zip \
 --with-pcre-regex=/usr \
 --with-pgsql=/usr \
 --with-pdo-pgsql=/usr

When I do a make test I get a long slew of stuff with the following at the end:

Undefined symbols for architecture x86_64:
  "_php_pcre_compile", referenced from:
      _pcre_get_compiled_regex_cache in php_pcre.o
  "_php_pcre_exec", referenced from:
      _php_pcre_grep_impl in php_pcre.o
      _php_pcre_replace_impl in php_pcre.o
      _php_pcre_match_impl in php_pcre.o
      _php_pcre_split_impl in php_pcre.o
      _check_fmt in softmagic.o
      _php_filter_validate_email in logical_filters.o
      _php_filter_validate_regexp in logical_filters.o
      ...
  "_php_pcre_free", referenced from:
      _php_pcre_match_impl in php_pcre.o
  "_php_pcre_fullinfo", referenced from:
      _pcre_get_compiled_regex_cache in php_pcre.o
      _php_pcre_grep_impl in php_pcre.o
      _make_subpats_table in php_pcre.o
      _php_pcre_replace_impl in php_pcre.o
      _php_pcre_match_impl in php_pcre.o
      _php_pcre_split_impl in php_pcre.o
  "_php_pcre_get_substring_list", referenced from:
      _php_pcre_match_impl in php_pcre.o
  "_php_pcre_maketables", referenced from:
      _pcre_get_compiled_regex_cache in php_pcre.o
  "_php_pcre_study", referenced from:
      _pcre_get_compiled_regex_cache in php_pcre.o
  "_php_pcre_version", referenced from:
      _zm_info_pcre in php_pcre.o
      _zm_startup_pcre in php_pcre.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libs/libphp5.bundle] Error 1

I have updated PCRE on the system to version 8.32, and I require it due to some zlib dependencies amongst other things and general perl regular expression stuff. I'm at a loss as to why my make test won't pass.

Any help would be appreciated to fix this problem.

share|improve this question

migrated from serverfault.com Apr 15 '13 at 4:37

This question came from our site for professional system and network administrators.

    
Have you tried compiling with PCRE as a shared library? --with-pcre-regex=shared,/usr. You may need to make clean first. –  emcconville Apr 15 '13 at 19:16
    
No I have not tried that, but I will! As a side note, can you briefly explain, or point me to a specific resource that discusses why this might be the case? –  Mike Kormendy Apr 16 '13 at 4:48
    
I just did the make clean and then modified the configure command, the output said this: checking for PCRE headers location... configure: error: Could not find pcre.h in shared,/usr –  Mike Kormendy Apr 16 '13 at 4:59
    
I've found some libraries are already on OS X but w/o the header files. The shared,/path option allows extensions to use the systems pre-installed library. For PCRE, the --with-prec-refex my not be needed as PCRE is included with php-5.3+. Where is PCRE-8.32 installed? You can locate it by executing pcre-config --prefix and use the return path as the --with-prec-refex argument. –  emcconville Apr 16 '13 at 13:50
    
I am altogether not going to try and include the configure command --with-pcre-regex and see if that works. –  Mike Kormendy Apr 16 '13 at 15:49
show 1 more comment

1 Answer

up vote 2 down vote accepted

Option 1

Simply remove the --with-pcre-regex options. Modern version of PHP ship with PCRE library (located in ext/pcre/pcrelib), and is considered part of the core PHP build.

From php.net,

Note:

As of PHP 5.3.0 this extension cannot be disabled and is therefore always present.

It is still possible to build against an external PCRE library by using --with-pcre-regex=DIR

Option 2

As the note above states, you can build PHP with an external PCRE library. To do so, updated the --with-pcre-regex option with value returned by pcre-config --prefix.

share|improve this answer
    
Typo: "To do so, update the --w**i**th-pcre-regex option with value returned by pcre-config --prefix." –  Mike Kormendy Apr 18 '13 at 15:57
    
Thanks, good catch. Typo removed –  emcconville Apr 18 '13 at 16:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.