On Sun, Nov 6, 2016 at 8:36 AM, Jack Howarth <howarth.at....@gmail.com> wrote: > The use of an Apple sandbox with denied file access permissions into > /usr/local > exposed that cc1 fails on errors of... > > cc1: error: /usr/local/include: Operation not permitted > > The commonly suggested solution of using --with-local-prefix= set to something > other than /usr/local is undeirable on darwin because that creates a compiler > which retains library searches in /usr/local/lib despite no longer searching > for headers in /usr/local/include (which makes it suspicable to header/library > mismatches during builds). > > The following trivial fix solves the issue by silently ignoring errors from > denied permissions as well as non-existent dirs from the stat (cur->name, &st) > call in remove_dup() of gcc/incpath.c. Okay for gcc trunk and backports to > gcc-5-branch and gcc-6-branch? > Jack Howarth
Perhaps it would be useful if I expounded a bit on the complexities that this PR introduces on darwin. Both MacPorts and now fink leverage the Apple sandbox to avoid contaminating their builds with development files installed in /usr/local. However the FSF gcc compiler packages built still should allow end-users to build against /usr/local as normal outside of the packaging systems. On darwin, it has been suggested that the sandbox build issues of FSF gcc be addressed by using ---sysroot instead. Unfortunately that approach in not viable because the Xcode developers no longer bundle the SDK of the prior OS in Xcode.app once a new OS is released. Thus using the SDK installed at / is the only option (since building against the next OS SDK on the prior OS is unsupported on darwin), and this nullifies the ability to use --sysroot to work around this issue. I believe the proposed patch is a trivial and straightforward solution which allows darwin developers to package the FSF gcc compilers within an Apple sandbox while retaining the ability of the built compilers to behave as expect with regard to /usr/local outside of the Apple sandbox. Jack