React-native-splash-screen: Broken on iOS RN 0.56 (linker command failed with exit code 1)

Created on 8 Jul 2018  ·  9Comments  ·  Source: crazycodeboy/react-native-splash-screen

As soon as I add libSplashScreen.a to Build Phases / Link Binary With Libraries the project won't build. Constantly fails at linking.

Most helpful comment

Fixed! God knows why but I had splash screen in my Podfile? I'm guessing that's what react-native link does? Either way, I imagine a combo of react-native link getting stuck because I didn't know it was in the Podfile and the fact I'd already manually linked as per the readme was the cause of the error (it does mention 2 duplicate symbols after all). Thanks for your help anyway!

All 9 comments

Did you try linking the libraries? Change into your main project folder and run this

react-native link

@codymoorhouse Linking doesn't seem to work for me. If I unlink and re-link it says it's "already linked on iOS" but isn't. I resorted to adding manually, I added the .xcodeproject and it runs as expected, but once libSplashScreen is added to Link Binary With Libraries it shows linker command failed.

Here's the relevant output from console:

/Users/jskidd3/Library/Developer/Xcode/DerivedData/app-etpijkmxcfahajalvcqmggkqkvev/Build/Products/Release-iphoneos/react-native-splash-screen/libreact-native-splash-screen.a(SplashScreen.o)
/Users/jskidd3/Library/Developer/Xcode/DerivedData/app-etpijkmxcfahajalvcqmggkqkvev/Build/Products/Release-iphoneos/libSplashScreen.a(SplashScreen.o)
duplicate symbol _OBJC_METACLASS_$_SplashScreen in:
/Users/jskidd3/Library/Developer/Xcode/DerivedData/app-etpijkmxcfahajalvcqmggkqkvev/Build/Products/Release-iphoneos/react-native-splash-screen/libreact-native-splash-screen.a(SplashScreen.o)
/Users/jskidd3/Library/Developer/Xcode/DerivedData/app-etpijkmxcfahajalvcqmggkqkvev/Build/Products/Release-iphoneos/libSplashScreen.a(SplashScreen.o)
ld: 2 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@jskidd3 Oh darn, thought it was worth a shot. Hm maybe your derived data is corrupted. I would try to do a clean. While in xcode, in the top bar 'Xcode->Preferences->Locations->(under derived data click the little arrow to open finder)->Open Derived data and delete your project

This data will get remade when you rebuild

@codymoorhouse Just tried, got all the way to the end of the build progress bar and then bam, linker command failed 😢

@jskidd3 Hm, okay, well I found this on another website we developers use all the time 😉

See if this helps, it was posted 2015, edited 2017.

For me it helped to switch the "No Common Blocks" compiler setting to NO: It pretty much seems to make sense, the setting is explained here: What is GCC_NO_COMMON_BLOCKS used for?

To do this click your project in xcode, in the project nav, go to build settings, show all (instead of basic), use the search for 'no common blocks' and try toggling it to no. Might be worth a shot, can toggle it back if it doesn't work

Fixed! God knows why but I had splash screen in my Podfile? I'm guessing that's what react-native link does? Either way, I imagine a combo of react-native link getting stuck because I didn't know it was in the Podfile and the fact I'd already manually linked as per the readme was the cause of the error (it does mention 2 duplicate symbols after all). Thanks for your help anyway!

@jskidd3 , Wow!, you just helped me out, Thanks.

i removed #pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen' from pod file and performed pod install, it works.

@HemantRMali You're welcome! Glad I could help you out and thanks for letting me know.

Was this page helpful?
0 / 5 - 0 ratings