Skip to content

sherpa-onnx.rn 1.3.2-beta.1: iOS link misses -lutf8proc when prebuilt/ios/current is from an earlier version #513

Closed

Description

@abretonc7s

Summary

An iOS simulator build of Sherpa Voice (1.2.0, commit 98600ee, with @siteed/sherpa-onnx.rn 1.3.2-beta.1 / sherpa-onnx v2.0.1 from #510) fails at the final link:

Undefined symbols for architecture arm64:
  "_utf8proc_NFC", referenced from:
      sherpa_onnx::NormalizeNfc(...) in libsherpa-onnx-core.a[arm64][138](text-utils.cc.o)
  "_utf8proc_category", "_utf8proc_free", "_utf8proc_tolower" (same object)
ld: symbol(s) not found for architecture arm64

The EAS iOS production (device) build of the same commit links and finishes (build 98a59eac).

The binary is fine

Checked on the failing checkout (packages/sherpa-onnx.rn/prebuilt/ios/simulator/libutf8proc.a):

  • lipo -info: fat, x86_64 arm64.
  • arm64 slice objects: LC_BUILD_VERSION platform 7 (iOS Simulator), minos 14.0, the same as libsherpa-onnx-core.a.
  • nm -gU on the thin arm64 slice exports _utf8proc_NFC, _utf8proc_category, _utf8proc_free and _utf8proc_tolower.

Root cause: -lutf8proc never reaches the link

The app's final link line has -lsherpa-onnx-core, -lonnxruntime and the other Sherpa libraries, but no -lutf8proc. The generated Pods-*.debug.xcconfig has -l"sherpa-onnx-core" and -l"onnxruntime" and no -l"utf8proc".

CocoaPods builds those -l flags from vendored_libraries (prebuilt/ios/current/<lib>) that exist at pod install time. The podspec's prepare_command only creates the current/ symlinks when prebuilt/ios/current/libonnxruntime.a is missing ("Symlinks already exist, skipping"). A checkout that had the previous Sherpa set in current/ keeps it: libutf8proc.a is new in the v2.0.1 set, so it has no symlink at pod install, and CocoaPods drops it. The "Link Sherpa ONNX Libraries" script phase does add the symlink later, but only during the build, after the flags were generated.

Fresh checkouts (such as EAS builds) create every symlink, so they link. Any reused checkout or cached prebuilt/ios/current from an earlier version fails, on the simulator or the device, until current/ is rebuilt and pod install runs again.

Fix

  • prepare_command (and install.js, if it does the same) checks every library in sherpa_libraries, not just libonnxruntime.a, and recreates any missing or stale symlink.
  • Optionally, add the -l flags to pod_target_xcconfig/user_target_xcconfig explicitly, so the link no longer depends on which files exist at install time.
  • scripts/sherpa-prebuilt-contract.js (or a podspec check) fails loudly when a listed library has no current/ link at install.
  • Release as 1.3.2-beta.2.

Proof

  • An iOS simulator development build of apps/sherpa-voice links and its main flow runs, starting from a checkout that has an earlier version's current/ and from a fresh one.
  • The EAS iOS device build still links.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions