[CDRIVER-2916] make fails on macOS Mojave Created: 03/Jan/19  Updated: 28/Jan/19  Resolved: 28/Jan/19

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 1.13.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Demircan Celebi Assignee: Kevin Albertson
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

macOS Mojave 10.14.2
XCode 10.1 (10B61)
cmake 3.13.2
make 4.2.1


Attachments: PNG File 3.png     PNG File 4.png     PNG File 5.png     PNG File 6.png     PNG File 7.png     PNG File cmake.png    

 Description   

Hello,

I am trying to build the driver but I get these errors when I run `make`.

In file included from /Users/demir/Downloads/mongo-c-driver-1.13.0/src/libmongoc/src/mongoc/mongoc-client.c:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/resolv.h:81:
/usr/local/include/nameser.h:22:14: error: redefinition of '__ns_class'
typedef enum __ns_class {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/arpa/nameser.h:337:14: note: previous definition is here
typedef enum __ns_class {
^
In file included from /Users/demir/Downloads/mongo-c-driver-1.13.0/src/libmongoc/src/mongoc/mongoc-client.c:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/resolv.h:81:
/usr/local/include/nameser.h:23:5: error: redefinition of enumerator 'ns_c_invalid'
ns_c_invalid = 0, /* Cookie. */
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/arpa/nameser.h:338:2: note: previous definition is here
ns_c_invalid = 0, /* Cookie. */
^

 

I've added the screenshot of all error logs. It'd be great if someone can help me with this.

Best,



 Comments   
Comment by Kevin Albertson [ 28/Jan/19 ]

Hi Demirican,

I could not reproduce this with the same version of macOS (10.14.2), XCode 10.1 (10B61), and latest cmake.

Inspecting both:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/arpa/nameser.h

And
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/nameser.h

They have the same ifdef guard. Even if both were included for me, I would not get a redefinition error. I'm unsure what differs with your setup, but seeing that you have a workaround for this, I'm closing as "Cannot Reproduce". But feel free to re-open if this is still an issue for you.

Thank you,
Kevin

Comment by Kevin Albertson [ 03/Jan/19 ]

Hi Demirican,

Thanks for including the cmake output. I haven't been able to reproduce on my machine with macOS Mojave, but I'll continue to investigate. By chance, were you able to build the C driver before, and this error only occurred after upgrading to Mojave? And in case you haven't, can you try deleting the cmake-build directory (/Users/demir/Downloads/mongo-c-driver-1.13.0/cmake-build) and rebuilding, in case something is outdated in the cmake cache?

Thank you,
Kevin

Comment by Demircan Celebi [ 03/Jan/19 ]

Yes, I'm using the latest version of XCode (10.1). I was able to run make after running cmake with -DENABLE_SRV=OFF, thank you for your quick response!

The cmake.png contains the output for `cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..`

Here is also the latest output for cmake:

~/D/m/cmake-build ❯❯❯ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_SRV=OFF ..
– The C compiler identification is ;AppleClang 10.0.0.10001145
– Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
– Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– No CMAKE_BUILD_TYPE selected, defaulting to RelWithDebInfo
– Using bundled libbson
libbson version (from VERSION_CURRENT file): 1.13.0
– Check if the system is big endian
– Searching 16 bit integer
– Looking for sys/types.h
– Looking for sys/types.h - found
– Looking for stdint.h
– Looking for stdint.h - found
– Looking for stddef.h
– Looking for stddef.h - found
– Check size of unsigned short
– Check size of unsigned short - done
– Using unsigned short
– Check if the system is big endian - little endian
– Looking for snprintf
– Looking for snprintf - found
– Looking for reallocf
– Looking for reallocf - found
– Performing Test BSON_HAVE_TIMESPEC
– Performing Test BSON_HAVE_TIMESPEC - Success
– struct timespec found
– Looking for gmtime_r
– Looking for gmtime_r - found
– Looking for rand_r
– Looking for rand_r - found
– Looking for strings.h
– Looking for strings.h - found
– Looking for clock_gettime
– Looking for clock_gettime - found
– Looking for strnlen
– Looking for strnlen - found
– Looking for stdbool.h
– Looking for stdbool.h - found
– Looking for SYS_gettid
– Looking for SYS_gettid - found
– Looking for syscall
– Looking for syscall - found
– Performing Test HAVE_ATOMIC_32_ADD_AND_FETCH
– Performing Test HAVE_ATOMIC_32_ADD_AND_FETCH - Success
– Performing Test HAVE_ATOMIC_64_ADD_AND_FETCH
– Performing Test HAVE_ATOMIC_64_ADD_AND_FETCH - Success
CMake Deprecation Warning at src/libbson/CMakeLists.txt:151 (cmake_policy):
The OLD behavior for policy CMP0042 will be removed from a future version
of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.

– Looking for pthread.h
– Looking for pthread.h - found
– Looking for pthread_create
– Looking for pthread_create - found
– Found Threads: TRUE
libmongoc version (from VERSION_CURRENT file): 1.13.0
– Searching for zlib CMake packages
– Found ZLIB: /usr/lib/libz.dylib (found version "1.2.8")
– zlib found version "1.2.8"
– zlib include path "/usr/local/include"
– zlib libraries "/usr/lib/libz.dylib"
– Looking for include file unistd.h
– Looking for include file unistd.h - found
– Looking for include file stdarg.h
– Looking for include file stdarg.h - found
– Searching for sasl/sasl.h
– Found in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include
– Searching for libsasl2
– Found /usr/lib/libsasl2.dylib
– Check size of socklen_t
– Check size of socklen_t - done
– Looking for sched_getcpu
– Looking for sched_getcpu - not found
– Detected parameters: accept (int, struct sockaddr *, socklen_t *)
– Searching for compression library header snappy-c.h
– Found in /usr/local/include
– Searching for libsnappy
– Found /usr/local/lib/libsnappy.dylib
– No ICU library found, SASLPrep disabled for SCRAM-SHA-256 authentication.
– If ICU is installed in a non-standard directory, define ICU_ROOT as the ICU installation path.
– Compiling against Secure Transport
– Compiling against Cyrus SASL
– Configuring done
– Generating done
– Build files have been written to: /Users/demir/Downloads/mongo-c-driver-1.13.0/cmake-build

 

Comment by Kevin Albertson [ 03/Jan/19 ]

Hi Demircan,

Thank you for the detailed bug report. Can you include the cmake command you used and the full output? A copy-paste of the text is fine. And can you confirm that you are using the latest version of XCode (10.1)?

As a temporary workaround, try configuring the driver without SRV URI support:

cmake -DENABLE_SRV=OFF

This disables support for DNS seedlist URIs, explained here.

Thank you,
Kevin

Generated at Wed Feb 07 21:16:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.