[SERVER-17813] error: use of undeclared identifier 'strnlen' Created: 31/Mar/15  Updated: 14/Nov/15  Resolved: 03/Apr/15

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: 3.0.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Ryan Schmidt Assignee: Andrew Morrow (Inactive)
Resolution: Won't Fix Votes: 0
Labels: build-planning
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-17836 Enforce OS minima with configure checks Closed
is related to SERVER-17837 Enforce minimum versions of third par... Closed
Operating System: ALL
Participants:

 Description   

mongodb 3.0.0 and 3.0.1 do not compile on Mac OS X 10.6. The error is:

src/mongo/bson/bsonelement.h:485:35: error: use of undeclared identifier 'strnlen'
                    size_t size = strnlen( fieldName(), maxLen - 1 );
                                  ^

The problem is that strnlen was added to OS X in version 10.7, so to compile on previous systems you must either not use strnlen or must provide a compatibility implementation of it.

The MacPorts project's ticket about this issue is https://trac.macports.org/ticket/47119



 Comments   
Comment by Ryan Schmidt [ 14/Nov/15 ]

Note that MacPorts does offer a way to use libc++ even on OS X 10.6. See https://trac.macports.org/wiki/LibcxxOnOlderSystems. So, were it not for the use of strnlen, mongodb might still be buildable on OS X 10.6 with libc++.

However, it is possible there is no longer user interest in this. No complaints about the 10.7 requirement have been reported to me as mongodb package maintainer in MacPorts.

Comment by Andrew Morrow (Inactive) [ 01/Apr/15 ]

ryandesign - The cost to support older platforms is high, generally. Additionally, we wanted to be able to rely on of a modern C++ runtime. Due to Apple's freezing libstdc++ at 4.2.1 this means that we now require libc++, and that only became available in OS X 10.7 and on.

I agree with you that it would be good to report when the target system does not meet our minimum requirements. We actually already do this for the C/C++ compiler and the standard library, so we are moving in this direction overall. Ideally, we would also do such a check for any third_party libraries where the user requested to use the system version instead of our vendored copy.

I've filed SERVER-17836 to capture the OS detection improvement, and SERVER-17837 to capture the third party library improvement.

Please let us know if there is anything more we can do for you on this issue.

Comment by Ryan Schmidt [ 01/Apr/15 ]

That is unfortunate, but if that is what you want, then you should modify the scons script so that it detects OS X < 10.7 and provides a suitable human-readable message. Otherwise you will keep getting users reporting this build failure.

Comment by Andrew Morrow (Inactive) [ 31/Mar/15 ]

This is intentional. MongoDB 2.6 is the last version that targets OS X 10.6. MongoDB 3.0 requires OS X 10.7 or newer.

Generated at Thu Feb 08 03:45:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.