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

ERROR: Undefined symbols for architecture arm64: "_OBJC_CLASS_$_TealiumReactNative" #165

Open
Fedd9 opened this issue Jan 15, 2024 · 8 comments

Comments

@Fedd9
Copy link

Fedd9 commented Jan 15, 2024

Hello everyone,
we're having a problem related to a RN migration from v0.63 to v0.73: while upgrading all the libraries and used frameworks, we've encountered this error:

Undefined symbols for architecture arm64:
"OBJC_CLASS$_TealiumReactNative", referenced from:
objc-class-ref in libtealium-react-native.a(TealiumReactNative.o)
_OBJC$CATEGORY_TealiumReactNative$_RCTExternModule in libtealium-react-native.a(TealiumReactNative.o)
"OBJC_CLASS$_TealiumWrapper", referenced from:
objc-class-ref in libtealium-react-native.a(TealiumReactNative.o)
_OBJC$CATEGORY_TealiumWrapper$_RCTExternModule in libtealium-react-native.a(TealiumReactNative.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Now, considering everything, we managed to understand a solution related ([https://github.com//issues/129]) but this is not working for us.

pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

    installer.pod_targets.each do |pod|
      if pod.name.start_with?('tealium-react-native')
        def pod.build_type;
          Pod::BuildType.static_library # >= 1.9
        end
      end
    end
  end

We can't use use_frameworks! :linkage => :static because it is not compatible with Flipper.
For reference, I'm also attaching the podfile.

require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, '13.4'
prepare_react_native_project!
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"

target 'Memi_PROD' do 
  $config = use_native_modules!
  flags = get_default_flags()
  pod 'Realm', '~>10', :modular_headers => true
  pod 'RealmSwift', '~>10', :modular_headers => true
  pod 'AEPCore', '~> 3.0'
  pod 'AEPLifecycle', '~> 3.0'
  pod 'AEPIdentity', '~> 3.0'
  pod 'AEPSignal', '~> 3.0'
  pod 'AEPUserProfile', '~> 3.0'
  
  use_react_native!(
    :path => $config[:reactNativePath],
    :flipper_configuration => flipper_config,
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
end

target 'Memi_PRE' do 
  $config = use_native_modules!
  flags = get_default_flags()
  pod 'Realm', '~>10', :modular_headers => true
  pod 'RealmSwift', '~>10', :modular_headers => true
  pod 'AEPCore', '~> 3.0'
  pod 'AEPLifecycle', '~> 3.0'
  pod 'AEPIdentity', '~> 3.0'
  pod 'AEPSignal', '~> 3.0'
  pod 'AEPUserProfile', '~> 3.0'

  use_react_native!(
    :path => $config[:reactNativePath],
    :flipper_configuration => flipper_config,
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
end

target 'Memi_MOCKOON' do
  $config = use_native_modules!
  flags = get_default_flags()
  pod 'Realm', '~>10', :modular_headers => true
  pod 'RealmSwift', '~>10', :modular_headers => true
  pod 'AEPCore', '~> 3.0'
  pod 'AEPLifecycle', '~> 3.0'
  pod 'AEPIdentity', '~> 3.0'
  pod 'AEPSignal', '~> 3.0'
  pod 'AEPUserProfile', '~> 3.0'

  use_react_native!(
    :path => $config[:reactNativePath],
    :flipper_configuration => flipper_config,
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
end

pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

    installer.pod_targets.each do |pod|
      if pod.name.start_with?('tealium-react-native')
        def pod.static_framework?;
          true
        end
        def pod.build_type;
          Pod::BuildType.static_library # >= 1.9
        end
      end
    end
  end

post_install do |installer|
  react_native_post_install(
    installer,
    :mac_catalyst_enabled => false
  )
  
  installer.pods_project.targets.each do |t|
    if t.name.start_with?("AEP")
      t.build_configurations.each do |bc|
          bc.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
      end
    end
  end
end

Hope you can help me

@craigrouse
Copy link
Contributor

@Fedd9 sorry for the delayed reply. We are looking into this for you.

@trne
Copy link

trne commented May 21, 2024

is there any update on this?

@Enricoza
Copy link
Contributor

Enricoza commented Oct 3, 2024

It looks like this issue was missed, sorry about that.
@Fedd9 and @trne were you able to resolve it?

By having a look at your Podfile it seems that you are missing a line:

  pod "tealium-react-native-swift", :path => '../node_modules/tealium-react-native/tealium-react-native-swift.podspec'

That is necessary starting from tealium-react-native 2.2.0 onwards as written in the documentation here.

Let us know if you are still facing the issue and sorry again for missing this.

@mario-isca-TW
Copy link

Hi @Enricoza @craigrouse , I’m experiencing the same issue, but I’m using Expo. The build works perfectly with both Xcode and Android Studio, but unfortunately not with Expo. Has anyone else encountered this problem? I’ve tried searching online, but I haven’t found much information. Thank you so much!

@craigrouse
Copy link
Contributor

@mario-isca-TW we'll take a further look into this and see if we can reproduce the issue with Expo. We normally test with vanilla RN apps without Expo, so it sounds like Expo is causing a conflict somewhere. We'll get back to you as soon as we can.

@mario-isca-TW
Copy link

@craigrouse

Hi, any updates on this? Unfortunately, I’m in a bit of a hurry to implement Tealium in an app with Expo. Thank you so much!

@craigrouse
Copy link
Contributor

@mario-isca-TW It will take us some time to investigate unfortunately. We'll do our best, but I need to set expectations that it's not going to be an immediate fix (if indeed a fix is needed).

@Enricoza
Copy link
Contributor

Hi @mario-isca-TW, thanks for jumping in.

For Expo the issue is still the same. You are going to need to add the extra dependency in the Podfile:

pod "tealium-react-native-swift", :path => '../node_modules/tealium-react-native/tealium-react-native-swift.podspec'

With Expo this is slightly more inconvenient as you don't have a Podfile.

If you are building locally you can generate it with:

npx expo prebuild --clean

Then you can paste the required line on your own. And continue with your local builds.

If instead you are building remotely using the eas service, this won't be possible and your only option would be to implement a plugin that edits the Podfile.

This shouldn't be too difficult as there are many examples online on how to do so as this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants