Repository navigation
Closed
Labels
Impact: Errors During BuildPlatform: iOSiOS applications.iOS applications.Priority: HighResolution: FixedA PR that fixes this issue has been merged.A PR that fixes this issue has been merged.Tech: React Native CoreIssue related to the Core of React NativeIssue related to the Core of React NativeType: New ArchitectureIssues and PRs related to new architecture (Fabric/Turbo Modules)Issues and PRs related to new architecture (Fabric/Turbo Modules)
Description
Description
I am unable to build release version for iOS with the new architecture. But I can build the debug version.
Here is build error
Undefined symbols for architecture x86_64:
"folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::deferredReaders", referenced from:
void folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::applyDeferredReaders<folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::WaitForever>(unsigned int&, folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::WaitForever&) in AppDelegate.o
void folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::applyDeferredReaders<folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::WaitForever>(unsigned int&, folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::WaitForever&, unsigned int) in AppDelegate.o
"folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::unlock()", referenced from:
std::__1::unique_lock<folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false> >::~unique_lock() in AppDelegate.o
"folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::~SharedMutexImpl()", referenced from:
std::__1::__shared_ptr_emplace<facebook::react::ContextContainer const, std::__1::allocator<facebook::react::ContextContainer const> >::__on_zero_shared() in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
Version
0.68.1
Output of npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 12.3.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 749.82 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 18.0.0 - ~/.nvm/versions/node/v18.0.0/bin/node
Yarn: 1.22.18 - ~/.nvm/versions/node/v18.0.0/bin/yarn
npm: 8.6.0 - ~/.nvm/versions/node/v18.0.0/bin/npm
Watchman: 2022.03.21.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /Users/wood/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8309675
Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
Languages:
Java: 11.0.15 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.1 => 0.68.1
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to reproduce
- npx react-native init AwesomeTSProject --template react-native-template-typescript
- Run RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
- npx react-native run-ios --configuration Release
Snack, code example, screenshot, or link to a repository
Undefined symbols for architecture x86_64:
"folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::deferredReaders", referenced from:
void folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::applyDeferredReaders<folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::WaitForever>(unsigned int&, folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::WaitForever&) in AppDelegate.o
void folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::applyDeferredReaders<folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::WaitForever>(unsigned int&, folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::WaitForever&, unsigned int) in AppDelegate.o
"folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::unlock()", referenced from:
std::__1::unique_lock<folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false> >::~unique_lock() in AppDelegate.o
"folly::SharedMutexImpl<false, void, std::__1::atomic, false, false, false>::~SharedMutexImpl()", referenced from:
std::__1::__shared_ptr_emplace<facebook::react::ContextContainer const, std::__1::allocator<facebook::react::ContextContainer const> >::__on_zero_shared() in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
Reacted by LeoTM, Krystof Woldrich and Biao Geng
Metadata
Metadata
Assignees
Labels
Impact: Errors During BuildPlatform: iOSiOS applications.iOS applications.Priority: HighResolution: FixedA PR that fixes this issue has been merged.A PR that fixes this issue has been merged.Tech: React Native CoreIssue related to the Core of React NativeIssue related to the Core of React NativeType: New ArchitectureIssues and PRs related to new architecture (Fabric/Turbo Modules)Issues and PRs related to new architecture (Fabric/Turbo Modules)
Activity
tj-mc commentedon May 6, 2022
Followed steps but unable to reproduce on M1 Pro
wood1986 commentedon May 6, 2022
I missed the step. But did you RCT_NEW_ARCH_ENABLED=1 bundle exec pod install?
Arkkeeper commentedon May 15, 2022
This issue persists both in RN 0.68.x and 0.69 when trying to build release version or to make an archive.
I'm facing it when building for MacCatalyst on M1.
You may add these lines to the end of post_install do |installer| as a temporary solution:
rm -f Pods/Flipper-Folly/folly/SharedMutex.cpp Pods/Flipper-Folly/folly/SharedMutex.hcp Pods/RCT-Folly/folly/SharedMutex.cpp Pods/Flipper-Folly/folly/cp Pods/RCT-Folly/folly/SharedMutex.h Pods/Flipper-Folly/folly/fabOnReact commentedon May 15, 2022
#33167 https://github.com/facebook/folly/blob/main/folly/docs/Futures.md
cipolleschi commentedon May 18, 2022
Hi @wood1986, thanks for the issue. Is the issue solved with the #33167 linked by @fabriziobertoglio1987 or is it still there?
cortinico commentedon May 18, 2022
@cipolleschi Nope I don't think the linked PR is relevant here. Such PR was fixing a build failure on Android, while the user is reporting an issue on iOS
fabOnReact commentedon May 18, 2022
sorry. I don't know the solution to this issue. I just included links to relevant conversations, which would help me find a solution. What I did find out is the following:
Similar issue was experienced in the past. The symbol error was previously caused by folly depending on libc++abi
8b6d7fd
seems that https://stackoverflow.com/a/33686591/7295772 different environment use different libraries
https://gcc.gnu.org/onlinedocs/gcc-11.3.0/libstdc++/api/a00176_source.html
8b6d7fd#diff-5de3520951eb222bc3b5b734cc1003e84a53fb42220159fedc58768bda2e2cf3R75
this are the folly releases https://github.com/facebook/folly/releases. I did not find anything relevant in the new releases.
@Arkkeeper understand this issue and he tested this solution
so seems that the issue is caused by the Flipper-Folly SharedMutex , while it works with RCT-Folly SharedMutex
this are the configs for folly futures in Flipper-Folly
https://github.com/facebook/flipper/blob/0f038218f893d86e91714cd91eed8e37d756386c/iOS/Podspecs/Flipper-Folly.podspec#L74
this are the configs for folly-futures in RCT-Folly
https://github.com/facebook/react-native/blob/main/third-party-podspecs/RCT-Folly.podspec#L106-L148
I'm not sure that this is connected to futures
The above PR fixed the issue in folly futures, https://github.com/facebook/folly/blob/b72a70a35ada45ac286eb60028c0ecf5f6725665/folly/SharedMutex.h#L554-L571 as the undefined reference was
unlock_sharedThis is an explanation of unlock_shared, deferredReaders seems to be an array of readers used to access data
https://github.com/facebook/folly/blob/69b6f947ea9aeb73235ccabf235a6804e0f54946/folly/SharedMutex.h#L128-L161
in this case the undefined symbol is
folly::SharedMutexImpl<..>::deferredReadersIt's 22:35 here and I have to go to sleep. Sorry for my incomplete message. 🙏
I'll come back to this post in the future. Thanks.
wood1986 commentedon May 20, 2022
I have a question for you guys.
Doing this does not make sense
If I comment out
use_flipper!()in the Podfile, I can build release successfully. Is building release without flipper the best practice?6 remaining items
Fix prod build error w Flipper, set env flag
leotm commentedon Jul 20, 2022
no longer getting the original issue with
PRODUCTION= 1 pod installafter updating Podfile, updated our template here toobut had Flipper downgrade to 0.125.0, just thinking the best way to config Flipper again for a custom/latest version
similar scenario will surface here
https://github.com/facebook/flipper/blob/main/react-native/ReactNativeFlipperExample/ios/Podfile
but not yet being on 0.67.4
maybe better opened as seperate/follow-up issue
wood1986 commentedon Jul 24, 2022
How to specify the flipper version in 0.69.2?
wood1986 commentedon Jul 24, 2022
I found it
Update Podfile for `PRODUCTION=1 pod install` (#34234)
leotm commentedon Aug 3, 2022
just for anyone else landing here
https://github.com/facebook/react-native/blob/463af237539b98289c88e5b491c85cbf53bcaf0c/scripts/cocoapods/flipper.rb#L105
nicely shows how to set custom Flipper version, we were unsure about at first
so it could be worth us expanding on the comment here or adding an example for others in the future
https://github.com/facebook/react-native/blob/463af237539b98289c88e5b491c85cbf53bcaf0c/template/ios/Podfile#L20
will do pronto unless somebody (feel free) beats me to it :)
iOS CI Release on `macos-12` (#690)
stefanradu1989 commentedon Nov 16, 2022
Hi,
I get this error but only when I try to archive the project so I can upload to TestFlight.
My use flipper is commented in my Podfile. (# use_flipper!())
I am running RN 0.70 Xcode 14.1
I tried the solution but it does not work:
rm -f Pods/Flipper-Folly/folly/SharedMutex.cpp Pods/Flipper-Folly/folly/SharedMutex.h
cp Pods/RCT-Folly/folly/SharedMutex.cpp Pods/Flipper-Folly/folly/
cp Pods/RCT-Folly/folly/SharedMutex.h Pods/Flipper-Folly/folly/
Did anyone solve this issue?
PS: react native info
System:
OS: macOS 13.0.1
CPU: (10) arm64 Apple M1 Pro
Memory: 55.41 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.9.0 - /usr/local/bin/node
Yarn: Not Found
npm: 8.19.1 - /usr/local/bin/npm
Watchman: 2022.09.05.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 11.0.16.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.4 => 0.70.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
cipolleschi commentedon Nov 16, 2022
@stefanradu1989 you need to reinstall the pods with
PRODUCTION=1 pod installstefanradu1989 commentedon Nov 17, 2022
@cipolleschi thank you that solved my issue
MJ0826 commentedon Apr 25, 2023
Hi,
I'm not sure if this is related to the same stuff being talked about here, but I am struggling with building the app while updating from react-native version 0.67.4 to 0.69.9. Does anyone have any idea what can be the reason behind this ?
Here are the screenShots -


cipolleschi commentedon Apr 28, 2023
@MJ0826 Can you walk throught what you did?
To me, it looks like you just run
yarn update react-nativeor something similar, but you forget to runpod installto update the dependencies.One thing that we did was to remove
folly::Optionaland replace it withstd::optional, which seems the error that you are encountering. This should go away by reinstalling cocoapods with:Secondly, this issue is about the New Architecture. Are you building for the New Arch or for the Legacy one?
Update Podfile for `PRODUCTION=1 pod install` (#34234)