Skip to content

iOS old architecture cannot find libsodium because Clibsodium.xcframework is missing from npm package #86

@charleyoliveira

Description

@charleyoliveira

Summary

When using react-native-libsodium 1.5.0 on the old React Native architecture (ENV['RCT_NEW_ARCH_ENABLED'] != '1'), pod install completes but the Xcode build still fails because the podspec points to a non-existent XCFramework:

s.vendored_frameworks = "libsodium/build/libsodium-apple/Clibsodium.xcframework"

The npm package only ships the static libraries (ios/lib/libsodium.a and ios-simulators/lib/libsodium.a), so CocoaPods can’t find the expected Clibsodium.xcframework and linking fails (ld: library 'sodium' not found).

Steps to reproduce

  1. Install [email protected] in a project that still uses the old architecture.
  2. Run cd ios && pod install.
  3. Build for the iOS simulator.

Expected

pod install and the Xcode link step succeed because the vendored framework exists.

Actual

pod install completes, but building the app fails with ld: library 'sodium' not found unless I manually create libsodium/build/libsodium-apple/Clibsodium.xcframework on my machine.

# local workaround (needed to unblock builds)
xcodebuild -create-xcframework \
  -library node_modules/react-native-libsodium/libsodium/build/libsodium-apple/ios/lib/libsodium.a \
  -headers node_modules/react-native-libsodium/libsodium/build/libsodium-apple/ios/include \
  -library node_modules/react-native-libsodium/libsodium/build/libsodium-apple/ios-simulators/lib/libsodium.a \
  -headers node_modules/react-native-libsodium/libsodium/build/libsodium-apple/ios-simulators/include \
  -output node_modules/react-native-libsodium/libsodium/build/libsodium-apple/Clibsodium.xcframework

Proposed fix

Either:

  1. Ship libsodium/build/libsodium-apple/Clibsodium.xcframework inside the npm tarball, matching the current podspec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions