Skip to content

Duplicate symbols when building using new spm_dependency even when using USE_FRAMEWORKS=dynamic during pod install #47344

Closed

Description

@TimoGlastra

Description

Adding the https://github.com/eu-digital-identity-wallet/eudi-lib-ios-iso18013-data-transfer.git package to a react native project using the new spm_dependency method available in podpsecs causes Duplicate symbols issue when building, even using USE_FRAMEWORKS=dynamic

The error is 18460 duplicate symbols.

The PR that added support for this (#44627) mentions the duplicate symbols can be fixed by using USE_FRAMEWORKS=dynamic during pod install, but this does not seem to address the issue.

Steps to reproduce

The reproduction repo is a freshly initialized react native project on 0.76.1, with the most minimal local module added just to add the podspec loading.

  • Clone https://github.com/TimoGlastra/react-native-swift-package-manager-issue
  • npm install
  • cd ios && USE_FRAMEWORKS=dynamic pod install
  • Open in xcode and build.

React Native Version

0.76.1

Affected Platforms

Build - MacOS

Output of npx react-native info

System:
  OS: macOS 14.6.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 89.81 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v20.11.1/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v20.11.1/bin/npm
  Watchman:
    version: 2024.09.30.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.15989.150.2411.11948838
  Xcode:
    version: 16.0/16A242
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.2
    path: /usr/bin/javac
  Ruby:
    version: 3.3.5
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0
    wanted: 15.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.1
    wanted: 0.76.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

18460 duplicate symbols

Reproducer

https://github.com/TimoGlastra/react-native-swift-package-manager-issue

Screenshots and Videos

image

Activity

  1. TimoGlastra commented on Oct 31, 2024

    @TimoGlastra
    Author

    @mfazekas as the original author of the new spm_dependency feature (thanks for that!), do you have an idea why the duplicate symbols error still comes up even though USE_FRAMEWORKS=dynamic is used?

  2. mfazekas commented on Oct 31, 2024

    @mfazekas
    Contributor

    @TimoGlastra sorry no. Note that spm_dependency is not magic. It's add the package dependency to the Xcode workspace, and it also links the pod with the dependency - see the example in #44627 (comment). All stuff you can do by hand with Xcode.

    So if you can figure out what Xcode settings changes needed so you won't have duplicate symbols then it's likely can be implemented.

  3. TimoGlastra commented on Nov 1, 2024

    @TimoGlastra
    Author

    Thanks for the quick response @mfazekas. And your suggestions helped.

    I was able to track down the issue, my podspec defined static_framework true, which diddn't work with using a dynamic framework for swift packages

    The other problem I now have is that ExpoModuleCore is a static framework and a dynamic framework can't depend on a static framework, but to use SPM packages we need it be dynamic -- but that's another issue for the expo repo.

  4. hietalajulius commented on Nov 2, 2024

    @hietalajulius

    Thanks for the quick response @mfazekas. And your suggestions helped.

    I was able to track down the issue, my podspec defined static_framework true, which diddn't work with using a dynamic framework for swift packages

    The other problem I now have is that ExpoModuleCore is a static framework and a dynamic framework can't depend on a static framework, but to use SPM packages we need it be dynamic -- but that's another issue for the expo repo.

    Let us know if you figure out using spm_dependency with custom expo modules 👍

  5. TimoGlastra commented on Nov 2, 2024

    @TimoGlastra
    Author

    For now i just created a turbo module and skipped expo modules as that seems to work alright and I already lost about a week of time on this 😅

    If i have the time i want to create a minimal expo reproduction and open an issue. But i think changes are needed in Expo modules to support this.

    I quickly tried modifying the expo modules and removing the static_framework but that broke a lot of other things

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions