Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilation error when sasl.h is missing #341

Closed
grikdotnet opened this issue May 1, 2017 · 5 comments
Closed

compilation error when sasl.h is missing #341

grikdotnet opened this issue May 1, 2017 · 5 comments
Milestone

Comments

@grikdotnet
Copy link

grikdotnet commented May 1, 2017

Error compiling memcached extension even having sasl disabled in configure.

# pecl download redis memcached
# cd memcached-3.0.3/
# phpize
 # ./configure --disable-memcached-sasl
...
checking for libmemcached... yes, shared
checking whether to enable memcached session handler support... yes
checking whether to enable memcached igbinary serializer support... no
checking whether to enable memcached json serializer support... no
checking whether to enable memcached msgpack serializer support... no
checking whether to enable memcached sasl support... no
checking whether to enable memcached protocol support... no
...
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
# make
...
 cc -I/usr/local/include/php -I. -I/usr/local/memcached-3.0.3 -DPHP_ATOM_INC -I/usr/local/memcached-3.0.3/include -I/usr/local/memcached-3.0.3/main -I/usr/local/memcached-3.0.3 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -c /usr/local/memcached-3.0.3/php_memcached.c  -fPIC -DPIC -o .libs/php_memcached.o
In file included from /usr/include/libmemcached-1.0/memcached.h:85:0,
                 from /usr/include/libmemcached/memcached.h:39,
                 from /usr/local/memcached-3.0.3/php_libmemcached_compat.h:21,
                 from /usr/local/memcached-3.0.3/php_memcached_private.h:28,
                 from /usr/local/memcached-3.0.3/php_memcached.c:25:
/usr/include/libmemcached-1.0/struct/sasl.h:39:23: fatal error: sasl/sasl.h: No such file or directory
compilation terminated.
Makefile:194: recipe for target 'php_memcached.lo' failed
make: *** [php_memcached.lo] Error 1

For some reason there is an unconditional #include <libmemcached-1.0/struct/sasl.h> in memcached.h

OS: Alpine linux 3.4.6

@runphp
Copy link

runphp commented Nov 18, 2017

I have the same problem, this config was ok

ENV MEMCACHED_VERSION=3.0.3
# compile memcached extension
ENV MEMCACHED_DEPS zlib-dev libmemcached-dev cyrus-sasl-dev
RUN set -xe \
    && apk add --no-cache libmemcached-libs zlib \
    && apk add --no-cache --virtual .memcached-deps $MEMCACHED_DEPS \
    && curl -fsSL http://pecl.php.net/get/memcached-${MEMCACHED_VERSION}.tgz -o memcached.tar.gz \
    && mkdir -p /tmp/memcached \
    && tar -xf memcached.tar.gz -C /tmp/memcached --strip-components=1 \
    && rm memcached.tar.gz \
    && docker-php-ext-configure /tmp/memcached --enable-memcached \
    && docker-php-ext-install /tmp/memcached \
    && rm -r /tmp/memcached

@lt
Copy link

lt commented Dec 15, 2017

This is not a bug/issue with the php-memached extension itself. Regardless of --disable-memcached-sasl being set, it's for toggling behaviour in the PHP extension, and has no effect on the headers provided by libmemached-dev.

You're going to need to satisfy the dependency to build, even if you opt-out of the functionality in the extension itself.

apk add cyrus-sasl-dev

@grikdotnet
Copy link
Author

Got it. So, the bug is a missing check for sasl.h in a configure script.

@lt
Copy link

lt commented Dec 16, 2017

@grikdotnet No, sorry I realise I could have worded it better. There is no bug,

The provided libmemcached header that contains all of the function definitions to link against the libmemcached library has a hard dependency on sasl.h.

The compiler needs to know what is in that file (it could be anything!), even if you don't use what is in that file, it needs to know what is in it just in case.

This is not a bug, it is a missing build dependency on your side.

@grikdotnet
Copy link
Author

One of a configure script goals is to check dependencies. Whether you accept that this missing dependency check is a bug or not, does not matter. It is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants