react-native-svg icon indicating copy to clipboard operation
react-native-svg copied to clipboard

iOS build fails with Undefined symbols

Open csillaj opened this issue 11 months ago • 18 comments

Description

Hi, after updating react native to 0.76.6 I ran into multiple errors

Undefined symbol: facebook::react::RNSVGUseProps::RNSVGUseProps(facebook::react::PropsParserContext const&, facebook::react::RNSVGUseProps const&, facebook::react::RawProps const&)

Undefined symbol: facebook::react::RNSScreenProps::RNSScreenProps(facebook::react::PropsParserContext const&, facebook::react::RNSScreenProps const&, facebook::react::RawProps const&)

Undefined symbol: facebook::react::RNSVGDefsProps::RNSVGDefsProps(facebook::react::PropsParserContext const&, facebook::react::RNSVGDefsProps const&, facebook::react::RawProps const&)

Undefined symbol: facebook::react::RNSVGLineProps::RNSVGLineProps(facebook::react::PropsParserContext const&, facebook::react::RNSVGLineProps const&, facebook::react::RawProps const&)

Undefined symbol: facebook::react::RNSVGMaskProps::RNSVGMaskProps(facebook::react::PropsParserContext const&, facebook::react::RNSVGMaskProps const&, facebook::react::RawProps const&)

Undefined symbol: facebook::react::RNSVGPathProps::RNSVGPathProps(facebook::react::PropsParserContext const&, facebook::react::RNSVGPathProps const&, facebook::react::RawProps const&)

Undefined symbol: facebook::react::RNSVGRectProps::RNSVGRectProps(facebook::react::PropsParserContext const&, facebook::react::RNSVGRectProps const&, facebook::react::RawProps const&)

Undefined symbol: facebook::react::RNSVGTextProps::RNSVGTextProps(facebook::react::PropsParserContext const&, facebook::react::RNSVGTextProps const&, facebook::react::RawProps const&)

Undefined symbol: facebook::react::RNSVGImageProps::RNSVGImageProps(facebook::react::PropsParserContext const&, facebook::react::RNSVGImageProps const&, facebook::react::RawProps const&)

etc.

Steps to reproduce

  1. update to react native 0.76
  2. try building app in xcode

Snack or a link to a repository

can't share my repo because it's private

SVG version

15.11.1

React Native version

0.76.6

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

csillaj avatar Jan 15 '25 09:01 csillaj

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

github-actions[bot] avatar Jan 15 '25 09:01 github-actions[bot]

Hi, I've just double-checked that, and everything builds perfectly fine using [email protected] and [email protected]. I recommend you to ensure all your dependencies are correctly updated and aligned. Additionally, clearing the cache, builds, node_modules and pods might help resolve your issue. Let me know if you need further help!

jakex7 avatar Jan 15 '25 10:01 jakex7

Also, it looks like you might have forgotten to run bundle exec pod install in /ios directory

jakex7 avatar Jan 15 '25 11:01 jakex7

I did the pod install and I still get the above errors when upgrade to RN 76

Image Image Image Image

YOEL311 avatar Jan 15 '25 23:01 YOEL311

Seems like this issue relates to the new react native architecture that is used by default on RN 0.76.+

For now, you can opt out by adding the following line to your Podfile

ENV['RCT_NEW_ARCH_ENABLED'] = "0"

rwillemsandroid avatar Jan 21 '25 09:01 rwillemsandroid

I added ENV['RCT_NEW_ARCH_ENABLED'] = "0", but it did not resolve my problem.

YOEL311 avatar Jan 22 '25 10:01 YOEL311

@rwillemsandroid won't react-native-svg support the new architecture? I updated RN specifically to use the new architecture

csillaj avatar Jan 22 '25 10:01 csillaj

won't react-native-svg support the new architecture? I updated RN specifically to use the new architecture

It does support the new architecture for a long time. I wouldn't recommend setting ENV['RCT_NEW_ARCH_ENABLED'] = "0" . The issue you're facing is likely cache-related, so try removing the build and pods catalogs from /ios folder using this command (ensure Xcode is closed beforehand):

rm -rf build/ Pods/ Podfile.lock

Then, reinstall the Pods using:

bundle exec pod install

Once that's done, you should be able to open Xcode and successfully build the app.

jakex7 avatar Jan 22 '25 11:01 jakex7

I deleted all those folders and files, I even deleted DerivedData and ran bundle exec pod install, but it didn't help The errors are not from my "main target", but from NotificationServiceExtension

csillaj avatar Jan 23 '25 15:01 csillaj

Without a minimal reproduction repository and based on your responses (NotificationServiceExtension, which is unrelated to react-native-svg, along with the screenshot from @YOEL311 showing errors from other libraries), I assume the issue is with the notification library you’re using. Therefore, I recommend opening an issue in that library's repository

jakex7 avatar Jan 28 '25 10:01 jakex7

did solve it? same issue here

joaosodres avatar Mar 10 '25 21:03 joaosodres

Still having the same issue here...

mclbdn avatar Mar 27 '25 12:03 mclbdn

Please provide a minimal reproduction repository with only react-native-svg installed, as it's necessary to investigate this issue.

jakex7 avatar Mar 28 '25 09:03 jakex7

I find Sulotoin for this

 use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => flags[:hermes_enabled],  

    :new_arch_enabled => false,   // add this 
    :fabric_enabled => false,         //

    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

YOEL311 avatar Apr 09 '25 07:04 YOEL311

i need a new architecture. can you give solution without :new_arch_enabled => false,

alexdarh avatar Apr 09 '25 10:04 alexdarh

For newarch, you need

‘’’’

:new_arch_enabled => true,
:fabric_enabled => true

‘’’’

Also need install pod with this env

     RCT_NEW_ARCH_ENABLED=1 bundle exec pod install

YOEL311 avatar Apr 09 '25 10:04 YOEL311

not work for me ( Undefined symbol: facebook::react::RNSVGMaskProps::RNSVGMaskProps(facebook::react::PropsParserContext const&, facebook::react::RNSVGMaskProps const&, facebook::react::RawProps const&) ` use_react_native!( :path => config[:reactNativePath],

:hermes_enabled => false,
:new_arch_enabled => true,
:fabric_enabled => true

)`

alexdarh avatar Apr 09 '25 14:04 alexdarh

why hermes_enabled= false It needs to be true with new arch

YOEL311 avatar Apr 09 '25 14:04 YOEL311

I faced the same errors when migrating to the new architecture. Check your Podfile and delete this if you have it:

install! 'cocoapods', :disable_input_output_paths => true # <- delete this line

Reinstall pods. This is what caused the issue in my case. Hope this helps someone else

gremech avatar Apr 25 '25 17:04 gremech

React Native 0.76 introduced new architecture by default. This means that when your run “pod install” in 0.76 or newer, it will assume new architecture. If you haven’t migrated to new arch yet, you’ll need to opt-out with RCT_NEW_ARCH_ENABLED=0 env variable:

RCT_NEW_ARCH_ENABLED=0 bundle exec pod install

You can read more here: https://reactnative.dev/blog/2024/10/23/the-new-architecture-is-here#opt-out

thymikee avatar May 15 '25 16:05 thymikee

@csillaj Did you fond the fix for it. I have recently migrated to 0.79.2 , facing same issue when new_arch is enabled

JatinDream11 avatar May 30 '25 11:05 JatinDream11

This helped!

RCT_NEW_ARCH_ENABLED=0 bundle exec pod install

k-saparia avatar Jun 02 '25 19:06 k-saparia

I faced this issue multiple times after upgrading my version. In every instance, the problem was resolved after I aligned the Podfile with the upgrade helper.

YOEL311 avatar Jun 03 '25 07:06 YOEL311

👋 someone has got any solution to build rn-svg 15.12.1 when enabling new arch on iOS. I'm upgrading react-native-maps lib that require new arch but react-native-svg become blocker!

Any helps are welcome/appreciated.

k-saparia avatar Sep 25 '25 20:09 k-saparia

cc: @msand do you happen to know how we can fix this issue? Or do you know whom should we connect with it? I'm getting this issue in RN 0.78 and latest version of react-native-svg when fabric and new-arch is enabled

k-saparia avatar Sep 26 '25 18:09 k-saparia

Getting also the same issue with react-native v0.81 I need the New Architecture enabled, and that's when the error occurs. Already tried with react-native-svg v15.12.1 and v15.13.0

francoangulo avatar Sep 30 '25 18:09 francoangulo

same issue

dkahdwk avatar Oct 02 '25 08:10 dkahdwk

any update on this? this is blocking us from opting into the new architecture

francoangulo avatar Oct 02 '25 11:10 francoangulo

I'll close this issue as it doesn't contribute anything new. Like I mentioned the last time, please create a new issue providing a minimal reproducible repository with only react-native-svg installed so we can investigate this further.

jakex7 avatar Oct 02 '25 12:10 jakex7