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

Could not find or use auto-linked library 'swiftWebKit' #739

Closed
kockok opened this issue Mar 14, 2021 · 26 comments
Closed

Could not find or use auto-linked library 'swiftWebKit' #739

kockok opened this issue Mar 14, 2021 · 26 comments

Comments

@kockok
Copy link

kockok commented Mar 14, 2021

Description

Error raised when building the app.

Steps to Reproduce

  1. run build in the xcode app.
  2. error when building

Expected behavior: build the app without such error.

Actual behavior:

ld: warning: Could not find or use auto-linked library 'swiftWebKit'
Undefined symbols for architecture arm64:
  "__swift_FORCE_LOAD_$_swiftWebKit", referenced from:
      __swift_FORCE_LOAD_$_swiftWebKit_$_lottie_react_native in liblottie-react-native.a(ContainerView.o)
      __swift_FORCE_LOAD_$_swiftWebKit_$_lottie_react_native in liblottie-react-native.a(AnimationViewManagerModule.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftWebKit_$_lottie_react_native)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@4yki
Copy link

4yki commented Mar 15, 2021

Exactly the same after upgrading to RN 0.64

@VicFrolov
Copy link

Same issue here on RN 0.64.

I see this was recently merged (82a0864), but problem persists after pointing package to master, and npm installing / pod install

@emilioicai
Copy link
Member

@VicFrolov This issue is my first prio as it's blocking the release of v4.0.0 but I'm afraid I cannot reproduce the error. Can you make sure you are using the master branch and clean your cache before doing npm install? I'm going to need your help to fix this.

@jctf
Copy link

jctf commented Mar 18, 2021

@emilioicai The solution for me was to create an Objective-C bridging header in the iOS project.

@emilioicai
Copy link
Member

@jctf would you mind sending a PR with the file for the bridging header? Thanks!

@jctf
Copy link

jctf commented Mar 18, 2021

@emilioicai it might be easier to describe the steps to take when you upgrade to RN 0.64.
There are other 3rd parties libs out there that documented exactly these steps.
A great how-to can be found -> https://teabreak.e-spres-oh.com/swift-in-react-native-the-ultimate-guide-part-1-modules-9bb8d054db03
You would only have to take the steps till the prompted where you choose to configure Objective-C Bridging Header.

Hope that helps.

@emilioicai
Copy link
Member

oh, you mean the bridging header on the main project, not on the lib. Ok, I will update the documentation accordingly. Thanks!

@kockok
Copy link
Author

kockok commented Mar 19, 2021

@emilioicai Simply creating an empty swift file and bridging not working for me...

@4yki
Copy link

4yki commented Mar 19, 2021

@kockok , make sure to create File.swift + bridging header on the correct level
https://teabreak.e-spres-oh.com/swift-in-react-native-the-ultimate-guide-part-1-modules-9bb8d054db03
**

  • In the Group dropdown, make sure to select the group CounterApp, not the project itself.

**

@Bardiamist
Copy link
Contributor

Also add "$(SDKROOT)/usr/lib/swift\" to LIBRARY_SEARCH_PATHS can help if you want to remove File.swift

@jgo80
Copy link

jgo80 commented Jun 16, 2021

Also add "$(SDKROOT)/usr/lib/swift\" to LIBRARY_SEARCH_PATHS can help if you want to remove File.swift

Works for me, but needed to remove the trailing "".

@aescobar-icc
Copy link

Just open your project/ios with xcode, then add a new swift file and that's it!! your problem is solved.
at least it worked for me

@raivieiraadriano92
Copy link

Also add "$(SDKROOT)/usr/lib/swift\" to LIBRARY_SEARCH_PATHS can help if you want to remove File.swift

Thanks @Bardiamist this worked for me

@chj-damon
Copy link

see this: https://developer.apple.com/forums/thread/655438

@KaueCesar
Copy link

Here works to me, open your project/ios with xcode, add a new swift file with bridging-header.

@ecklf
Copy link

ecklf commented Jul 9, 2021

Faced the same issue in XCode 13 beta 2 and iOS 15. Can confirm adding a new file with a bridging header works.

@ibrahimyolbir
Copy link

Hello @ecklf what do you mean by Can confirm adding a new file with a bridging header works.. can you explain more. Thanks
by the way i have the following error

ld: warning: Could not find or use auto-linked library 'swiftWebKit'
Undefined symbols for architecture x86_64:
  "__swift_FORCE_LOAD_$_swiftWebKit", referenced from:
      __swift_FORCE_LOAD_$_swiftWebKit_$_lottie_react_native in liblottie-react-native.a(ContainerView.o)
      __swift_FORCE_LOAD_$_swiftWebKit_$_lottie_react_native in liblottie-react-native.a(AnimationViewManagerModule.o)
      __swift_FORCE_LOAD_$_swiftWebKit_$_lottie_react_native in liblottie-react-native.a(hexStringToColor.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftWebKit_$_lottie_react_native)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@ibrahimyolbir
Copy link

this worked for me
https://developer.apple.com/forums/thread/655438

Figured this out. There is a new library in Xcode 12 that needs to
 be added to the Link Binary with Libraries phase call libSwiftWebKit.tbd. 
Error went away after adding this.

Unfortunately, adding this library breaks compilation with Xcode 11,
 so you'll have to add & remove it depending on which version of Xcode you're using.

@digitinfinitum
Copy link

Just open your project/ios with xcode, then add a new swift file and that's it!! your problem is solved.
at least it worked for me

how to do that please ?

@aescobar-icc
Copy link

aescobar-icc commented Jul 20, 2021

Just open your project/ios with xcode, then add a new swift file and that's it!! your problem is solved.
at least it worked for me

how to do that please ?

The following is your project structure:

  • your-react-native-project
    |- ios
    |- android

    the content the ios folder is an xcode project

    you must to open this folder with the xcode and then add a new file swift file

Screen Shot 2021-07-20 at 14 05 50

Screen Shot 2021-07-20 at 14 06 07

@rush86999
Copy link

rush86999 commented Aug 10, 2021

Bridging header file no longer works any alternative?

@Erdenezayaa
Copy link

Just open your project/ios with xcode, then add a new swift file and that's it!! your problem is solved.
at least it worked for me

how to do that please ?

The following is your project structure:

  • your-react-native-project
    |- ios
    |- android
    the content the ios folder is an xcode project
    you must to open this folder with the xcode and then add a new file swift file

Screen Shot 2021-07-20 at 14 05 50

Screen Shot 2021-07-20 at 14 06 07
thanks. it worked for me in react-native 0.64.0 and xcode 12.5

@Saqib92
Copy link

Saqib92 commented Oct 14, 2021

creating File.swift is not working in xcode 13.

@patlux
Copy link

patlux commented Feb 28, 2022

I already had a File.swift in my project. I upgraded from 0.66 to 0.67 and got the error mentioned by the thread author.

My solution was to delete the following path from the LIBRARY_SEARCH_PATHS setting as you can see with React Native Upgrade Helper:

CleanShot 2022-02-28 at 09 57 40

Go into Xcode and delete the following line:

CleanShot 2022-02-28 at 09 57 09

facebookarchive/react-native-fbsdk#755

@LoknathPandit
Copy link

Just open your project/ios with xcode, then add a new swift file and that's it!! your problem is solved.
at least it worked for me

how to do that please ?

The following is your project structure:

  • your-react-native-project
    |- ios
    |- android
    the content the ios folder is an xcode project
    you must to open this folder with the xcode and then add a new file swift file

Screen Shot 2021-07-20 at 14 05 50
Screen Shot 2021-07-20 at 14 06 07
thanks. it worked for me in react-native 0.64.0 and xcode 12.5

it worked for me.

@p-schlickmann
Copy link

I already had a File.swift in my project. I upgraded from 0.66 to 0.67 and got the error mentioned by the thread author.

My solution was to delete the following path from the LIBRARY_SEARCH_PATHS setting as you can see with React Native Upgrade Helper:

CleanShot 2022-02-28 at 09 57 40

Go into Xcode and delete the following line:

CleanShot 2022-02-28 at 09 57 09

facebookarchive/react-native-fbsdk#755

Oh god, such a legend. Thank you.

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