Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_RCTSetLogFunction build failure in release mode fixed with Dead Code Stripping = No #25745

Closed
elicwhite opened this issue Jul 20, 2019 · 1 comment
Labels
Bug Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@elicwhite
Copy link
Member

I created a new project with 0.60.4. I was able to build and deploy the app to my physical iOS device with Debug scheme. I wanted to build for release by following the instructions here: https://facebook.github.io/react-native/docs/running-on-device

Specifically this line "go to Product → Scheme → Edit Scheme. Select the Run tab in the sidebar, then set the Build Configuration dropdown to Release."

After making that change I tried building a release mode version of the app to my device and the build failed with:

Undefined symbol: _RCTSetLogFunction

I found this stack overflow article that says

in the "Linking" section, find"Dead Code Stripping" section and change it "No"

This change made the build pass successfully.

It looks like this is a common problem that has been around for a long time. It would be great to either change the default or figure out how to keep this code from being dead code eliminated.

System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz
Memory: 273.86 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4

@elicwhite elicwhite added the Bug label Jul 20, 2019
@react-native-bot
Copy link
Collaborator

Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

👉 Click here if you want to take another look at the Bug Report issue template.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: Needs More Information labels Jul 20, 2019
vovkasm pushed a commit to vovkasm/react-native that referenced this issue Aug 7, 2019
Summary:
Fixes facebook#25745, Xcode stripped dead code in Release mode, and in template test code, it should only run in Debug mode, so we can use a macro to fix this issue.

## Changelog

[iOS] [Fixed] - Fixes template build failed in release mode
Pull Request resolved: facebook#25751

Test Plan:
1. Create a new project using `react-native init AwesomProject`.
2. Change project target scheme to `Release`.
3. Build and it should success.

Differential Revision: D16442643

Pulled By: TheSavior

fbshipit-source-id: f08ed70523aa1aa418064465f8df367a06e8974f
(cherry picked from commit 0fcaca8)
@facebook facebook locked as resolved and limited conversation to collaborators Oct 7, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants