Skip to content

Undefined symbols for architecture arm64 #652

@francoangulo

Description

@francoangulo

So like the title of this issue says, I'm getting Undefined symbols for architecture arm64 error for several RNCPicker elements.
This happens as soon as I enable the new architecture in my project, and goes away as soon as I disable it.
The thing is that react-native v0.82 is already out and they are not giving support for old architecture anymore, so my team needs to make it work.
I got this to work by adding a post_install script in my Podfile, but I'm not sure how stable and reliable it is.
More than like a bug or issue, this is something like a discussion asking if anyone has experienced this before and knows or have a better resolution that can be considered as stable and reliable.

Showing All Errors Only
Undefined symbol: facebook::react::RNCPickerProps::RNCPickerProps(facebook::react::PropsParserContext const&, facebook::react::RNCPickerProps const&, facebook::react::RawProps const&)

Undefined symbol: facebook::react::RNCPickerComponentName

Undefined symbol: facebook::react::RNCPickerEventEmitter::onChange(facebook::react::RNCPickerEventEmitter::OnChange) const

Linker command failed with exit code 1 (use -v to see invocation)

Maybe attaching here my post_install script someone could get some hints on what is going on:

    def add_fabric_components(installer, target_name, component_path)
      target = installer.pods_project.targets.find { |t| t.name == target_name }
      return unless target

      fabric_files = ['Props.cpp', 'ShadowNodes.cpp', 'ComponentDescriptors.cpp', 'EventEmitters.cpp', 'States.cpp']
      
      fabric_files.each do |file_name|
        file_path = File.join(installer.sandbox.root, "../build/generated/ios/react/renderer/components/#{component_path}/#{file_name}")
        if File.exist?(file_path)
          file_ref = installer.pods_project.new_file(file_path)
          target.source_build_phase.add_file_reference(file_ref)
          puts "✅ Added #{file_name} to #{target_name}"
        else
          puts "⚠️  #{target_name} #{file_name} not found yet (will be generated during build)"
        end
      end
    end

    add_fabric_components(installer, 'RNCPicker', 'rnpicker')

Note

I know guys that I'm not providing any reproducible repo or something, I don't want you to spend time inspecting this cause I'm not sure if there's something wrong on your side, but honestly I couldn't think of a better place to ask someone to get better understanding on what's going on

Steps to reproduce

react-native v0.81.4
@react-native-picker/picker v2.11.1

1- have the project running normally
2- enable new architecture by setting ENV['RCT_NEW_ARCH_ENABLED'] = '1' on Podfile
3- cd ios && pod install
4- run the app, it throws the error shown above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions