-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
I can't build libbson from mongo-c-driver 1.20.0 on macOS Catalina 10.15.7 with Apple clang version 12.0.0 (clang-1200.0.32.29) from Xcode 12.4. The error is:
src/libbson/src/bson/bson-context.c:234:4: error: implicit declaration of function 'arc4random_buf' is invalid in C99 [-Werror,-Wimplicit-function-declaration] arc4random_buf (&result, sizeof (result)); ^ 1 error generated.
src/libbson/src/bson/bson-string.c:554:4: error: implicitly declaring library function 'strlcpy' with type 'unsigned long (char *, const char *, unsigned long)' [-Werror,-Wimplicit-function-declaration] strlcpy (dst, src, size); ^ src/libbson/src/bson/bson-string.c:554:4: note: include the header <string.h> or explicitly provide a declaration for 'strlcpy' 1 error generated.
arc4random_buf is only defined in stdlib.h if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)).
Defining _DARWIN_C_SOURCE works around the problem but I don't know if that's the best solution.
- is caused by
-
CDRIVER-4227 Use a shared_mutex when locking in shared_ptr atomic operations
- Closed
- is related to
-
PHPC-2019 Remove Solaris checks in m4 build scripts
- Closed
- related to
-
CDRIVER-4234 Build failure on Mac OS X 10.6 due to use of arc4random_buf
- Closed