demchenkoalex/react-native-module-template

Fresh setup yields Xcode 12.4 build error: "ld: library not found for -lRNModuleTemplateModule"

doug-sheridan opened this issue · 3 comments

Fresh setup yields Xcode 12.4 build error.

After cloning the repo and performing the js-only setup, trying to clean and build the /example app in Xcode 12.4 yields the following build error. Here is the full transcript. Any idea how to fix?

Showing All Errors Only

Build target example of project example with configuration Debug

Ld /Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/example.app/example normal (in target 'example' from project 'example')
    cd /Users/dougsheridan/Projects/bsw/bsw-react-native-ui/example/ios
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios10.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/DoubleConversion -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/FBReactNativeSpec -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/Flipper -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/Flipper-DoubleConversion -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/Flipper-Folly -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/Flipper-Glog -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/Flipper-PeerTalk -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/Flipper-RSocket -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/FlipperKit -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/RCT-Folly -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/RCTTypeSafety -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-Core -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-CoreModules -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-RCTAnimation -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-RCTBlob -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-RCTImage -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-RCTLinking -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-RCTNetwork -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-RCTSettings -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-RCTText -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-RCTVibration -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-cxxreact -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-jsi -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-jsiexecutor -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-jsinspector -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/React-perflogger -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/ReactCommon -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/Yoga -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/YogaKit -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/glog -L/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/libevent -F/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator -F/Users/dougsheridan/Projects/bsw/bsw-react-native-ui/example/ios/Pods/OpenSSL-Universal/Frameworks -F/Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/OpenSSL -filelist /Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Intermediates.noindex/example.build/Debug-iphonesimulator/example.build/Objects-normal/x86_64/example.LinkFileList -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Intermediates.noindex/example.build/Debug-iphonesimulator/example.build/Objects-normal/x86_64/example_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Intermediates.noindex/example.build/Debug-iphonesimulator/example.build/Objects-normal/x86_64/example.swiftmodule -ObjC -lCocoaAsyncSocket -lDoubleConversion -lFBReactNativeSpec -lFlipper -lFlipper-DoubleConversion -lFlipper-Folly -lFlipper-Glog -lFlipper-PeerTalk -lFlipper-RSocket -lFlipperKit -lRCT-Folly -lRCTTypeSafety -lReact-Core -lReact-CoreModules -lReact-RCTAnimation -lReact-RCTBlob -lReact-RCTImage -lReact-RCTLinking -lReact-RCTNetwork -lReact-RCTSettings -lReact-RCTText -lReact-RCTVibration -lReact-cxxreact -lReact-jsi -lReact-jsiexecutor -lReact-jsinspector -lReact-perflogger -lReactCommon -lYoga -lYogaKit -lglog -llibevent -lstdc++ -framework AudioToolbox -framework CFNetwork -framework JavaScriptCore -framework MobileCoreServices -framework OpenSSL -framework Security -framework UIKit -ObjC -lc++ -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Intermediates.noindex/example.build/Debug-iphonesimulator/example.build/example.app-Simulated.xcent -lRNModuleTemplateModule -lPods-example -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Intermediates.noindex/example.build/Debug-iphonesimulator/example.build/Objects-normal/x86_64/example_dependency_info.dat -o /Users/dougsheridan/Library/Developer/Xcode/DerivedData/example-dfkvhbnkjkksbmfiqgplxpttbdck/Build/Products/Debug-iphonesimulator/example.app/example

ld: library not found for -lRNModuleTemplateModule
clang: error: linker command failed with exit code 1 (use -v to see invocation)



Build failed    4/19/21, 8:50 AM    74.1 seconds

Hi @dsherida yes, you removed the native code, and there are additional steps you need to do to complete this, please refer to this section of the docs https://github.com/demchenkoalex/react-native-module-template#ios and for Android right under iOS. You can find it in the README right after this sentence If you didn't use js-only you are good to go. If you did, you need to unlink native code from the example. Basically, Xcode complaining because there is a leftover from native setup which was hard to remove because of a *.xcodeproj structure. Don't forget to remove native leftovers from Android, because it will complain too :) Let me know if that helps.

Wow thank you for the quick reply. I will be sure to follow those steps and report back once it works and then we can close this. Thank you so much!

Hi @dsherida yes, you removed the native code, and there are additional steps you need to do to complete this, please refer to this section of the docs https://github.com/demchenkoalex/react-native-module-template#ios and for Android right under iOS. You can find it in the README right after this sentence If you didn't use js-only you are good to go. If you did, you need to unlink native code from the example. Basically, Xcode complaining because there is a leftover from native setup which was hard to remove because of a *.xcodeproj structure. Don't forget to remove native leftovers from Android, because it will complain too :) Let me know if that helps.

Wohoo! That worked great thanks. Can't believe I overlooked that section of the docs. Cheers! 🍻