Assertion failed: (wrapperModule && "CxxShim module is required when using members of a base class. " "Make sure you `import CxxShim`.") when building swift-matter-examples

I'm trying to build the Swift Matter Example "smart-light," and running into this error:

Assertion failed: (wrapperModule && "CxxShim module is required when using members of a base class. " "Make sure you `import CxxShim`."), function getInteropStaticCastDeclRefExpr, file ClangImporter.cpp, line 4971.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.

using a very recent toolchain (swift-wasm-6.0-SNAPSHOT-2024-06-19-a.xctoolchain).

Because this project builds with CMake, which I barely understand, I have no idea how to tell it to link to CxxShim, so simply adding the import statement to Node.swift doesn't work.

using a very recent toolchain (swift-wasm-6.0-SNAPSHOT-2024-06-19-a.xctoolchain).

I don't think that's actually recent. Can you try with the "main" development snapshot from Swift.org - Install Swift ?

1 Like

Oh gosh you’re absolutely right. I downloaded it yesterday and assumed it was a nightly build. I’ll get back to you.

Okay, after some investigating, I see what happened. The Swift Matter docs say to set up the toolchain based on what’s in ~/Library/Developer/Toolchains, but the nightly packages actually install into /Library/Developer/Toolchains (according to this). I was grabbing the tag out of ~/Library/Developer/Toolchains/swift-latest.xctoolchain/Info.plist, which was pointing to a very old toolchain.

Unfortunately, after fixing that up, I still get the error with the latest 6.1 toolchain, which seem to be more recent than main. I'll try main just to be thorough:

error: compile command failed due to signal 6 (use -v to see invocation)
Assertion failed: (wrapperModule && "CxxShim module is required when using members of a base class. " "Make sure you `import CxxShim`."), function getInteropStaticCastDeclRefExpr, file ClangImporter.cpp, line 5183.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: /Library/Developer/Toolchains/swift-6.1-DEVELOPMENT-SNAPSHOT-2025-01-23-a.xctoolchain/usr/bin/swift-frontend ...

Okay, it works with a main branch build, but not 6.1.

Thank you!