question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Solution: Upgrading from 0.61.5 to 0.62.0 "Undefined symbol: _swift_getFunctionReplacement"

See original GitHub issue

Environment

System:
    OS: macOS 10.15.3
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 123.51 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.14.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.13.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 23.0.1, 25.0.3, 26.0.1, 27.0.3, 28.0.3, 29.0.0
      System Images: android-19 | ARM EABI v7a, android-19 | Google APIs ARM EABI v7a, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.0 => 0.62.0 
  npmGlobalPackages:
    react-native-clean-project: 3.2.4
    react-native-cli: 2.0.1
    react-native-create-library: 3.1.2
    react-native-template-typescript: 5.2.0
    react-native: 0.60.4

Upgrading version

Upgrading from 0.61.5 to 0.62.0

Problem

Initial upgrade steps

  1. I started by following the 0.61.5 to 0.62.0 RN upgrade helper. I performed all the changes shown in the diffs from the upgrade helper tool.

  2. For the project.pbxproj changes, I proceeded to follow all four steps in the React Native 0.62 upgrade explanation in this repo.

I encountered the following errors when attempting to build iOS

Showing All Errors Only
Undefined symbol: _swift_getFunctionReplacement
Undefined symbol: _swift_getOrigOfReplaceable

More detailed error

Undefined symbols for architecture x86_64:
  "_swift_getFunctionReplacement", referenced from:
      _swift_getFunctionReplacement50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getFunctionReplacement50)
  "_swift_getOrigOfReplaceable", referenced from:
      _swift_getOrigOfReplaceable50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getOrigOfReplaceable50)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I found that some folks with the same error details in this issue thread from TelegramMessenger (completely unrelated to my app) but they seemed to find a solution by enabling dead code stripping.

I enabled Dead Code Stripping in Build Settings for DEBUG in EACH target of my project (we have 4). Dead code stripping was already enabled in the release configuration for all the targets and in the project build settings/ image

After enabling dead code stripping, I was able to build but the app would crash immediately with the following error

This copy of libswiftCore.dylib requires an OS version prior to 12.2.0

In order to fix this, I followed the steps in this SO answer, namely:

  • Added a Dummy.swift file to the project (I already had bridging header files from following the steps in issue #13 of this repo.
  • Set Always Embed Swift Standard Libraries to YES in the build settings for my project and all my targets.

Solution

So in summary, my complete upgrade steps were

  1. Follow the 0.61.5 to 0.62.0 RN upgrade helper.

  2. For the project.pbxproj changes, follow all four steps in the React Native 0.62 upgrade explanation in this repo.

  3. Enable Dead Code Stripping in Build Settings for both debug and release in each project target

  4. Set Always Embed Swift Standard Libraries to YES in the build settings for my project and all my targets.

  5. Either add a Dummy.swift file to the project, or don’t delete the dummy swift file that you created in step 2 (the issue #13 in this repo).

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:233
  • Comments:30

github_iconTop GitHub Comments

78reactions
ptgamrcommented, Jul 14, 2020

Following the SOLUTIONS in the topic works for me, just one thing:

Enable Dead Code Stripping --> This needed to be done for the TARGETS level, not PROJECT level

46reactions
ovy9086commented, Apr 2, 2020

setting DEAD_CODE_STRIPPING to TRUE solved it for me 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrading React Native from 0.61.5 to 0.62.3 - Medium
In my case i had to upgrade from version 0.61.5 to 0.62.3, mainly because ... to debug and test apps built on versions...
Read more >
React-native upgrade from 0.61.5 to 0.63.2: TypeError
I fixed the problem by updating dependencies and devDependencies to the latest versions. I guess the better solution would be to find out ......
Read more >
Upgrade to React Native 0.62 - Matt Oakes
React Native 0.62 has been a long time coming and brings many changes, large and small. This article explains what's new, how to...
Read more >
Upgrading to new versions - React Native
Upgrading your Expo project to a new version of React Native requires updating the react-native , react , and expo package versions in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found