Adding swift to objc -> tests fail to compile with missing .pcm files

Hello all,

tldr: I'm trying to figure out why adding a Swift file to this ObjC project breaks compilation specifically when I try to run the existing test suite, complaining about .pcm files not found (including several that seem to be builtins).


I'm trying to add Swift support to one of the core frameworks in Quicksilver, with the ultimate goal of converting various parts of the project from objc to Swift over time.

I never learned much objc, and I'm not terribly interested in learning, but I've read the Swift book and it appeals to me, which is part of my motivation.

I've added a blank Swift file to the QuickStep Core (QSCore) framework, and just adding this file initially broke the build. After adding the SWIFT_VERSION build setting (to 6.0) I can build and run, but the tests fail due to a mountain of .pcm file not found errors.

I've pushed my branch to: GitHub - n8henrie/Quicksilver at swift-qsobj

Here's an example of the error:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -cc1 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -ferror-limit 19 -serialize-diagnostic-file /tmp/QS/build/ExplicitPrecompiledModules/_Builtin_float-ZYILCJBUUQN9VL46L7D42OCY.dia -index-store-path /Users/n8henrie/Library/Developer/Xcode/DerivedData/Quicksilver-ansgkardtljcsedwuirmtbxgmigg/Index.noindex/DataStore -fsystem-module -fmodule-map-file\=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk/usr/include/c_standard_library.modulemap -o /tmp/QS/build/ExplicitPrecompiledModules/_Builtin_float-ZYILCJBUUQN9VL46L7D42OCY.pcm -disable-free -emit-module -x objective-c /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/module.modulemap -target-abi darwinpcs -target-cpu apple-m1 -target-feature +v8.5a -target-feature +aes -target-feature +crc -target-feature +dotprod -target-feature +fp-armv8 -target-feature +fp16fml -target-feature +lse -target-feature +ras -target-feature +rcpc -target-feature +rdm -target-feature +sha2 -target-feature +sha3 -target-feature +neon -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -triple arm64-apple-macosx10.14.0 -target-linker-version 1115.7.3 -target-sdk-version\=15.2 -fmodules-validate-system-headers -fno-modules-prune-non-affecting-module-map-files -fno-modulemap-allow-subdirectory-search -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16 -fmodule-format\=obj -fmodule-file\=_float\=/tmp/QS/build/ExplicitPrecompiledModules/_float-8V1LSJ1R0FMV1F1FGJ2FIL87I.pcm -isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk/usr/include -std\=c99 -fexceptions -fmodules -fmodule-name\=_Builtin_float -fmodules-search-all -fno-implicit-modules -fobjc-exceptions -fmax-type-align\=16 -fstack-check -mdarwin-stkchk-strong-link -fno-odr-hash-protocols -pic-level 2 -disable-objc-default-synthesize-properties -stack-protector 1 -fmodule-related-to-pch -fobjc-runtime\=macosx-10.14.0 -fobjc-arc -fobjc-runtime-has-weak -fobjc-weak -fgnuc-version\=4.2.1 -fblocks -ffp-contract\=off -fclang-abi-compat\=4.0 -fno-experimental-relative-c++-abi-vtables -fno-file-reproducible -clang-vendor-feature\=+disableNonDependentMemberExprInCurrentInstantiation -clang-vendor-feature\=+enableAggressiveVLAFolding -clang-vendor-feature\=+revert09abecef7bbf -clang-vendor-feature\=+thisNoAlignAttr -clang-vendor-feature\=+thisNoNullAttr -clang-vendor-feature\=+disableAtImportPrivateFrameworkInImplementationError -O0 -fcommon -fno-sanitize-address-use-odr-indicator -fno-sanitize-memory-param-retval -fmerge-all-constants -fno-verbose-asm -fregister-global-dtors-with-atexit -fno-use-init-array -funique-basic-block-section-names -dwarf-version\=4 -debugger-tuning\=lldb -llvm-verify-each -dwarf-ext-refs -no-struct-path-tbaa -fexperimental-assignment-tracking\=disabled -no-enable-noundef-analysis -stack-protector-buffer-size 0 -debug-info-kind\=standalone -fdiagnostics-hotness-threshold\=0 -fdiagnostics-misexpect-tolerance\=0 -D DEBUG -D OBJC_OLD_DISPATCH_PROTOTYPES\=0 -D __GCC_HAVE_DWARF2_CFI_ASM\=1 -MT moduledependenciestarget -dependency-file /tmp/QS/build/ExplicitPrecompiledModules/_Builtin_float-ZYILCJBUUQN9VL46L7D42OCY.d -sys-header-deps -skip-unused-modulemap-deps -module-file-deps
While building module '_Builtin_float':
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/float.h:28:4: fatal error: module file '/tmp/QS/build/ExplicitPrecompiledModules/_float-8V1LSJ1R0FMV1F1FGJ2FIL87I.pcm' not found: module file not found
   28 | #  include_next <float.h>
      |    ^
1 error generated.

That file is indeed not there, or anywhere:

$ find -L /tmp/QS ~/Library/Developer/Xcode/DerivedData -name '*8V1LSJ1R0FMV1F1FGJ2FIL87I*.pcm'
$

I've been trying to sort this out for several weeks with no luck (though some of these aren't committed to that branch yet, as they didn't seem to fix anything)

  • DEFINES_MODULE = YES
  • Watched the Apple Dev video on the new explicit modules stuff in XCode 16
  • Cleaned and removed DerivedData and the /tmp/QS build folder between all changes
  • CLANG_ENABLE_MODULES = YES

Is this error familiar to anyone? I'd love to hear any suggestions. I've tried making a PoC XCode app with an objc framework, an objc binary using that framework, and a Swift file, and it compiles and tests fine, so I'm not sure where I'm going wrong here. Many thanks in advance for suggestions!

xcode Version 16.2 (16C5032a)

$ sw_vers
ProductName:            macOS
ProductVersion:         15.2
BuildVersion:           24C101

Actually, now that I've added #import "QSCore-Swift.h" to QSObject.m, I get the same errors when trying to run or build the default target as well (it's not just the tests). So that makes a little more sense.

I'm wondering if there's some build step that creates these .pcm files that is failing?

For example, right now its looking for _Builtin_float at:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/float.h:28:4:
fatal error: module file '/tmp/QS/build/ExplicitPrecompiledModules/_float-8V1LSJ1R0FMV1F1FGJ2FIL87I.pcm' not found: module file not found

Here are all the matches for _float-.*\.pcm in the build directory (/tmp/QS) as well as DerivedData:

$ fd -uuuL '_float-.*\.pcm$' /tmp/QS ~/Library/Developer/Xcode/DerivedData/
/Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1BIVRTQVX70FV/_Builtin_float-9VMJEIX0S9SE.pcm
/Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1BIVRTQVX70FV/_float-104I7O8W7MEVW.pcm
/Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1R3J6LB16COOO/_Builtin_float-9VMJEIX0S9SE.pcm
/Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1R3J6LB16COOO/_float-104I7O8W7MEVW.pcm
/Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2ZZSYBYCT5W3O/_Builtin_float-9VMJEIX0S9SE.pcm
/Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2ZZSYBYCT5W3O/_float-104I7O8W7MEVW.pcm
/Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3JZ01RC1IU484/_Builtin_float-9VMJEIX0S9SE.pcm
/Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3JZ01RC1IU484/_float-104I7O8W7MEVW.pcm
/Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/X5O4C08A6ECY/_Builtin_float-9VMJEIX0S9SE.pcm
/Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/X5O4C08A6ECY/_float-104I7O8W7MEVW.pcm

Clearly none of them match the 8V1LSJ1R0FMV1F1FGJ2FIL87I part.

All matches for 8V1LSJ1R0FMV1F1FGJ2FIL87I in the same directories:

$ fd -uuuL 8V1LSJ1R0FMV1F1FGJ2FIL87I /tmp/QS ~/Library/Developer/Xcode/DerivedData/
/tmp/QS/build/ExplicitPrecompiledModules/_float-8V1LSJ1R0FMV1F1FGJ2FIL87I.scan

If I search the entire build log for 8V1LSJ1R0FMV1F1FGJ2FIL87I.scan I have no matches; the only matches for 8V1LSJ1R0FMV1F1FGJ2FIL87I are looking for the .pcm file.

Is there a build step missing here, maybe that generates the .pcm file from this .scan file?

The errors at run-time went away inexplicably -- no changes to build settings. This is the second time that has happened.

Actually, I transiently changed the minimum deployment to macos 15. The build errors when building the debug target resolved (continued to have the same errors for the test target). I cleaned all the build files and git checkout the repo, which reset the minimum deployment setting, but the errors never returned. So that's why I'm saying there were no changes to build settings -- they have all been restored.

Xcode is certainly a frustrating experience.

Now, again with basically no changes, both the app builds and runs, and the tests pass.

Again, the lack of determinism here is killing me.

After a rm -rf /tmp/QS ~/Library/Developer/Xcode/DerivedData, an xcodebuild clean, and then a run and then test cycle, here are the pcm files I was searching for above:

$ fd -uuuLl '_float.*\.pcm' /tmp/QS ~/Library/Developer/Xcode/DerivedData/
-rw-r--r-- 1 n8henrie staff  27K Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1T7FCYJ3CO8RQ/_Builtin_float-9VMJEIX0S9SE.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1T7FCYJ3CO8RQ/_Builtin_float-9VMJEIX0S9SE.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  23K Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1T7FCYJ3CO8RQ/_float-104I7O8W7MEVW.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1T7FCYJ3CO8RQ/_float-104I7O8W7MEVW.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  28K Jan  9 10:52 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/20D03VC9UFGKB/_Builtin_float-9VMJEIX0S9SE.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:52 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/20D03VC9UFGKB/_Builtin_float-9VMJEIX0S9SE.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  23K Jan  9 10:52 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/20D03VC9UFGKB/_float-104I7O8W7MEVW.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:52 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/20D03VC9UFGKB/_float-104I7O8W7MEVW.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  59K Jan  9 10:52 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/33GHDH6GT30A7/_Builtin_float-9VMJEIX0S9SE.pcm
-rw-r--r-- 1 n8henrie staff  54K Jan  9 10:52 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/33GHDH6GT30A7/_float-104I7O8W7MEVW.pcm
-rw-r--r-- 1 n8henrie staff  27K Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3EXU1HXU7NENC/_Builtin_float-9VMJEIX0S9SE.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3EXU1HXU7NENC/_Builtin_float-9VMJEIX0S9SE.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  23K Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3EXU1HXU7NENC/_float-104I7O8W7MEVW.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3EXU1HXU7NENC/_float-104I7O8W7MEVW.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  28K Jan  9 10:49 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3JZ01RC1IU484/_Builtin_float-9VMJEIX0S9SE.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:49 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3JZ01RC1IU484/_Builtin_float-9VMJEIX0S9SE.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  23K Jan  9 10:49 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3JZ01RC1IU484/_float-104I7O8W7MEVW.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:49 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3JZ01RC1IU484/_float-104I7O8W7MEVW.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  40K Jan  9 10:49 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3P893VBR3P3CR/_Builtin_float-9VMJEIX0S9SE.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3P893VBR3P3CR/_Builtin_float-9VMJEIX0S9SE.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  32K Jan  9 10:49 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3P893VBR3P3CR/_float-104I7O8W7MEVW.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3P893VBR3P3CR/_float-104I7O8W7MEVW.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  28K Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/GYEWZEWUXRT3/_Builtin_float-9VMJEIX0S9SE.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/GYEWZEWUXRT3/_Builtin_float-9VMJEIX0S9SE.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  23K Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/GYEWZEWUXRT3/_float-104I7O8W7MEVW.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/GYEWZEWUXRT3/_float-104I7O8W7MEVW.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  23K Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/KZ5YDVGPLVYS/_Builtin_float-9VMJEIX0S9SE.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/KZ5YDVGPLVYS/_Builtin_float-9VMJEIX0S9SE.pcm.timestamp
-rw-r--r-- 1 n8henrie staff  18K Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/KZ5YDVGPLVYS/_float-104I7O8W7MEVW.pcm
-rw-r--r-- 1 n8henrie staff   15 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/KZ5YDVGPLVYS/_float-104I7O8W7MEVW.pcm.timestamp
-rw-r--r-- 1 n8henrie staff 1.2K Jan  9 10:52 /Users/n8henrie/Library/Developer/Xcode/DerivedData/Quicksilver-ansgkardtljcsedwuirmtbxgmigg/Index.noindex/DataStore/v5/units/_Builtin_float-B9PB1BZW5QUOB0JZ7ORYNADPT.pcm-3SX8Z6M7S8D25
-rw-r--r-- 1 n8henrie staff 1.2K Jan  9 10:49 /Users/n8henrie/Library/Developer/Xcode/DerivedData/Quicksilver-ansgkardtljcsedwuirmtbxgmigg/Index.noindex/DataStore/v5/units/_Builtin_float-BYEK7Z0LYRHZMLIZ2Z1S2K6SY.pcm-1HCQ2VMPVN886
-rw-r--r-- 1 n8henrie staff 1.2K Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/Quicksilver-ansgkardtljcsedwuirmtbxgmigg/Index.noindex/DataStore/v5/units/_Builtin_float-ZYILCJBUUQN9VL46L7D42OCY.pcm-2X744H9AOJEE8
-rw-r--r-- 1 n8henrie staff  928 Jan  9 10:52 /Users/n8henrie/Library/Developer/Xcode/DerivedData/Quicksilver-ansgkardtljcsedwuirmtbxgmigg/Index.noindex/DataStore/v5/units/_float-1ZPE2UY55L8447W4CZKYZ1ZQ1.pcm-3EAIN3USGEZ4X
-rw-r--r-- 1 n8henrie staff  928 Jan  9 10:51 /Users/n8henrie/Library/Developer/Xcode/DerivedData/Quicksilver-ansgkardtljcsedwuirmtbxgmigg/Index.noindex/DataStore/v5/units/_float-8V1LSJ1R0FMV1F1FGJ2FIL87I.pcm-1OQV9GJGMKCE4
-rw-r--r-- 1 n8henrie staff 1008 Jan  9 10:49 /Users/n8henrie/Library/Developer/Xcode/DerivedData/Quicksilver-ansgkardtljcsedwuirmtbxgmigg/Index.noindex/DataStore/v5/units/_float-CTKCN2E4IPW48KT7MRAHZDQH6.pcm-1U3WKYLFAM2G0
-rw-r--r-- 1 n8henrie wheel  31K Jan  9 10:52 /tmp/QS/build/ExplicitPrecompiledModules/_Builtin_float-B9PB1BZW5QUOB0JZ7ORYNADPT.pcm
-rw-r--r-- 1 n8henrie wheel  30K Jan  9 10:51 /tmp/QS/build/ExplicitPrecompiledModules/_Builtin_float-ZYILCJBUUQN9VL46L7D42OCY.pcm
-rw-r--r-- 1 n8henrie wheel  25K Jan  9 10:52 /tmp/QS/build/ExplicitPrecompiledModules/_float-1ZPE2UY55L8447W4CZKYZ1ZQ1.pcm
-rw-r--r-- 1 n8henrie wheel  25K Jan  9 10:51 /tmp/QS/build/ExplicitPrecompiledModules/_float-8V1LSJ1R0FMV1F1FGJ2FIL87I.pcm

Of note, if I xcodebuild clean and then test (without building for running first), it sometimes fails with the same .pcm errors as above, and sometimes compiles and passes the tests.

¯\_(ツ)_/¯