fpco / unliftio

The MonadUnliftIO typeclass for unlifting monads to IO
Other
151 stars 51 forks source link

file-posix.c build error #59

Open ocramz opened 4 years ago

ocramz commented 4 years ago

Building a project that includes unliftio (Stackage LTS 14.27 i.e. GHC 8.6.5) fails with this:

unliftio      > [20 of 20] Compiling UnliftIO
unliftio      > 
unliftio      > /private/var/folders/n0/zx3dkw3d2hd3x59rjk3gtj5r0000gn/T/stack24793/unliftio-0.2.12/cbits/file-posix.c:16:10: error:
unliftio      >      error: use of undeclared identifier 'AT_FDCWD'
unliftio      >       return AT_FDCWD;
unliftio      >              ^
unliftio      >    |
unliftio      > 16 |   return AT_FDCWD;
unliftio      >    |          ^
unliftio      > 
unliftio      > /private/var/folders/n0/zx3dkw3d2hd3x59rjk3gtj5r0000gn/T/stack24793/unliftio-0.2.12/cbits/file-posix.c:21:10: error:
unliftio      >      error: use of undeclared identifier 'AT_SYMLINK_FOLLOW'
unliftio      >       return AT_SYMLINK_FOLLOW;
unliftio      >              ^
unliftio      >    |
unliftio      > 21 |   return AT_SYMLINK_FOLLOW;
unliftio      >    |          ^
unliftio      > 2 errors generated.
unliftio      > `gcc' failed in phase `C Compiler'. (Exit code: 1)

If it helps,

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
ocramz commented 4 years ago

Indeed, I've just tried building on a newer machine (with a later XCode etc. ) and the error doesn't happen:

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I'd be keen to know a fix that applies to older XCode versions, because I won't be able to use the new one for a while.