Symbol not found vDSP.dot

Hi there, I have following crash during application start on iOS below 15.0, even in simulator

dyld: Symbol not found: _$s10Accelerate4vDSPO3dotySfx_q_tAA0A6BufferRzAaER_Sf7ElementRtzSfAFRt_r0_lFZ

Referenced from: /Users/Nikita/Library/Developer/CoreSimulator/Devices/21071B75-CC1F-46E5-94B3-5E01072B90C6/data/Containers/Bundle/Application/73D74763-449A-4E20-B7EB-8807008B335B/vDSP test.app/vDSP test

Expected in: /usr/lib/swift/libswiftAccelerate.dylib

Sample code is very simple and looks like this:

        let vector1: [Float] = [0, 1, 2, 3, 4, 5, 6, 7]
        let vector2: [Float] = [0, 1, 2, 3, 4, 5, 6, 7]

        // Causes crash on application start
        let result = vDSP.dot(vector1, vector2)

        // Works fine
        let resultMul = vDSP.multiply(vector1, vector2)
        let result1 = vDSP.sum(resultMul)

According to docs, vDSP.dot is available since iOS 13.0.

Hi, please can you confirm your Xcode and macOS version? I'm able to run your code without problems on Monterey and Xcode 13 without issue.

macOS Monterey, Xcode 13.4.1

  • iOS simulator: iPhone XS Max 14.5
  • real device: iPhone XS Max 14.6

Apple are aware of this issue and investigating. In the meantime, the following code will work around the issue:

func dot(_ vectorA: [Float],
         _ vectorB: [Float]) -> Float {

    precondition(vectorA.count == vectorB.count)

    let n = vDSP_Length(vectorA.count)
    var result = Float.nan

    vectorA.withUnsafeBufferPointer { a in
        vectorB.withUnsafeBufferPointer { b in
            vDSP_dotpr(a.baseAddress!, 1,
                       b.baseAddress!, 1,
                       &result, n)
        }
    }
    return result
}
Symbol not found vDSP.dot
 
 
Q