-
Notifications
You must be signed in to change notification settings - Fork 206
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
Error while compiling on macOS #1482
Comments
@tgalopin: Can you share a snippet of This should be produced after running 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 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) |
@jmikola I am following these instructions to manually compile, and I have homebrew
I have verified that everything is installed, and openssl is being used for other packages. Is there something I'm doing wrong? |
In my case, the issue was just that I didn't have |
@sedwardsgt: Thanks for the feedback. I think the right call going forward is to simply require I've opened PHPC-2309 to track this. |
@jmikola FWIW, I also have |
Okay I redid the whole thing just to be sure and have more details:
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:
@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 |
PHP 7.2 introduced the In d785d5e (released in 1.9.0), we replaced the old
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. |
Hi!
Following @jmikola's feedback on #1463 (thanks for it!) I tried to compile the extension manually. I stumble a problem I'm not able to find online:
I'm not sure whether this may be due to master not being compilable right now or if it's an actual issue. Any idea?
Thanks!
The text was updated successfully, but these errors were encountered: