Linker error using swift-numerics and C module

$ swift build
Building for debugging...
error: link command failed with exit code 1 (use -v to see invocation)
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:220: error: undefined reference to 'pow'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:156: error: undefined reference to 'cos'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:160: error: undefined reference to 'sin'
# ... many, many more ...
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:340: error: undefined reference to 'powl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:348: error: undefined reference to 'atan2l'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:381: error: undefined reference to 'lgammal_r'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
error: fatalError

My package manifest looks something like this:

let package = Package(
    name: "foo",
    dependencies: [
        .package(url: "https://github.com/apple/swift-numerics", from: "1.0.0"),
    ],
    targets: [
        .target(name: "SomeCModule"),
        .executableTarget(
            name: "SomeSwiftModule",
            dependencies: [
                .product(name: "RealModule", package: "swift-numerics"),
                .target(name: "SomeCModule")
            ],
            path: "Sources/SomeSwiftModule"
        ),
    ]
)

I know that you can get these either through the C stdlib or through swift-numerics, but apparently if you depend on both swift-numerics and C code the linker breaks.

The weird part is the C code doesn't even use math.h.

What platform are you on, what architecture are you building for, what version of Numerics is resolved, etc?

Also, can you capture the actual link command that's being invoked?

Iā€™m using Swift 5.9 for x86-64 Ubuntu 22.04 in WSL. Numerics has been resolved to version 1.0.2 (commit 0a5bc04095a675662cf24757cc0640aa2204253b).

Full output of swift build -v
Building for debugging...
/home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/bin/swiftc -v -L /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug -o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM -module-name JSVM -emit-executable -Xlinker --defsym -Xlinker main=JSVM_main -Xlinker '-rpath=$ORIGIN' @/home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.product/Objects.LinkFileList -target x86_64-unknown-linux-gnu -L /home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/lib
Swift version 5.9 (swift-5.9-RELEASE)
Target: x86_64-unknown-linux-gnu
/home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/bin/swift-autolink-extract /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/CStringHelper.build/InternedStrings.c.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSFunction.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSObject.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSSymbol.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSVM.swiftmodule.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/MiscTypes.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Numeric/JSBigInt.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Numeric/JSNumber.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Numeric/JSNumeric.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/String/CStrings+Collection.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/String/JSString+Interned.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/String/JSString.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Util.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/main.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/AlgebraicField.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/ApproximateEquality.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/AugmentedArithmetic.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Double+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/ElementaryFunctions.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Float+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Float16+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Float80+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/RealFunctions.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/RealModule.swiftmodule.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/_NumericsShims.build/_NumericsShims.c.o -o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/CStringHelper.build/JSVM.autolink
/home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/bin/clang -fuse-ld=gold -pie -Xlinker -rpath -Xlinker /home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/lib/swift/linux /home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/lib/swift/linux/x86_64/swiftrt.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/CStringHelper.build/InternedStrings.c.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSFunction.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSObject.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSSymbol.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSVM.swiftmodule.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/MiscTypes.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Numeric/JSBigInt.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Numeric/JSNumber.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Numeric/JSNumeric.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/String/CStrings+Collection.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/String/JSString+Interned.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/String/JSString.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Util.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/main.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/AlgebraicField.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/ApproximateEquality.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/AugmentedArithmetic.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Double+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/ElementaryFunctions.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Float+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Float16+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Float80+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/RealFunctions.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/RealModule.swiftmodule.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/_NumericsShims.build/_NumericsShims.c.o @/home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/CStringHelper.build/JSVM.autolink -L /home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/lib/swift/linux -lswiftCore --target=x86_64-unknown-linux-gnu -v -L /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug -L /home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/lib -Xlinker --defsym -Xlinker main=JSVM_main -Xlinker '-rpath=$ORIGIN' -o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM
error: link command failed with exit code 1 (use -v to see invocation)
clang version 13.0.0 (https://github.com/apple/llvm-project.git 8ee3f51668ac68de50d541a815f00859f4922f98)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/bin/ld.gold" -pie -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM /lib/x86_64-linux-gnu/Scrt1.o /lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/lib/swift/linux -L/home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug -L/home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/lib -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib -rpath /home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/lib/swift/linux /home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/lib/swift/linux/x86_64/swiftrt.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/CStringHelper.build/InternedStrings.c.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSFunction.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSObject.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSSymbol.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/JSVM.swiftmodule.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/MiscTypes.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Numeric/JSBigInt.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Numeric/JSNumber.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Numeric/JSNumeric.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/String/CStrings+Collection.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/String/JSString+Interned.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/String/JSString.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/Util.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/JSVM.build/main.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/AlgebraicField.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/ApproximateEquality.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/AugmentedArithmetic.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Double+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/ElementaryFunctions.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Float+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Float16+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Float80+Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/Real.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/RealFunctions.swift.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/RealModule.build/RealModule.swiftmodule.o /home/bbrk24/workspace/JSVM/.build/x86_64-unknown-linux-gnu/debug/_NumericsShims.build/_NumericsShims.c.o -lswiftSwiftOnoneSupport -lswiftCore -lswift_Concurrency -lswift_StringProcessing -lswiftCore --defsym main=JSVM_main "-rpath=\$ORIGIN" -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /lib/x86_64-linux-gnu/crtn.o
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:220: error: undefined reference to 'pow'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:156: error: undefined reference to 'cos'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:160: error: undefined reference to 'sin'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:164: error: undefined reference to 'tan'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:168: error: undefined reference to 'acos'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:172: error: undefined reference to 'asin'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:176: error: undefined reference to 'atan'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:180: error: undefined reference to 'cosh'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:184: error: undefined reference to 'sinh'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:188: error: undefined reference to 'tanh'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:192: error: undefined reference to 'acosh'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:196: error: undefined reference to 'asinh'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:200: error: undefined reference to 'atanh'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:204: error: undefined reference to 'exp'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:208: error: undefined reference to 'expm1'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:212: error: undefined reference to 'log'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:216: error: undefined reference to 'log1p'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:232: error: undefined reference to 'erf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:236: error: undefined reference to 'erfc'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:240: error: undefined reference to 'exp2'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:251: error: undefined reference to 'hypot'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:255: error: undefined reference to 'tgamma'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:259: error: undefined reference to 'log2'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:263: error: undefined reference to 'log10'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:220: error: undefined reference to 'pow'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:220: error: undefined reference to 'pow'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:220: error: undefined reference to 'pow'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:224: error: undefined reference to 'cbrt'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:228: error: undefined reference to 'atan2'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:269: error: undefined reference to 'lgamma_r'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:31: error: undefined reference to 'cosf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:35: error: undefined reference to 'sinf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:39: error: undefined reference to 'tanf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:43: error: undefined reference to 'acosf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:47: error: undefined reference to 'asinf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:51: error: undefined reference to 'atanf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:55: error: undefined reference to 'coshf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:59: error: undefined reference to 'sinhf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:63: error: undefined reference to 'tanhf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:67: error: undefined reference to 'acoshf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:71: error: undefined reference to 'asinhf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:75: error: undefined reference to 'atanhf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:79: error: undefined reference to 'expf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:83: error: undefined reference to 'expm1f'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:87: error: undefined reference to 'logf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:91: error: undefined reference to 'log1pf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:107: error: undefined reference to 'erff'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:111: error: undefined reference to 'erfcf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:115: error: undefined reference to 'exp2f'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:130: error: undefined reference to 'hypotf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:135: error: undefined reference to 'tgammaf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:139: error: undefined reference to 'log2f'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:143: error: undefined reference to 'log10f'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:95: error: undefined reference to 'powf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:95: error: undefined reference to 'powf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:95: error: undefined reference to 'powf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:95: error: undefined reference to 'powf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:99: error: undefined reference to 'cbrtf'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:103: error: undefined reference to 'atan2f'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:149: error: undefined reference to 'lgammaf_r'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:276: error: undefined reference to 'cosl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:280: error: undefined reference to 'sinl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:284: error: undefined reference to 'tanl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:288: error: undefined reference to 'acosl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:292: error: undefined reference to 'asinl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:296: error: undefined reference to 'atanl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:300: error: undefined reference to 'coshl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:304: error: undefined reference to 'sinhl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:308: error: undefined reference to 'tanhl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:312: error: undefined reference to 'acoshl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:316: error: undefined reference to 'asinhl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:320: error: undefined reference to 'atanhl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:324: error: undefined reference to 'expl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:328: error: undefined reference to 'expm1l'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:332: error: undefined reference to 'logl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:336: error: undefined reference to 'log1pl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:352: error: undefined reference to 'erfl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:356: error: undefined reference to 'erfcl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:360: error: undefined reference to 'exp2l'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:364: error: undefined reference to 'hypotl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:368: error: undefined reference to 'tgammal'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:372: error: undefined reference to 'log2l'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:376: error: undefined reference to 'log10l'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:340: error: undefined reference to 'powl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:340: error: undefined reference to 'powl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:344: error: undefined reference to 'cbrtl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:340: error: undefined reference to 'powl'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:348: error: undefined reference to 'atan2l'
.build/checkouts/swift-numerics/Sources/_NumericsShims/include/_NumericsShims.h:381: error: undefined reference to 'lgammal_r'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
error: fatalError

I do have multiple C compilers, if that matters:

C compiler list
  • clang 13 at /home/bbrk24/swift/swift-5.9-RELEASE-ubuntu22.04/usr/bin/clang-13, with a symlink to it at /home/bbrk24/swift/usr/bin/clang (this symlink is what which clang gives)
  • clang 17 at /home/bbrk24/emsdk/upstream/bin/clang-17 (not in $PATH)
  • gcc 11 at /usr/bin/x86_64-linux-gnu-gcc-11, with multiple direct and indirect symlinks to it, including from /usr/bin/gcc (what which gcc gives) and /usr/bin/cc (what which cc gives)
  • I have gcc-9-base and libgcc-9-dev installed according to apt, but I don't think I have a usable GCC 9 binary.
  • Since this is WSL, MSVC and Arduino GCC are probably reachable somewhere under /mnt/c, but I'm not going to look for them.

The build log looks like it's being cutoff horizontally, so I can't see the actual link command. I would check if it's linking the math library (and if one is expected to in WSL--I'm not familiar with it enough to know). It's possible that line 57 in Package.swift needs to be updated to link it in the WSL environment:

      linkerSettings: [
        .linkedLibrary("m", .when(platforms: [.linux, .android]))
      ]

Huh, yeah the horizontal scroll bar isn't shown, but if you select the text and copy-paste it into notepad or something the text is still present. That said, I'll try adding that linker setting.

Adding that linker setting to my executableTarget did fix it, though I'll note that it wasn't necessary before I added the C module.

1 Like

What .platform do we identify WSL as in SwiftPM?

That should identify as .linux. WSL is effectively a VM running Linux.

1 Like