I'm having trouble installing a PHP native extension: GnuPG. Here's what I've tried so far.


sudo port install gpgme
sudo pecl install gnupg

Output from the second command ends like so:

checking for gnupg support... yes, shared
checking for gnupg files in default path... not found
configure: error: Please reinstall the gpgme distribution
ERROR: `/private/tmp/pear/temp/gnupg/configure' failed

So, I tried installing manually, guessing at some values based on output of port contents gpgme and port contents gnupg...

pecl download gnupg
./configure --with-gnupg=/opt/local/include --with-libdir=/opt/local/lib

Alas, no luck. This ends like so:

checking for gnupg support... yes, shared
checking for gpgme_check_version in -lgpgme... no
configure: error: wrong gpgme lib version or lib not found

I then tried augmenting CFLAGS like so:

CFLAGS="-L/opt/local/lib" ./configure --with-gnupg=/opt/local/include

This returns a nonzero exit code, but then make fails. Here's the end of that output:

/bin/sh /tmp/gnupg-1.3.2/libtool --mode=link cc -DPHP_ATOM_INC -I/tmp/gnupg-1.3.2/include -I/tmp/gnupg-1.3.2/main -I/tmp/gnupg-1.3.2 -I/Applications/MAMP/bin/php/php5.3.6/include/php -I/Applications/MAMP/bin/php/php5.3.6/include/php/main -I/Applications/MAMP/bin/php/php5.3.6/include/php/TSRM -I/Applications/MAMP/bin/php/php5.3.6/include/php/Zend -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext/date/lib -I/opt/local/include  -DHAVE_CONFIG_H  -L/opt/local/lib   -o gnupg.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/gnupg-1.3.2/modules  gnupg.lo gnupg_keylistiterator.lo -Wl,-rpath,/opt/local/include/lib -L/opt/local/include/lib -lgpgme
cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/gnupg.so -bundle  .libs/gnupg.o .libs/gnupg_keylistiterator.o  -L/opt/local/lib -L/opt/local/include/lib /opt/local/lib/libgpgme.dylib /opt/local/lib/libassuan.dylib /opt/local/lib/libgpg-error.dylib /opt/local/lib/libintl.dylib /opt/local/lib/libiconv.dylib  -Wl,-rpath -Wl,/opt/local/include/lib
ld: warning: directory not found for option '-L/opt/local/include/lib'
ld: duplicate symbol _gnupg_keylistiterator_class_entry in .libs/gnupg_keylistiterator.o and .libs/gnupg.o for architecture x86_64
collect2: ld returned 1 exit status
make: *** [gnupg.la] Error 1

I'm suspicious that my --with-gnupg arg somehow messed up linking, because I see -L/opt/local/include/lib in the output of that failed make run.

That's where I'm stuck. Feels like I'm trying way too hard or just going down the wrong path.

I'm using Snow Leopard (v10.6.8). The PHP command-line program I'm using came with MAMP 2.1.0.


See http://measure9.varkel.net/2013/10/building-gnupg-for-php-5-5-on-osx/ (a lengthy text explaining how to patch & build gnupg from source)

| improve this answer | |
  • Welcome to Ask Different! While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. Answers which consist of nothing but a link may be removed. – grg Apr 29 '14 at 18:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .