Opened 8 years ago

Last modified 6 years ago

#10591 reopened Bugs

boost::filesystem does not build on iOS 8

Reported by: anonymous Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.63.0 Severity: Problem
Keywords: Cc:

Description

boost::filesystem::detail::operations relies on AT_SYMLINK_NOFOLLOW macro to decide whenever to use fchmodat function or not. Since iOS8 AT_SYMLINK_NOFOLLOW is defined on iOS but fchmodat still not available which breaks this logic and lead to compilation error.

Attachments (1)

boost-fs-fchmodat-darwin.patch (1.5 KB ) - added by tiwoc@… 7 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Beman Dawes, 8 years ago

Status: newassigned

I have not have access to an iOS8 development environment, so will not be able to fix this without some help.

If you could submit a patch, that would be very helpful. Otherwise, could you find out how to detect (presumably by compiler or library defined macros) whether or not fchmodat is available in your compilation environment?

Thanks,

--Beman

comment:2 by vanderhu, 8 years ago

The problem is no only with usage of iPhoneOS8.1.sdk, it is also affecting MacOSX10.10.sdk as in both AT_SYMLINK_NOFOLLOW is nowadays defined. There are basicly two solutions for this problem: 1) Completely stop supporting both iOS and OSX for all versions as fchmodat was never supported 2) Use specific defines to ignore it after OSX10.10 and iOS8.1

Actually it doesn't lead to a compilation error in our case, but a runtime error. I could deliver patches for both solutions.

comment:3 by anonymous, 8 years ago

any progress on this one?

by tiwoc@…, 7 years ago

comment:4 by tiwoc@…, 7 years ago

Apple does implement fchmodat from OS X 10.10 and iOS 8.0. Have a look at the following line of /usr/include/sys/stat.h:

int     fchmodat(int, const char *, mode_t, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);

This means that fchmodat will only be available when targeting OS X 10.10+ or iOS 8.0+, but the AT_* constants are always defined when building on 10.10, so they cannot be used for detection whether fchmodat is available.

I just posted a patch that uses the MAC_OS_X_VERSION_MIN_REQUIRED and IPHONE_OS_VERSION_MIN_REQUIRED defines for detection. It has been verified to work well with Boost 1.58.0 on OS X 10.9 and 10.10 (both targeting 10.9), Linux and Windows (MSVC).

comment:5 by Beman Dawes, 7 years ago

Resolution: fixed
Status: assignedclosed

Thanks to Daniel Seither for supplying a version specific patch for OS X and IOS.

The patch has been applied to develop, and will be merged to master in a few days assuming the regression tests cycle OK.

--Beman

comment:6 by tibore@…, 6 years ago

Resolution: fixed
Status: closedreopened
Version: Boost 1.56.0Boost 1.63.0

We tried to build 1.63.0 on OS X 10.11 targeting 10.9 and linking failed with the exact same reason (missing fchmodat). We had to switch to the fallback solution by hand. I don't get why the patch stopped working but it certainly did.

comment:7 by anonymous, 6 years ago

After some investigation we found that MAC_OS_X_VERSION_MIN_REQUIRED is 101100 in our build environment and not 100900 as one would expect.

Note: See TracTickets for help on using tickets.