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

Version 1.3.0 fails to build against Docker php:7.1-fpm-alpine #655

Closed
fabschurt opened this issue Sep 21, 2017 · 12 comments
Closed

Version 1.3.0 fails to build against Docker php:7.1-fpm-alpine #655

fabschurt opened this issue Sep 21, 2017 · 12 comments
Labels

Comments

@fabschurt
Copy link

fabschurt commented Sep 21, 2017

Hey folks,

So it seems that the newest 1.3.0 version fails to compile on Docker php:7.1-fpm-alpine image. Here’s my environment:

~ # docker version

Client:
 Version:      17.06.0-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:31:53 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.06.0-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:51:55 2017
 OS/Arch:      linux/amd64
 Experimental: false

And here’s how to replicate (theoretically):

docker run --rm -ti php:7.1-fpm-alpine sh
apk add --no-cache autoconf g++ make
pecl install mongodb

And here’s the resulting build log:

downloading mongodb-1.3.0.tgz ...
Starting to download mongodb-1.3.0.tgz (927,842 bytes)
..................................done: 927,842 bytes
417 source files, building
running: phpize
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
building in /tmp/pear/temp/pear-build-defaultuserPfnima/mongodb-1.3.0
running: /tmp/pear/temp/mongodb/configure --with-php-config=/usr/local/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -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
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20160303
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable mongodb support... yes, shared
checking OpenSSL dir for mongodb... yes
checking whether to use system default cipher list instead of hardcoded value... no
checking PHP version... 70109
/tmp/pear/temp/mongodb/configure: ./configure.lineno: line 1: syntax error: unterminated quoted string
ERROR: `/tmp/pear/temp/mongodb/configure --with-php-config=/usr/local/bin/php-config' failed

Installing mongodb-1.2.11 still works fine.

I would have been glad to submit a PR rather than an issue, but my C skills are unfortunately inexistant. Of course let me know if you need more details about the error.

@fabschurt
Copy link
Author

fabschurt commented Sep 21, 2017

Okay folks, apparently the problem only occurs when Bash is not installed. I guess this is not a problem on most environments, except on minimalistic distros like Alpine which don’t have Bash installed by default. I guess we can close this?

@jmikola
Copy link
Member

jmikola commented Sep 21, 2017

The configure script is generated by config.m4, so let's compare that file's changes between 1.2.11 and 1.3.0:

diff --git a/config.m4 b/config.m4
index d25a1fa..556fb6c 100644
--- a/config.m4
+++ b/config.m4
@@ -153,19 +153,30 @@ if test "$MONGODB" != "no"; then
     php_phongo.c \
     phongo_compat.c \
     src/bson.c \
+    src/bson-encode.c \
     src/BSON/Binary.c \
+    src/BSON/BinaryInterface.c \
     src/BSON/Decimal128.c \
+    src/BSON/Decimal128Interface.c \
     src/BSON/Javascript.c \
+    src/BSON/JavascriptInterface.c \
     src/BSON/MaxKey.c \
+    src/BSON/MaxKeyInterface.c \
     src/BSON/MinKey.c \
-    src/BSON/ObjectID.c \
+    src/BSON/MinKeyInterface.c \
+    src/BSON/ObjectId.c \
+    src/BSON/ObjectIdInterface.c \
     src/BSON/Persistable.c \
     src/BSON/Regex.c \
+    src/BSON/RegexInterface.c \
     src/BSON/Serializable.c \
     src/BSON/Timestamp.c \
+    src/BSON/TimestampInterface.c \
     src/BSON/Type.c \
     src/BSON/Unserializable.c \
     src/BSON/UTCDateTime.c \
+    src/BSON/UTCDateTimeInterface.c \
+    src/BSON/functions.c \
     src/MongoDB/BulkWrite.c \
     src/MongoDB/Command.c \
     src/MongoDB/Cursor.c \
@@ -191,6 +202,12 @@ if test "$MONGODB" != "no"; then
     src/MongoDB/Exception/SSLConnectionException.c \
     src/MongoDB/Exception/UnexpectedValueException.c \
     src/MongoDB/Exception/WriteException.c \
+    src/MongoDB/Monitoring/CommandFailedEvent.c \
+    src/MongoDB/Monitoring/CommandStartedEvent.c \
+    src/MongoDB/Monitoring/CommandSubscriber.c \
+    src/MongoDB/Monitoring/CommandSucceededEvent.c \
+    src/MongoDB/Monitoring/Subscriber.c \
+    src/MongoDB/Monitoring/functions.c
   "
 
   PHP_ARG_WITH(libbson, whether to use system libbson,
@@ -206,13 +223,13 @@ if test "$MONGODB" != "no"; then
     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
     AC_MSG_CHECKING(for libbson)
     if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libbson-1.0; then
-      if $PKG_CONFIG libbson-1.0 --atleast-version 1.5.0; then
+      if $PKG_CONFIG libbson-1.0 --atleast-version 1.8.0; then
         LIBBSON_INC=`$PKG_CONFIG libbson-1.0 --cflags`
         LIBBSON_LIB=`$PKG_CONFIG libbson-1.0 --libs`
         LIBBSON_VER=`$PKG_CONFIG libbson-1.0 --modversion`
         AC_MSG_RESULT(version $LIBBSON_VER found)
       else
-        AC_MSG_ERROR(system libbson must be upgraded to version >= 1.5.0)
+        AC_MSG_ERROR(system libbson must be upgraded to version >= 1.8.0)
       fi
     else
       AC_MSG_ERROR(pkgconfig and libbson must be installed)
@@ -226,11 +243,11 @@ if test "$MONGODB" != "no"; then
     # Generated with: find src/libbson/src/bson -name '*.c' -print0 | cut -sz -d / -f 5- | sort -z | tr '\000' ' '
     PHP_MONGODB_BSON_SOURCES="bcon.c bson-atomic.c bson.c bson-clock.c bson-context.c bson-decimal128.c bson-error.c bson-iso8601.c bson-iter.c bson-json.c bson-keys.c bson-md5.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-version-functions.c bson-writer.c"
 
-    # Generated with: find src/libbson/src/yajl -name '*.c' -print0 | cut -sz -d / -f 5- | sort -z | tr '\000' ' '
-    PHP_MONGODB_YAJL_SOURCES="yajl_alloc.c yajl_buf.c yajl.c yajl_encode.c yajl_gen.c yajl_lex.c yajl_parser.c yajl_tree.c yajl_version.c"
+    # Generated with: find src/libbson/src/jsonsl -name '*.c' -print0 | cut -sz -d / -f 5- | sort -z | tr '\000' ' '
+    PHP_MONGODB_JSONSL_SOURCES="jsonsl.c"
 
     PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/bson], $PHP_MONGODB_BSON_SOURCES, $PHP_MONGODB_BSON_CFLAGS, shared_objects_mongodb, yes)
-    PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/yajl], $PHP_MONGODB_YAJL_SOURCES, $PHP_MONGODB_BSON_CFLAGS, shared_objects_mongodb, yes)
+    PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/jsonsl], $PHP_MONGODB_JSONSL_SOURCES, $PHP_MONGODB_BSON_CFLAGS, shared_objects_mongodb, yes)
   fi
 
   AC_MSG_CHECKING(configuring libmongoc)
@@ -244,14 +261,14 @@ if test "$MONGODB" != "no"; then
     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
     AC_MSG_CHECKING(for libmongoc)
     if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongoc-1.0; then
-      if $PKG_CONFIG libmongoc-1.0 --atleast-version 1.5.0; then
+      if $PKG_CONFIG libmongoc-1.0 --atleast-version 1.8.0; then
         LIBMONGOC_INC=`$PKG_CONFIG libmongoc-1.0 --cflags`
         LIBMONGOC_LIB=`$PKG_CONFIG libmongoc-1.0 --libs`
         LIBMONGOC_VER=`$PKG_CONFIG libmongoc-1.0 --modversion`
         AC_MSG_RESULT(version $LIBMONGOC_VER found)
 
       else
-        AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.5.0)
+        AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.8.0)
       fi
     else
       AC_MSG_ERROR(pkgconfig and mongoc must be installed)
@@ -262,8 +279,8 @@ if test "$MONGODB" != "no"; then
   else
     PHP_MONGODB_MONGOC_CFLAGS="$STD_CFLAGS -DMONGOC_COMPILATION -DMONGOC_TRACE"
 
-    # Generated with: find src/libmongoc/src/mongoc -name '*.c' -print0 | cut -sz -d / -f 4- | sort -z | tr '\000' ' '
-    PHP_MONGODB_MONGOC_SOURCES="mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-b64.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-client.c mongoc-client-pool.c mongoc-cluster.c mongoc-collection.c mongoc-counters.c mongoc-crypto.c mongoc-crypto-cng.c mongoc-crypto-common-crypto.c mongoc-crypto-openssl.c mongoc-cursor-array.c mongoc-cursor.c mongoc-cursor-cursorid.c mongoc-cursor-transform.c mongoc-database.c mongoc-find-and-modify.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-list.c mongoc-gridfs-file-page.c mongoc-handshake.c mongoc-host-list.c mongoc-index.c mongoc-init.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.c mongoc-memcmp.c mongoc-opcode.c mongoc-openssl.c mongoc-queue.c mongoc-rand-cng.c mongoc-rand-common-crypto.c mongoc-rand-openssl.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-sasl.c mongoc-scram.c mongoc-secure-channel.c mongoc-secure-transport.c mongoc-server-description.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-ssl.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-socket.c mongoc-stream-tls.c mongoc-stream-tls-libressl.c mongoc-stream-tls-openssl-bio.c mongoc-stream-tls-openssl.c mongoc-stream-tls-secure-channel.c mongoc-stream-tls-secure-transport.c mongoc-topology.c mongoc-topology-description-apm.c mongoc-topology-description.c mongoc-topology-scanner.c mongoc-uri.c mongoc-util.c mongoc-version-functions.c mongoc-write-command.c mongoc-write-concern.c"
+    # Generated with: find src/libmongoc/src/mongoc -name '*.c' -print0 | cut -sz -d / -f 5- | sort -z | tr '\000' ' '
+    PHP_MONGODB_MONGOC_SOURCES="mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-b64.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-client.c mongoc-client-pool.c mongoc-cluster.c mongoc-cluster-cyrus.c mongoc-cluster-gssapi.c mongoc-cluster-sasl.c mongoc-cluster-sspi.c mongoc-cmd.c mongoc-collection.c mongoc-compression.c mongoc-counters.c mongoc-crypto.c mongoc-crypto-cng.c mongoc-crypto-common-crypto.c mongoc-crypto-openssl.c mongoc-cursor-array.c mongoc-cursor.c mongoc-cursor-cursorid.c mongoc-cursor-transform.c mongoc-cyrus.c mongoc-database.c mongoc-find-and-modify.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-list.c mongoc-gridfs-file-page.c mongoc-gssapi.c mongoc-handshake.c mongoc-host-list.c mongoc-index.c mongoc-init.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.c mongoc-memcmp.c mongoc-openssl.c mongoc-queue.c mongoc-rand-cng.c mongoc-rand-common-crypto.c mongoc-rand-openssl.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-sasl.c mongoc-scram.c mongoc-secure-channel.c mongoc-secure-transport.c mongoc-server-description.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-ssl.c mongoc-sspi.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-socket.c mongoc-stream-tls.c mongoc-stream-tls-libressl.c mongoc-stream-tls-openssl-bio.c mongoc-stream-tls-openssl.c mongoc-stream-tls-secure-channel.c mongoc-stream-tls-secure-transport.c mongoc-topology.c mongoc-topology-description-apm.c mongoc-topology-description.c mongoc-topology-scanner.c mongoc-uri.c mongoc-util.c mongoc-version-functions.c mongoc-write-command.c mongoc-write-concern.c"
 
     PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $PHP_MONGODB_MONGOC_SOURCES, $PHP_MONGODB_MONGOC_CFLAGS, shared_objects_mongodb, yes)
 
@@ -271,6 +288,7 @@ if test "$MONGODB" != "no"; then
     AC_SUBST(MONGOC_ENABLE_SSL, 0)
     AC_SUBST(MONGOC_ENABLE_CRYPTO_LIBCRYPTO, 0)
     AC_SUBST(MONGOC_ENABLE_SSL_OPENSSL, 0)
+    AC_SUBST(MONGOC_HAVE_ASN1_STRING_GET0_DATA, 0)
 
     PHP_SETUP_OPENSSL(MONGODB_SHARED_LIBADD, [
       AC_SUBST(MONGOC_ENABLE_CRYPTO, 1)
@@ -296,58 +314,64 @@ if test "$MONGODB" != "no"; then
     AC_SUBST(MONGOC_ENABLE_SSL_LIBRESSL, 0)
 
     AC_SUBST(MONGOC_NO_AUTOMATIC_GLOBALS, 1)
-  fi
 
+    AC_CHECK_TYPE([socklen_t], [AC_SUBST(MONGOC_HAVE_SOCKLEN, 1)], [AC_SUBST(MONGOC_HAVE_SOCKLEN, 0)], [#include <sys/socket.h>])
 
-PHP_ARG_WITH(mongodb-sasl, for Cyrus SASL support,
-[  --with-mongodb-sasl[=DIR]     mongodb: Include Cyrus SASL support], auto, no)
+    AC_SUBST(MONGOC_ENABLE_COMPRESSION_SNAPPY, 0)
+    AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZLIB, 0)
+    AC_SUBST(MONGOC_ENABLE_COMPRESSION, 0)
+  fi
 
-if test "$PHP_MONGODB_SASL" != "no"; then
-  AC_MSG_CHECKING(for SASL)
-  for i in $PHP_MONGODB_SASL /usr /usr/local; do
-    if test -f $i/include/sasl/sasl.h; then
-      MONGODB_SASL_DIR=$i
-      AC_MSG_RESULT(found in $i)
-      break
-    fi
-  done
 
-  if test -z "$MONGODB_SASL_DIR"; then
-    AC_MSG_RESULT(not found)
-    if test "$PHP_MONGODB_SASL" != "auto"; then
-      AC_MSG_ERROR([sasl.h not found!])
-    else
-      AC_SUBST(MONGOC_ENABLE_SASL, 0)
-      AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 0)
-    fi
-  else
+  PHP_ARG_WITH(mongodb-sasl, for Cyrus SASL support,
+  [  --with-mongodb-sasl[=DIR]     mongodb: Include Cyrus SASL support], auto, no)
 
-    PHP_CHECK_LIBRARY(sasl2, sasl_version,
-    [
-      PHP_ADD_INCLUDE($MONGODB_SASL_DIR)
-      PHP_ADD_LIBRARY_WITH_PATH(sasl2, $MONGODB_SASL_DIR/$PHP_LIBDIR, MONGODB_SHARED_LIBADD)
-      AC_SUBST(MONGOC_ENABLE_SASL, 1)
-    ], [
-      if test "$MONGODB_SASL" != "auto"; then
-        AC_MSG_ERROR([MongoDB SASL check failed. Please check config.log for more information.])
+  AC_SUBST(MONGOC_ENABLE_SASL, 0)
+  AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 0)
+  AC_SUBST(MONGOC_ENABLE_SASL_CYRUS, 0)
+  AC_SUBST(MONGOC_ENABLE_SASL_SSPI, 0)
+  AC_SUBST(MONGOC_ENABLE_SASL_GSSAPI, 0)
+
+  if test "$PHP_MONGODB_SASL" != "no"; then
+    AC_MSG_CHECKING(for SASL)
+    for i in $PHP_MONGODB_SASL /usr /usr/local; do
+      if test -f $i/include/sasl/sasl.h; then
+        MONGODB_SASL_DIR=$i
+        AC_MSG_RESULT(found in $i)
+        break
       fi
-      AC_SUBST(MONGOC_ENABLE_SASL, 0)
-    ], [
-      -L$MONGODB_SASL_DIR/$PHP_LIBDIR
-    ])
+    done
 
-    PHP_CHECK_LIBRARY(sasl2, sasl_client_done,
-    [
-      AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 1)
-    ], [
-      AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 0)
-    ])
+    if test -z "$MONGODB_SASL_DIR"; then
+      AC_MSG_RESULT(not found)
+      if test "$PHP_MONGODB_SASL" != "auto"; then
+        AC_MSG_ERROR([sasl.h not found!])
+      fi
+    else
+
+      PHP_CHECK_LIBRARY(sasl2, sasl_version,
+      [
+        PHP_ADD_INCLUDE($MONGODB_SASL_DIR)
+        PHP_ADD_LIBRARY_WITH_PATH(sasl2, $MONGODB_SASL_DIR/$PHP_LIBDIR, MONGODB_SHARED_LIBADD)
+        AC_SUBST(MONGOC_ENABLE_SASL, 1)
+        AC_SUBST(MONGOC_ENABLE_SASL_CYRUS, 1)
+      ], [
+        if test "$MONGODB_SASL" != "auto"; then
+          AC_MSG_ERROR([MongoDB SASL check failed. Please check config.log for more information.])
+        fi
+      ], [
+        -L$MONGODB_SASL_DIR/$PHP_LIBDIR
+      ])
+
+      PHP_CHECK_LIBRARY(sasl2, sasl_client_done,
+      [
+        AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 1)
+      ])
+    fi
   fi
-else
-  AC_SUBST(MONGOC_ENABLE_SASL, 0)
-  AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 0)
-fi
 
+  m4_include(src/libmongoc/build/autotools/m4/ax_prototype.m4)
+  m4_include(src/libmongoc/build/autotools/CheckCompiler.m4)
   m4_include(src/libmongoc/build/autotools/WeakSymbols.m4)
   m4_include(src/libmongoc/build/autotools/m4/ax_pthread.m4)
   AX_PTHREAD
@@ -371,10 +395,12 @@ fi
   PHP_ADD_INCLUDE([$ext_srcdir/src/BSON/])
   PHP_ADD_INCLUDE([$ext_srcdir/src/MongoDB/])
   PHP_ADD_INCLUDE([$ext_srcdir/src/MongoDB/Exception/])
+  PHP_ADD_INCLUDE([$ext_srcdir/src/MongoDB/Monitoring/])
   PHP_ADD_INCLUDE([$ext_srcdir/src/contrib/])
   PHP_ADD_BUILD_DIR([$ext_builddir/src/BSON/])
   PHP_ADD_BUILD_DIR([$ext_builddir/src/MongoDB/])
   PHP_ADD_BUILD_DIR([$ext_builddir/src/MongoDB/Exception/])
+  PHP_ADD_BUILD_DIR([$ext_builddir/src/MongoDB/Monitoring/])
   PHP_ADD_BUILD_DIR([$ext_builddir/src/contrib/])
   if test "$PHP_LIBMONGOC" == "no"; then
     PHP_ADD_INCLUDE([$ext_srcdir/src/libmongoc/src/mongoc/])
@@ -387,10 +413,10 @@ fi
     m4_include(src/libbson/build/autotools/m4/ac_create_stdint_h.m4)
     AC_CREATE_STDINT_H([$srcdir/src/libbson/src/bson/bson-stdint.h])
     PHP_ADD_INCLUDE([$ext_srcdir/src/libbson/src/])
-    PHP_ADD_INCLUDE([$ext_srcdir/src/libbson/src/yajl/])
+    PHP_ADD_INCLUDE([$ext_srcdir/src/libbson/src/jsonsl/])
     PHP_ADD_INCLUDE([$ext_srcdir/src/libbson/src/bson/])
     PHP_ADD_BUILD_DIR([$ext_builddir/src/libbson/src/])
-    PHP_ADD_BUILD_DIR([$ext_builddir/src/libbson/src/yajl/])
+    PHP_ADD_BUILD_DIR([$ext_builddir/src/libbson/src/jsonsl/])
     PHP_ADD_BUILD_DIR([$ext_builddir/src/libbson/src/bson/])
   fi

Apologies for the lengthy paste, but GitHub wouldn't allow me to attach a .diff file. I believe this may be due to a missing backslash for the last filename in the list of PHP_MONGODB_SOURCES:

+    src/MongoDB/Monitoring/Subscriber.c \
+    src/MongoDB/Monitoring/functions.c
   "

When configure is generated, this list is printed as-is in the script. Since the line doesn't end with a trailing backslash, the string likely ends right there. Bash seems to happily ignore this error, but Alpine's shell is more strict and rightly complains about an unterminated string.

Would you mind downloading the 1.3.0 sources (pecl download mongodb-1.3.0), adding a trailing \ after src/MongoDB/Monitoring/functions.c, and attempting to recompile with phpize; ./configure; make?

@jmikola jmikola added the bug label Sep 21, 2017
@jmikola
Copy link
Member

jmikola commented Sep 21, 2017

Tracking in PHPC-1014.

@fabschurt
Copy link
Author

Hey @jmikola, so I tried the solution you proposed but unfortunately it didn’t work. I tested this separately (a multi-line string with no backslash after the last word) with sh and it doesn’t seem to cause any problem, so I guess the source of the bug is to be found elsewhere.

I think I might be on to something though. There’s the following code in the generated configure script (line 4360 on my side):

if test "$MONGODB" != "no"; then

php_enable_developer_flags=no

(I guess it matches these lines in config.m4.)

If I add a exit 1 right over this:

exit 1
if test "$MONGODB" != "no"; then

php_enable_developer_flags=no

…the error doesn’t show up, but if I move the exit statement right below like this:

if test "$MONGODB" != "no"; then
exit 1

php_enable_developer_flags=no

…the error pops up and the script crashes. So the problem may come from this if statement, but I can’t really see anything wrong with, so I don’ know. If I comment the suspected line:

#if test "$MONGODB" != "no"; then

php_enable_developer_flags=no

…then the error doesn’t show up anymore, and the script goes on normally.

WTF? ^^ I’ll keep on trying to find the source of the problem, but right now I’m kind of out of ideas.

@jmikola
Copy link
Member

jmikola commented Sep 22, 2017

With the help of the shellcheck tool, I was able to narrow things down to mongodb/mongo-c-driver@d4f67c4 and mongodb/libbson@e07f7b8, which we include in config.m4.

I'll follow up with @ajdavis about this.

@jmikola
Copy link
Member

jmikola commented Sep 22, 2017

CDRIVER-2297 has been merged and should be released as libbson and libmongoc 1.8.1. Once those are released, I'll follow up with a 1.3.1 release of the PHP driver that bumps its bundled dependencies.

Thanks very much for reporting this and spending the time on your end to investigate!

@fabschurt
Copy link
Author

@jmikola That’s great ! 👍 🎉 Thank you for your time and responsiveness on this, really appreciated 🙇

@galindro
Copy link

galindro commented Sep 26, 2017

@jmikola / @fabschurt in the meantime, until the 1.3.1 release isn't published, the workaround is to install bash?

@darkSasori

@fabschurt
Copy link
Author

@galindro Yep, exactly. Normally, installing Bash on Alpine replaces the default sh shell right away, no need to relaunch a shell session.

@olvlvl
Copy link

olvlvl commented Sep 30, 2017

I hope this gets fixed soon 🙏

@jmikola
Copy link
Member

jmikola commented Oct 2, 2017

Unfortunately, this is still waiting on libmongoc 1.8.1. Once that's released, we'll be able to tag 1.3.1 of the PHP extension with the dependency bump.

@jmikola
Copy link
Member

jmikola commented Oct 16, 2017

1.3.1 has been released with a fixed version of libmongoc 1.8.1. Sorry for the delay on this.

@jmikola jmikola closed this as completed Oct 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants