2
votes

Installed 'react-native-lienar-gradient' library in my new react-native project.

Added pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient' in Podfile

Performed pod install in ios directory

Xcode build gives the following error:

ld: warning: directory not found for option '-L-L/Users/pavneet/Library/Developer/Xcode/DerivedData/Krowym-fttolxdorzfwjbcgjwmxijsnufkv/Build/Products/Debug-iphonesimulator/BVLinearGradient' ld: library not found for -lBVLinearGradient clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error in Xcode

Tried deleting Podfile.lock, cleaning xcode build, manually linking library by react-native link command, deleting Derived data folder

Also tried by adding libBVLinearGradient.a on Build Phases -> Link Binary With Libraries

Environment

react-native:0.63.2

react-native-linear-gradient:2.5.6

3

3 Answers

2
votes

Can you try this.

First deintegrate and install the pods again

  1. sudo gem update –system
  2. sudo gem install -n /usr/local/bin cocoapods
  3. pod setup
  4. cd ios
  5. pod deintegrate
  6. pod install

And then go back and run the app by deleting ios build and watchman and clearing metro server and simulator cache and also deleting and reinstalling node modules

  1. cd ..
  2. watchman watch-del-all && rm -rf $TMPDIR/react-*  && rm -fr $TMPDIR/metro-cache* && rm -fr $TMPDIR/haste-map-metro*  &&  rm -rf ios/build && xcrun simctl erase all && rm -rf node_modules/ && npm cache verify && npm install && react-native run-ios -- --reset-cache
    
0
votes

1-add this in pod file: pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'

2-npx pod-install

0
votes

I know this is so late, I hope you've already solved your problem. However, this solution might help someone else.

  1. Quit Xcode.
  2. users/${username}/Library/Developer/Xcode/DerivedData go this directory and clean your project data. (Make sure hidden files are visible to see Library file under users/${username}. Command+Shift+. combination switches hidden files visibility.)
  3. Open your terminal, change the current working directory to your local project directory/ios.
  4. pod deintegrate and pod install again.
  5. Open your project .xcworkspace file in Xcode.
  6. Click on your project name on the left navigation bar and click your project name under PROJECT.
  7. Type Library Search Paths and search.
  8. Click twice on the path which is beside Library Search Paths and delete the first and the last quote characters.(enter image description here It should look like this.)
  9. Lastly press Command+B to build your project.