Comments (7)
In my case, the issue was just that I didn't have pkg-config
installed. Once I installed it via homebrew (brew install pkg-config
), it went fine.
from mongo-php-driver.
@jmikola FWIW, I also have [email protected]
installed, since it is apparently required by pickle
, but my guess is it was looking for whatever is symlinked from /opt/homebrew/include/openssl
(which happens to be /opt/homebrew/Cellar/openssl@3/3.1.3/include/openssl
)
from mongo-php-driver.
@tgalopin: Can you share a snippet of configure
around line 5242? Please add ~50 lines above and below for additional context.
This should be produced after running phpize
, which is what compiles config.m4
into configure
.
For example, this is what I have locally (with added comments for context):
### PHP_ARG_ENABLE([mongodb-developer-flags], ...)
php_enable_mongodb_developer_flags=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable developer build flags" >&5
printf %s "checking whether to enable developer build flags... " >&6; }
# Check whether --enable-mongodb-developer-flags was given.
if test ${enable_mongodb_developer_flags+y}
then :
enableval=$enable_mongodb_developer_flags; PHP_MONGODB_DEVELOPER_FLAGS=$enableval
else $as_nop
PHP_MONGODB_DEVELOPER_FLAGS=no
fi
ext_output=$PHP_MONGODB_DEVELOPER_FLAGS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ext_output" >&5
printf "%s\n" "$ext_output" >&6; }
### Literally from config.m4
if test "$PHP_MONGODB_DEVELOPER_FLAGS" = "yes"; then
### AX_CHECK_COMPILE_FLAG(-Wmissing-format-attribute, ...)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wmissing-format-attribute" >&5
printf %s "checking whether C compiler accepts -Wmissing-format-attribute... " >&6; }
if test ${ax_cv_check_cflags__Werror__Wmissing_format_attribute+y}
then :
printf %s "(cached) " >&6
else $as_nop
ax_check_save_flags=$CFLAGS
CFLAGS="$CFLAGS -Werror -Wmissing-format-attribute"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ax_cv_check_cflags__Werror__Wmissing_format_attribute=yes
else $as_nop
ax_cv_check_cflags__Werror__Wmissing_format_attribute=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS=$ax_check_save_flags
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__Wmissing_format_attribute" >&5
printf "%s\n" "$ax_cv_check_cflags__Werror__Wmissing_format_attribute" >&6; }
if test "x$ax_cv_check_cflags__Werror__Wmissing_format_attribute" = xyes
then :
_MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmissing-format-attribute"
else $as_nop
:
fi
### AX_CHECK_COMPILE_FLAG(-Wduplicate-enum, ...)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wduplicate-enum" >&5
printf %s "checking whether C compiler accepts -Wduplicate-enum... " >&6; }
That output corresponds to the following in config.m4
:
PHP_ARG_ENABLE([mongodb-developer-flags],
[whether to enable developer build flags],
[AS_HELP_STRING([--enable-mongodb-developer-flags],
[MongoDB: Enable developer flags [default=no]])],
[no],
[no])
if test "$PHP_MONGODB_DEVELOPER_FLAGS" = "yes"; then
dnl Warn about functions which might be candidates for format attributes
AX_CHECK_COMPILE_FLAG(-Wmissing-format-attribute, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmissing-format-attribute" ,, -Werror)
dnl Avoid duplicating values for an enum
AX_CHECK_COMPILE_FLAG(-Wduplicate-enum, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wduplicate-enum" ,, -Werror)
from mongo-php-driver.
@jmikola I am following these instructions to manually compile, and I have homebrew openssl@3
installed, but when I run ./configure --with-mongodb-ssl=openssl --with-openssl-dir=/opt/homebrew/include/openssl
, I get this output
checking whether to enable crypto and TLS... openssl
checking deprecated option for OpenSSL library path... /opt/homebrew/include/openssl
checking for cc options needed to detect all undeclared functions... none needed
configure: checking whether OpenSSL is available
checking for openssl... no
checking for EVP_DigestInit_ex in -lcrypto... no
configure: checking whether OpenSSL >= 1.1.0 is available
checking for OPENSSL_init_ssl in -lssl... no
configure: checking whether OpenSSL < 1.1.0 is available
checking for SSL_library_init in -lssl... no
configure: error: OpenSSL libraries and development headers could not be found
I have verified that everything is installed, and openssl is being used for other packages. Is there something I'm doing wrong?
from mongo-php-driver.
@sedwardsgt: Thanks for the feedback. I think the right call going forward is to simply require pkg-config
when building the extension. The --with-openssl-dir
option was ported from older versions of PHP, and I noted that logic doesn't even exist in PHP 7.4+ (PHP requires pkg-config
itself). I'm not going to spend time investigating this, but my assumption is that the path searching logic was written with OpenSSL 1.x in mind and does not properly detect OpenSSL 3.x.
I've opened PHPC-2309 to track this.
from mongo-php-driver.
Okay I redid the whole thing just to be sure and have more details:
- I'm using PHP 5.6 on macOS (using https://github.com/shivammathur/homebrew-php) due to the app being a legacy we are upgrading
- I'm trying to connect to MongoDB Atlas in Cluster Mode: it works using a local Mongo but fails in non-cluster mode, I guess due to #1463 (and local Mongo not using SSL)
- Therefore I was trying to compile the 1.7.5 version of the driver on my mac, manually passing
--with-mongodb-ssl=openssl
to it so that it could perhaps work locally
Maybe my idea can't work because this legacy version of the driver is not supported on the latest macOS?
I still reproduce the issue with a whole new setup:
./configure: line 5242: syntax error near unexpected token `-Wmissing-format-attribute,'
./configure: line 5242: ` AX_CHECK_COMPILE_FLAG(-Wmissing-format-attribute, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmissing-format-attribute" ,, -Werror)'
@jmikola to answer your question, here are the lines around (with a manually added comment for line 5242):
if test "$PHP_MONGODB" != "no"; then
if test "$ac_cv_prog_cc_c99" = no; then
as_fn_error $? "Compiler does not support C99" "$LINENO" 5
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking PHP version" >&5
printf %s "checking PHP version... " >&6; }
if test -z "$PHP_CONFIG"; then
as_fn_error $? "php-config not found" "$LINENO" 5
fi
PHP_MONGODB_PHP_VERSION=`${PHP_CONFIG} --version`
PHP_MONGODB_PHP_VERSION_ID=`${PHP_CONFIG} --vernum`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PHP_MONGODB_PHP_VERSION" >&5
printf "%s\n" "$PHP_MONGODB_PHP_VERSION" >&6; }
if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70400"; then
as_fn_error $? "not supported. Need a PHP version >= 7.4.0 (found $PHP_MONGODB_PHP_VERSION)" "$LINENO" 5
fi
php_enable_mongodb_developer_flags=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable developer build flags" >&5
printf %s "checking whether to enable developer build flags... " >&6; }
# Check whether --enable-mongodb-developer-flags was given.
if test ${enable_mongodb_developer_flags+y}
then :
enableval=$enable_mongodb_developer_flags; PHP_MONGODB_DEVELOPER_FLAGS=$enableval
else $as_nop
PHP_MONGODB_DEVELOPER_FLAGS=no
fi
ext_output=$PHP_MONGODB_DEVELOPER_FLAGS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ext_output" >&5
printf "%s\n" "$ext_output" >&6; }
if test "$PHP_MONGODB_DEVELOPER_FLAGS" = "yes"; then
# Line 5242:
AX_CHECK_COMPILE_FLAG(-Wmissing-format-attribute, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmissing-format-attribute" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wduplicate-enum, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wduplicate-enum" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wheader-guard, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wheader-guard" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wlogical-not-parentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-not-parentheses" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wlogical-op, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-op" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-fsanitize-address, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fsanitize-address" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-fno-omit-frame-pointer, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-omit-frame-pointer" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-fno-optimize-sibling-calls, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-optimize-sibling-calls" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wlogical-op-parentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-op-parentheses" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wpointer-bool-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wpointer-bool-conversion" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wbool-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wbool-conversion" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wloop-analysis, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wloop-analysis" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wsizeof-array-argument, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wsizeof-array-argument" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wstring-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wstring-conversion" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wno-variadic-macros, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-variadic-macros" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wno-sign-compare, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-sign-compare" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-fstack-protector, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fstack-protector" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-fno-exceptions, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-exceptions" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wformat-security, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wformat-security" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wformat-nonliteral, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wformat-nonliteral" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Winit-self, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Winit-self" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wwrite-strings, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wwrite-strings" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wenum-compare, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wenum-compare" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wempty-body, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wempty-body" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wparentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wparentheses" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wmaybe-uninitialized, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmaybe-uninitialized" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wimplicit-fallthrough, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wimplicit-fallthrough" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Werror, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Werror" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wextra, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wextra" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wno-unused-parameter, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-unused-parameter" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wno-unused-but-set-variable, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-unused-but-set-variable" ,, -Werror)
AX_CHECK_COMPILE_FLAG(-Wno-missing-field-initializers, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-missing-field-initializers",, -Werror)
if test "$PHP_MONGODB_PHP_VERSION_ID" -ge "80108"; then
AX_CHECK_COMPILE_FLAG(-Wstrict-prototypes, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wstrict-prototypes",, -Werror)
fi
MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS"
STD_CFLAGS="-g -O0 -Wall"
fi
php_enable_mongodb_coverage=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable code coverage" >&5
printf %s "checking whether to enable code coverage... " >&6; }
# Check whether --enable-mongodb-coverage was given.
if test ${enable_mongodb_coverage+y}
then :
enableval=$enable_mongodb_coverage; PHP_MONGODB_COVERAGE=$enableval
else $as_nop
PHP_MONGODB_COVERAGE=no
fi
from mongo-php-driver.
PHP 7.2 introduced the AX_CHECK_COMPILE_FLAG
macro in php/php-src@086f9ad. That was later backported into PHP 7.1.2+ and 7.0.16+ in php/php-src@699ab98 (see later comments in php/php-src#2124).
In d785d5e (released in 1.9.0), we replaced the old PHP_CHECK_GCC_ARG
macro in config.m4
with AX_CHECK_COMPILE_FLAG
. Version 1.9.0 of this extension also advertised compatibility with PHP 7.0+, which technically would not have been true; however, I don't believe PECL provides any way to define distinct requirements for different minor versions of PHP. Ideally, we would have required 7.0.16+ and 7.1.2+.
AX_CHECK_COMPILE_FLAG
would be undefined on earlier PHP versions before 7.0.16 and 7.1.2. I'm not certain, but I think that would result in phpize
ignoring the macro entirely, which would explain how it ends up in the configure
script.
That said, you also mentioned building extension version 1.7.5, which predates the introduction of this macro in d785d5e (1.9.0), so I'm not sure what to make of that.
I'm not sure what version of MongoDB you're using in Atlas, but note that version 1.7.5 of the driver was only ever tested with MongoDB 4.2 (see: compatibility tables managed by our docs team). There is no guarantee that it will work for newer server versions. I'm also not in any position to help diagnose build errors for such an old version on the driver with PHP 5.6.
PHP-2280 and the original issue that prompted it (mongodb/mongo-php-library#1145) pertained to macOS 13+. Older versions of the driver (and even libmongoc) would never have been tested with that, and it's quite possible there are other incompatibilities.
If you're obligated to use PHP 5.6, I think the best approach would be to try and get something running in Docker where you have more control over all of the shared libraries (including OpenSSL). Assuming the container is a Linux host, that would also entirely sidestep the issue of the driver preferring Secure Transport during its build process.
from mongo-php-driver.
Related Issues (20)
- MongoDB extension broken on Ubuntu 22.04 (ns_parserr) HOT 3
- Unable to load the extension HOT 3
- Missing windows driver on latest release HOT 3
- PCRE issue when installing mongodb HOT 3
- How to use pecl command to enable the option "--enable-mongodb-crypto-system-profile" ? HOT 7
- Adding configure options for zstd, snappy, zlib? HOT 3
- l
- apache stop when I added extension=mongodb.so to php.ini HOT 3
- `selectServer` takes too long on official php base image (connections opened sequentially) HOT 13
- libbson Bug Report : variable ret value type error HOT 8
- No suitable servers found (`serverSelectionTryOnce` set) when rs.initiate with localhost HOT 5
- Extract mongodb-1.6.2.tgz error HOT 5
- Sporadic "Authentication failed" errors HOT 8
- MongoDB PHP Driver 1.15+ increases PHP memory consumption HOT 7
- Major slowdown since version 1.17.0 HOT 8
- PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb.so' HOT 2
- MongoDB reporting "AuthenticationAbandoned: Overridden by new authentication session" for a PHP client HOT 14
- Windows build after 1.13.0 HOT 4
- linux general protection fault , sorry for my poor english HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongo-php-driver.