Skip to content

PHPC-2270 and PHPC-2271: Bump to libmongoc 1.24.3 and update build configuration #1458

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

Merged
merged 3 commits into from
Aug 15, 2023

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Aug 10, 2023

jmikola added 3 commits August 7, 2023 17:43
…1.24

This removes old logic to not define _DEFAULT_SOURCE on Windows (technically MinGW or Cygwin). It's not clear whether that was ever necessary; it was introduced in ab44b0c based on upstream work in mongodb/mongo-c-driver@9d2d8b1, but libmongoc did not utilize the same logic.

In any event, these constants are now defined unconditionally for libmongoc since mongodb/mongo-c-driver@c520651, so this change should restore parity between PHPC's autoconf and libmongoc's CMake configurations.
The recent additions to PlatformFlags.m4 should be sufficient.

It's not clear what purpose this originally served. It dates back to mongodb/libbson@83ae5d2 (before libbson was consolidated with libmongoc), but even then there were no other references to a LIBC_FEATURES output variable within the project.
@jmikola
Copy link
Member Author

jmikola commented Aug 12, 2023

Manually tested this PR with php:8.1-alpine, which excludes the unconditional definition of _GNU_SOURCE in PHP 8.2+.

Before the changes to PlatformFlags.m4:

# make -j1
/bin/sh /mongo-php-driver/libtool --mode=compile cc -Isrc/libmongoc/src/libbson/src/bson/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/bson/ -I/mongo-php-driver/include -I/mongo-php-driver/main -I/mongo-php-driver -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 -I/mongo-php-driver/src/libmongoc/src/common/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/jsonsl/ -I/mongo-php-driver/src/libmongoc/src/libmongoc/src/ -I/mongo-php-driver/src/ -I/mongo-php-driver/src/BSON/ -I/mongo-php-driver/src/MongoDB/ -I/mongo-php-driver/src/MongoDB/Exception/ -I/mongo-php-driver/src/MongoDB/Monitoring/ -I/mongo-php-driver/src/contrib/  -DHAVE_CONFIG_H  -g -O2    -DBSON_COMPILATION -DMONGOC_COMPILATION -D_DEFAULT_SOURCE    -DKMS_MESSAGE_LITTLE_ENDIAN=1 -DMONGOCRYPT_LITTLE_ENDIAN=1 -c /mongo-php-driver/src/libmongoc/src/libbson/src/bson/bson-error.c -o src/libmongoc/src/libbson/src/bson/bson-error.lo  -MMD -MF src/libmongoc/src/libbson/src/bson/bson-error.dep -MT src/libmongoc/src/libbson/src/bson/bson-error.lo
 cc -Isrc/libmongoc/src/libbson/src/bson/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/bson/ -I/mongo-php-driver/include -I/mongo-php-driver/main -I/mongo-php-driver -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 -I/mongo-php-driver/src/libmongoc/src/common/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/jsonsl/ -I/mongo-php-driver/src/libmongoc/src/libmongoc/src/ -I/mongo-php-driver/src/ -I/mongo-php-driver/src/BSON/ -I/mongo-php-driver/src/MongoDB/ -I/mongo-php-driver/src/MongoDB/Exception/ -I/mongo-php-driver/src/MongoDB/Monitoring/ -I/mongo-php-driver/src/contrib/ -DHAVE_CONFIG_H -g -O2 -DBSON_COMPILATION -DMONGOC_COMPILATION -D_DEFAULT_SOURCE -DKMS_MESSAGE_LITTLE_ENDIAN=1 -DMONGOCRYPT_LITTLE_ENDIAN=1 -c /mongo-php-driver/src/libmongoc/src/libbson/src/bson/bson-error.c -MMD -MF src/libmongoc/src/libbson/src/bson/bson-error.dep -MT src/libmongoc/src/libbson/src/bson/bson-error.lo  -fPIC -DPIC -o src/libmongoc/src/libbson/src/bson/.libs/bson-error.o
/mongo-php-driver/src/libmongoc/src/libbson/src/bson/bson-error.c: In function 'bson_strerror_r':
/mongo-php-driver/src/libmongoc/src/libbson/src/bson/bson-error.c:170:2: error: #error "Unable to find a supported strerror_r candidate"
  170 | #error "Unable to find a supported strerror_r candidate"
      |  ^~~~~
make: *** [Makefile:326: src/libmongoc/src/libbson/src/bson/bson-error.lo] Error 1

With the changes to PlatformFlags.m4, which adds -D_XOPEN_SOURCE=700 -D_BSD_SOURCE:

# make -j1
/bin/sh /mongo-php-driver/libtool --mode=compile cc -Isrc/libmongoc/src/libbson/src/bson/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/bson/ -I/mongo-php-driver/include -I/mongo-php-driver/main -I/mongo-php-driver -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 -I/mongo-php-driver/src/libmongoc/src/common/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/jsonsl/ -I/mongo-php-driver/src/libmongoc/src/libmongoc/src/ -I/mongo-php-driver/src/ -I/mongo-php-driver/src/BSON/ -I/mongo-php-driver/src/MongoDB/ -I/mongo-php-driver/src/MongoDB/Exception/ -I/mongo-php-driver/src/MongoDB/Monitoring/ -I/mongo-php-driver/src/contrib/  -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DHAVE_CONFIG_H  -g -O2    -DBSON_COMPILATION -DMONGOC_COMPILATION -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_DEFAULT_SOURCE    -DKMS_MESSAGE_LITTLE_ENDIAN=1 -DMONGOCRYPT_LITTLE_ENDIAN=1 -c /mongo-php-driver/src/libmongoc/src/libbson/src/bson/bson-error.c -o src/libmongoc/src/libbson/src/bson/bson-error.lo  -MMD -MF src/libmongoc/src/libbson/src/bson/bson-error.dep -MT src/libmongoc/src/libbson/src/bson/bson-error.lo
 cc -Isrc/libmongoc/src/libbson/src/bson/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/bson/ -I/mongo-php-driver/include -I/mongo-php-driver/main -I/mongo-php-driver -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 -I/mongo-php-driver/src/libmongoc/src/common/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/ -I/mongo-php-driver/src/libmongoc/src/libbson/src/jsonsl/ -I/mongo-php-driver/src/libmongoc/src/libmongoc/src/ -I/mongo-php-driver/src/ -I/mongo-php-driver/src/BSON/ -I/mongo-php-driver/src/MongoDB/ -I/mongo-php-driver/src/MongoDB/Exception/ -I/mongo-php-driver/src/MongoDB/Monitoring/ -I/mongo-php-driver/src/contrib/ -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DHAVE_CONFIG_H -g -O2 -DBSON_COMPILATION -DMONGOC_COMPILATION -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DKMS_MESSAGE_LITTLE_ENDIAN=1 -DMONGOCRYPT_LITTLE_ENDIAN=1 -c /mongo-php-driver/src/libmongoc/src/libbson/src/bson/bson-error.c -MMD -MF src/libmongoc/src/libbson/src/bson/bson-error.dep -MT src/libmongoc/src/libbson/src/bson/bson-error.lo  -fPIC -DPIC -o src/libmongoc/src/libbson/src/bson/.libs/bson-error.o

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

Successfully merging this pull request may close these issues.

1 participant