在任何软件包上运行swift build
都会失败,并显示以下输出:
[1/1] Compiling Swift Module 'SynchronousNetworking' (3 sources)
<unknown>:0: error: failed writing record '_pthread_rwlockattr_t.h-15446MBE1AZWP': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/WP/_pthread_rwlockattr_t.h-15446MBE1AZWP-temp-f543b829
<unknown>:0: error: failed writing record 'uuid.h-3RIUEBNVXME9Q': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/9Q/uuid.h-3RIUEBNVXME9Q-temp-27e1a4c7
<unknown>:0: error: failed writing record '_u_int16_t.h-34I7NDL9MUDL': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/DL/_u_int16_t.h-34I7NDL9MUDL-temp-be9fdd22
<unknown>:0: error: failed writing record 'fmaintrin.h-4B9WQ55UKX7V': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/7V/fmaintrin.h-4B9WQ55UKX7V-temp-f26ea012
<unknown>:0: error: failed writing record 'CTTextTab.h-X47FKBQ1RXGU': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/GU/CTTextTab.h-X47FKBQ1RXGU-temp-d4fc8399
<unknown>:0: error: failed writing record 'FoundationOverlayShims.h-2XZL6DVCNMY82': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/82/FoundationOverlayShims.h-2XZL6DVCNMY82-temp-6d359744
<unknown>:0: error: failed writing record '_uintptr_t.h-1DR8717NVFXXK': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/XK/_uintptr_t.h-1DR8717NVFXXK-temp-8085ec94
<unknown>:0: error: failed writing record '_ctype.h-B4CEWHC0EQSN': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/SN/_ctype.h-B4CEWHC0EQSN-temp-f0a309d3
<unknown>:0: error: failed writing record 'poll.h-1QKTQ62SG1WMU': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/MU/poll.h-1QKTQ62SG1WMU-temp-d98445b7
<unknown>:0: error: writing index record file: failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/RT/CoreGraphics.swiftmodule-KUR2MKSFKTRT-temp-3196c465
<unknown>:0: error: failed writing record 'IOReturn.h-1M1CBYHRWHC0P': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/0P/IOReturn.h-1M1CBYHRWHC0P-temp-f788a88d
项目目录中ls
的输出为:
drwxrwxrwx 11 anka staff 352 Apr 25 02:21 .
drwxrwxrwx 4 root wheel 128 Apr 25 01:00 ..
drwxrwxrwx 3 anka staff 96 Apr 23 04:58 .circleci
drwxrwxrwx 12 anka staff 384 Apr 23 04:58 .git
-rwxrwxrwx 1 anka staff 41 Apr 23 04:58 .gitignore
-rwxrwxrwx 1 anka staff 1075 Apr 23 04:58 LICENSE
-rwxrwxrwx 1 anka staff 505 Apr 23 04:58 Package.swift
-rwxrwxrwx 1 anka staff 720 Apr 23 04:58 README.md
drwxrwxrwx 3 anka staff 96 Apr 23 04:58 Sources
drwxrwxrwx 4 anka staff 128 Apr 23 04:58 Tests
-rwxrwxrwx 1 anka staff 475 Apr 23 04:58 build.sh
其中显示所有用户组都有rwx
。
还值得注意的是,只有第一个swift build
会导致此错误。后续的构建成功完成,直到删除.build
目录,然后再次发生,每次失败都需要一组不同的文件。
build命令在anka VM内运行,但是我猜测这只是一个权限问题,与它在VM内运行无关。