Swift build with foreign x86_64 library

I have a swift library that has worked for years and imports a foreign x86_64 C library. However, I recently replaced a broken iMac with an M2 Pro chip mac mini and I need to make some changes to the library. Now Xcode can't compile the package, saying it's ignoring the foreign library because it is not arm64 based. Moreover, if I try to compile with swift build it says it builds fine, but when I run swift test, it gives me a similar arm64 message.

Is there a way to fix this, both for xcode and raw swift? Both macOS and Xcode are latest versions.

Thanks in advance, Rick

Just to be clear, although it should be obvious from the 'swift build' comment, what I;'m trying to compile is a swift package. It is to be used in a command line executable.

Swift build with foreign x86_64 library
 
 
Q