mongo-php-driver icon indicating copy to clipboard operation
mongo-php-driver copied to clipboard

build error :redefinition of 'bson_in_range_long_signed' in 1.14.0

Open suconghou opened this issue 3 years ago • 5 comments

1.13.0 build success with no error

but 1.14.0 build error

#19 245.1 In file included from /php-8.1.9/ext/apcu/php_apc.h:33,
#19 245.1 from main/internal_functions_cli.c:32:
#19 245.1 /php-8.1.9/ext/apcu/apc.h:134:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
#19 245.1 134 | PHP_APCU_API apc_serializer_t* apc_get_serializers(); /* }}} */
#19 245.1 | ^~~~~~~~~~~~
#19 245.1 In file included from /php-8.1.9/ext/mongodb/src/libmongoc/src/libbson/src/bson/bson-compat.h:35,
#19 245.1 from /php-8.1.9/ext/mongodb/src/libmongoc/src/libbson/src/bson/bson.h:23,
#19 245.1 from /php-8.1.9/ext/mongodb/src/phongo_structs.h:20,
#19 245.1 from /php-8.1.9/ext/mongodb/src/phongo_classes.h:20,
#19 245.1 from /php-8.1.9/ext/mongodb/php_phongo.h:35,
#19 245.1 from main/internal_functions_cli.c:50:
#19 245.1 /php-8.1.9/ext/mongodb/src/libmongoc/src/libbson/src/bson/bson-cmp.h:123:42: error: redefinition of 'bson_in_range_long_signed'
#19 245.1 123 | static BSON_INLINE bool BSON_CONCAT3 (bson_in_range_, Type, _signed) ( \
#19 245.1 | ^~~~~~~~~~~~~~
#19 245.1 /php-8.1.9/ext/mongodb/src/libmongoc/src/libbson/src/bson/bson-macros.h:326:34: note: in definition of macro 'BSON_CONCAT_IMPL'
#19 245.1 326 | #define BSON_CONCAT_IMPL(a, ...) a##__VA_ARGS__
#19 245.1 | ^
#19 245.1 /php-8.1.9/ext/mongodb/src/libmongoc/src/libbson/src/bson/bson-macros.h:328:31: note: in expansion of macro 'BSON_CONCAT'
#19 245.1 328 | #define BSON_CONCAT3(a, b, c) BSON_CONCAT (a, BSON_CONCAT (b, c))
#19 245.1 | ^~~~~~~~~~~
#19 245.1 /php-8.1.9/ext/mongodb/src/libmongoc/src/libbson/src/bson/bson-cmp.h:123:28: note: in expansion of macro 'BSON_CONCAT3'
#19 245.1 123 | static BSON_INLINE bool BSON_CONCAT3 (bson_in_range_, Type, _signed) ( \
#19 245.1 | ^~~~~~~~~~~~
#19 245.1 /php-8.1.9/ext/mongodb/src/libmongoc/src/libbson/src/bson/bson-cmp.h:174:1: note: in expansion of macro 'BSON_IN_RANGE_SET_SIGNED'
#19 245.1 174 | BSON_IN_RANGE_SET_SIGNED (ssize_t, SSIZE_MIN, SSIZE_MAX)
#19 245.1 | ^~~~~~~~~~~~~~~~~~~~~~~~
#19 245.1 /php-8.1.9/ext/mongodb/src/libmongoc/src/libbson/src/bson/bson-cmp.h:123:42: note: previous definition of 'bson_in_range_long_signed' with type '_Bool(int64_t)' {aka '_Bool(long int)'}

build in docker , dockerfile https://github.com/suconghou/docker/blob/master/php/Dockerfile-mongo

suconghou avatar Aug 08 '22 02:08 suconghou

I've reported this to the libmongoc team in CDRIVER-4451. Feel free to watch that issue for updates. Assuming this gets fixed in a forthcoming libmongoc patch release (1.22.2), we can include that in a corresponding PHP driver patch release (1.14.1).

jmikola avatar Aug 08 '22 15:08 jmikola

@suconghou: This should be addressed by https://github.com/mongodb/mongo-c-driver/pull/1091.

When you get a chance, can you apply the patch to a local copy of the PHP driver and tell us if it builds successfully in your environment? You can follow the steps in Building the MongoDB PHP Driver from source, and can apply the batch after initializing the submodules and before running phpize.

jmikola avatar Aug 08 '22 17:08 jmikola

@jmikola I have tested this patch , it works great !

suconghou avatar Aug 09 '22 03:08 suconghou

Hi, is there any update? I tried using 1.14.1, but the problem didn't get fixed. It works fine after overwriting the patch

qiqizjl avatar Oct 08 '22 16:10 qiqizjl

@qiqizjl There was no 1.22.2 release for libmongoc, which means that we can't patch this in 1.14 (we don't usually bump libmongoc minor versions in a patch release). Well discuss this internally and provide an update.

alcaeus avatar Oct 10 '22 07:10 alcaeus

Thanks for an unrelated bug fix, libmongoc had to make a 1.22.2 release. We just released 1.14.2, which should address this issue.

jmikola avatar Oct 20 '22 15:10 jmikola