Undefined symbols for architecture x86_64 (glog), w/ use_frameworks!, Hermes
See original GitHub issue🐛 Bug Report
When I build my react-native app with Xcode I get the following error. I seem to be getting an error about glog in NotificationService, which is Dependencies in myapp.
Undefined symbols for architecture x86_64:
"google::ErrnoLogMessage::ErrnoLogMessage(char const*, int, int, long long, void (google::LogMessage::*)())", referenced from:
folly::fibers::StackCache::borrow(unsigned long) in libFlipper-Folly.a(GuardPageAllocator.o)
folly::fibers::StackCache::StackCache(unsigned long, unsigned long) in libFlipper-Folly.a(GuardPageAllocator.o)
folly::fibers::StackCache::~StackCache() in libFlipper-Folly.a(GuardPageAllocator.o)
"google::InitVLOG3__(google::SiteFlag*, int*, char const*, int)", referenced from:
folly::EventBase::~EventBase() in libFlipper-Folly.a(EventBase.o)
folly::EventBase::SmoothLoopTime::setTimeInterval(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l> >) in libFlipper-Folly.a(EventBase.o)
folly::EventBase::loopBody(int, bool) in libFlipper-Folly.a(EventBase.o)
folly::EventBase::nothingHandledYet() const in libFlipper-Folly.a(EventBase.o)
folly::EventBase::bumpHandlingTime() in libFlipper-Folly.a(EventBase.o)
folly::EventBase::terminateLoopSoon() in libFlipper-Folly.a(EventBase.o)
folly::EventBase::SmoothLoopTime::SmoothLoopTime(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l> >) in libFlipper-Folly.a(EventBase.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
To Reproduce
I have enabled use_frameworks! (dependent library constraints), Hermes and Flipper are also enabled.
Podfile (excerpt) ↓. I have also added some workarounds in reference to other issues.
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target_version = '11.0'
platform :ios, target_version
target 'myapp' do
use_frameworks! :linkage => :static
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => true
)
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# https://github.com/facebook/flipper/blob/2e9ab310bd135e94b806916412d447c0e9ee3de9/react-native/ReactNativeFlipperExample/ios/Podfile#L30
use_flipper!({ 'Flipper' => '0.150.0', 'Flipper-Folly' => '2.6.10', 'Flipper-DoubleConversion' => '3.2.0', 'Flipper-Glog' => '0.5.0.3', 'Flipper-PeerTalk' => '0.0.4', 'OpenSSL-Universal' => '1.1.1100' })
# https://fbflipper.com/docs/getting-started/ios-native/
#
# If you use `use_frameworks!` in your Podfile,
# uncomment the below $static_framework array and also
# the pre_install section. This will cause Flipper and
# it's dependencies to be built as a static library and all other pods to
# be dynamic.
#
# NOTE Doing this may lead to a broken build if any of these are also
# transitive dependencies of other dependencies and are expected
# to be built as frameworks.
$static_framework = [
'FlipperKit', 'Flipper', 'Flipper-Folly',
'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native', 'Flipper-Fmt',
]
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if $static_framework.include?(pod.name)
def pod.build_type;
Pod::BuildType.static_library
end
end
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
# https://github.com/facebook/react-native/issues/32451#issuecomment-1162994787
if target.name == "RCT-Folly"
target.build_configurations.each do |config|
config.build_settings['HEADER_SEARCH_PATHS'] = "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/libevent/include/\" \"$(PODS_ROOT)/fmt/include\" \"$(PODS_ROOT)/glog\""
config.build_settings['OTHER_LDFLAGS'] = "\"-Wl,-U,_jump_fcontext\" \"-Wl,-U,_make_fcontext\""
end
end
end
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
install pods and build RN app with xcode.
Environment
M1 pro Flipper Desktop version: 0.150.0 XCode version: 13.3 react: 17.0.2 react-native: 0.66.3 flipperkit version in Pods: 0.150.0
Issue Analytics
- State:
- Created a year ago
- Reactions:14
- Comments:16
Top Results From Across the Web
Symbol(s) not found for architecture x86_64 in Xcode 13
1 Answer 1 · Clicking on your project in the upper left of the left pane (the blue icon). · In the middle...
Read more >Fixing React Native build error: Undefined symbols for ...
While running yarn ios for React Native v0.64.2 on my mac machine (macOS 11.6, XCode 13) i've encountered following error: Undefined symbols ......
Read more >5 duplicate symbols for architecture x86_64 react native
I am receiving the error "5 duplicate symbols for architecture x86_64" when attempting to launch my React Native project in Xcode. I am...
Read more >React Native Firebase Analytics: Undefined symbols for ...
When I tried to build the project with expo run:ios , I got the following error. ❌ Undefined symbols for architecture x86_64 ┌─...
Read more >UnityFramework Plugin won't compile (undefined symbols for ...
ld: symbol(s) not found for architecture x86_64 ... The built Unity-iPhone.xcodeproj w/ the plugin compiles/runs fine independently in the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sairajKalkundre Flipper does not work with any form of
use_frameworks!
in your Podfile, as clearly stated in all parts of this issue.For future readers: until you see some discussion of a patch to try, or you are proposing a patch to try, Flipper will simply not work with use_frameworks and of course you will experience the same issue. Posting the same is a sort of “metoo” and is best handled as a reaction (thumbs up or similar) on this issue itself, way up at the top.
Thanks
That background info (that you tried, and what the real scope of solution is), is still great information, thanks @Kudo.
Flipper team, the documentation currently states how to get use_frameworks to work on Flipper but those documents do not result in a successful build. Is this on your radar at all for a fix?
My motivation is that react-native-firebase requires use_frameworks now, and I’d like to get this to work out of the box for people. Going by npmjs stats we appear to represent about 25% of all react-native usage (266K/week vs 1000K/week) so perhaps it is worth a look?