I was still receiving errors on OS X when using the fakeroot package even after applying Mikhail's patches. In particular, the next_openat function never gets defined, which means that if openat is called, it will fail out when it can't find the symbol.
The challenge with fixing this is that openat on OS X takes variadic arguments, and the wrapawk_macosx script cannot properly handle mapping them. To fix this, I have a horrible hack; see https://github.com/Homebrew/homebrew/pull/36242 for an implementation that works. The short version is that I patch the redefinition of openat in libfakeroot.c to always pass a mode argument to next_openat (patch attached), and then patch wraptmpf.h after it is generated to implement next_openat to always take mode (patch attached). Patching a generated file is obviously not a long-term solution, but I'm not sure how the maintainer would like to handle this case. If I had my druthers I'd ditch automatic wrapping and just maintain the wrapping code by hand; that said, I don't know how often wrappers change and how much overhead that would then cause. I'm also not sure if this fix for OS X will break other OS's, and am not able to test elsewhere at this point. I hope this is helpful, and thanks to Mikhail for his original patches on which my patches are built. -- Nathaniel Talbott <:((><
fakeroot-always-pass-mode.patch
Description: Binary data
fakeroot-patch-wraptmpf-h.patch
Description: Binary data