External macro implementation type could not be found for macro 'stringify'

Hi.

I created a new swift macro package and wan't to start using the template which contains the #stringify macro out of the box without any changes.

The package itself runs incl. tests

But now I added the Package to a dummy iOS app project / workspace and I can't compile if im using this code let (_, _) = #stringify(a + b) + package import

Compile error: External macro implementation type '***.StringifyMacro' could not be found for macro 'stringify'

I am using Xcode 15 and macOS 13.5.2 Restart Xcode, Clean etc doesn't help.

Can anyone help my ? Thanks :)

Did you find a solution to the problem ? I've posted a similar issue here.

Did you find a solution yet ? I've posted a similar issue here.

I had the same issue and after hours found the solution on my side.

For our library we had to define a macOS support version besides iOS for SwiftSyntaxMacros. Locally we used MacOS 14 and set it to 14. On the Server we were running 13.X. We did not get a error for the MacOS support version only "error: external macro implementation type 'foo' could not be found for macro 'foo'".

After setting it to MacOS 12 the issue was gone:

platforms: [.macOS(.v12), .iOS(.v15)],

I hope this is useful for you. Online I found no solutions for this issue.

My solution was that I had the following:

public macro CreateCustomType() = #externalMacro(module: "CustomType", type: "CreateCustomTypeMacro")

And changing to this (the .macro target name) fixed it:

public macro CreateCustomType() = #externalMacro(module: "CustomTypeMacros", type: "CreateCustomTypeMacro")

In my case, i forgot to add the Macros library product (see Package.swift > .products > .library > .name) to the project's libraries.

In the Xcode Navigator, select <Your Project>/Targets/<Your Target>/"Frameworks, Libraries, and Embedded Content") and pick the item having a library icon.

External macro implementation type could not be found for macro 'stringify'
 
 
Q