upgrade-support icon indicating copy to clipboard operation
upgrade-support copied to clipboard

directory not found for option '-L-L/.../CocoaAsyncSocket'

Open mtieltjes opened this issue 4 years ago • 18 comments

Environment

System:
    OS: macOS 10.15.2
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 66.96 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 13.3.0 - /usr/local/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.13.2 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.8.4 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 24, 25, 26, 27, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-27 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  Languages:
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.0 => 0.62.0 
  npmGlobalPackages:
    *react-native*: Not Found

Upgrading version

0.61.5 => 0.62

Description

After following the upgrade helper and this issue for the iOS project file, I get stuck with the following build error:

ld: warning: directory not found for option '-L-L/Users/../ios/build/Release-iphonesimulator/CocoaAsyncSocket'
ld: library not found for -lCocoaAsyncSocket
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I suspect something is wrong in my Search Paths, but I am not yet able to figured it out.

Reproducible demo

mtieltjes avatar Apr 03 '20 16:04 mtieltjes

I followed the same steps as you and I also got the errormessage 'ld: library not found for -lCocoaAsyncSocket' when compiling in xcode. But after a lot trying I discovered my problem.

I problem was with the LIBRARY_SEARCH_PATHS, see also: step 4. I compared my project with a new RN project and I saw that the $(inherited) was at the top at the new project, so reversed the order and then it worked.

aaroncornelissen avatar Apr 09 '20 13:04 aaroncornelissen

Nice, thanks for sharing @aaroncornelissen!

@mtieltjes can you please check if @aaroncornelissen's solution works for you?

lucasbento avatar Apr 09 '20 13:04 lucasbento

Im also getting a similar error, I followed @aaroncornelissen solution but that only gave this:

ld: warning: directory not found for option '-L-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator' ld: warning: Could not find or use auto-linked library 'swiftCompatibility50' ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'

Brianop avatar Apr 09 '20 20:04 Brianop

Ok I finally got my project working, what I did was combine this two:

https://github.com/facebook/react-native/issues/28483#issuecomment-610839293

If you're not using lottie I don't think this is necessary: https://github.com/react-native-community/lottie-react-native/issues/575#issuecomment-575032285

Brianop avatar Apr 09 '20 22:04 Brianop

https://medium.com/@punjabicoder/react-native-version-0-62-e7414c2b2d35 check this post may it helps you. it helped me guys

ghost avatar May 23 '20 23:05 ghost

Thank you for sharing, @aaroncornelissen! For me, it was the same variable, just for Target instead of Project.

Apparently you need to ensure the LIBRARY_SEARCH_PATHS has $(inherited) set last on both React Native Project and Target level in Build settings. Otherwise, it seems the relative search paths for each pod will not be searched and only inherited is used. I don't have an explanation for this, as I don't know how XCode treats the linking phase.

RNSearchDirectories-TargetLevel

R4DIC4L avatar May 27 '20 13:05 R4DIC4L

Thanks @aaroncornelissen, thanks for your time in so little detail! You save my day.

The same problem here, solve with @aaroncornelissen solution!

francofadini avatar Jul 08 '20 15:07 francofadini

react native 0.63 ld: warning: directory not found for option '-L-L/Users/ominext/Library/Developer/Xcode/DerivedData/demoTw-atyxihfhmofnsyerjlnjtjhnrlwe/Build/Intermediates.noindex/ArchiveIntermediates/demoTw/BuildProductsPath/Release-iphoneos/CocoaAsyncSocket'

hoangngocthangbmw avatar Jul 15 '20 07:07 hoangngocthangbmw

can i help you ??? :(

hoangngocthangbmw avatar Jul 15 '20 07:07 hoangngocthangbmw

@hoangngocthangbmw hello! I had the same issue with CocoaAsyncSocket. It was so frustrating because I could find nothing regarding AsyncSocket. 😞 I'll add logs here so people can google this answer:

ld: warning: directory not found for option '-L-L/Users/{USER}/Library/Developer/Xcode/DerivedData/{PROJECT_NAME}-apscvrgcsswobubywbzzrulfcylc/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket' ld: library not found for -lCocoaAsyncSocket

Environment: Xcode: 11.6 Pod: 1.9.3 React Native: 0.62.2

Solution: I switched the Legacy build system to New build system in Xcode.

ivanstnsk avatar Jul 23 '20 15:07 ivanstnsk

@aaroncornelissen Thanks, After four hours, at last your solution worked for me.

I followed the same steps as you and I also got the errormessage 'ld: library not found for -lCocoaAsyncSocket' when compiling in xcode. But after a lot trying I discovered my problem.

I problem was with the LIBRARY_SEARCH_PATHS, see also: step 4. I compared my project with a new RN project and I saw that the $(inherited) was at the top at the new project, so reversed the order and then it worked.

waheedakhtar694 avatar Sep 09 '20 19:09 waheedakhtar694

Most frustrating issue. just i removed .ttf files which is came from link vector icons in copy bundle resources tab and then it is compiled successfully.

Biplovkumar avatar Sep 17 '20 11:09 Biplovkumar

as the aaroncornelissen commented on 9 Apr , i solved this by add $(inherited) on the top of the LIBRARY_SEARCH_PATHS

shen8686184 avatar Dec 26 '20 13:12 shen8686184

I had this issue, but $(inherited) was already at the bottom of my LIBRARY_SEARCH_PATHS. Taking a cue from a brand-new project, I added "${PODS_CONFIGURATION_BUILD_DIR}" as recursive, which got me past -lCocoaAsyncSocket, but now I'm stuck on -lcrypto. Anybody fix this already?

edit: was able to get this to work once I changed the run target to "Any iOS" and updated the xcodeproj library search paths, as well as setting up all the provisioning profile stuff in the apple dev portal. 🤷

righdforsa avatar Jan 06 '21 19:01 righdforsa

is there any other solution, um stuck on this for hours.

russelRajitha avatar Jan 15 '21 08:01 russelRajitha

I had this issue, but $(inherited) was already at the bottom of my LIBRARY_SEARCH_PATHS. Taking a cue from a brand-new project, I added "${PODS_CONFIGURATION_BUILD_DIR}" as recursive, which got me past -lCocoaAsyncSocket, but now I'm stuck on -lcrypto. Anybody fix this already?

edit: was able to get this to work once I changed the run target to "Any iOS" and updated the xcodeproj library search paths, as well as setting up all the provisioning profile stuff in the apple dev portal. 🤷

recursive fix worked for me. spent a few days on this. thanks so much!

MehulATL avatar Jan 21 '21 18:01 MehulATL

I don't know why the Facebook teams haven't fixed it, the solution is this:

  • Open Xcode and bring the Build Settings
  • Bring the Search Paths and then double click on Library search paths to modify it
  • Add ${inherited} to the first of the list [It's important to be the first]
  • Go back to the terminal and navigate to the ios folder
  • Delete the build folder by this command rm -rf build/
  • Try to run the project (No difference between the CLI of Xcode)

amerllica avatar Jun 01 '22 05:06 amerllica

Attempted all of the above but this error was still present.

If its a react-native project, open the .xcworkspace instead of the .xcodeproj in XCode.

That solved it for me.

a22agarw avatar Mar 19 '24 21:03 a22agarw