AOSP build fails when building on NFS


I would like to share a problem which I stumbled upon when building AOSP for HiKey960. It is a generic problem and I post it here because I couldn’t find a solution anywhere in the Internet. So just in case somebody suffers from it, here’s the spoiler: DON’T USE NFS for building AOSP.
Since building AOSP takes a lot of storage space I used remote storage mouted via NFS for AOSP build. Then I entered into dex2oat build failures:

dex2oatd E 12-10 20:52:06 41013 41013] Cannot lock profiles: Failed to lock file 'out/target/product/hikey960/obj/JAVA_LIBRARIES/services_intermediates/': Bad file descriptor dex2oatd E 12-10 20:52:06 41013 41013] Failed to process profile file

The root cause is that AOSP uses flock() to lock the files and it does not work over NFS

I switched to locally mounded file system and the build succeeded. So again, don’t use NFS storage for building AOSP.

Dziki Dzik.

1 Like

Thanks a lot for sharing this. I never use nfs for AOSP building but now every time I use ssh to login in one remote build machine for AOSP building :wink: