I have been struggling with an error for several days:
clang++: error: no such file or directory: ‘/Users/apple/Library/Developer/Xcode/DerivedData/Unity-iPhone-eapfskczvszxtlcrklqkxwdvgntq/Build/Products/ReleaseForRunning-iphoneos/il2cpp.a’
Command Ld failed with a nonzero exit code
I created a build of my project (including all plugins) and tested it on an iOS phone as a development build. It worked fine on the device. After creating a build for release, I started encountering this error.
Suspecting plugin issues, I removed all plugins but the error persisted.
Created a new, empty Unity project and attempted to build it with Xcode. Surprisingly, the same error occurred.
I have exhausted my troubleshooting options and need help resolving this error. Any guidance would be greatly appreciated.
I am using Unity 6.000.0.33f1
Never experienced this before in previous versions.
me too!! Ive spent 12 hours troubleshooting all the little offshoots of this issue and still run into this. I can’t think of a single reason why it is not working.
I also encountered the same problem. I have been troubleshooting for a long time and tried various methods, but none of them worked. I want to ask if you have solved it now?
Unity 6 has dropped automatic support for compiling the il2cpp.a static library when building for iOS. However, you can still find the uncompiled IL2CPP source files in the exported project under:
To resolve the error:
clang++: error: no such file or directory: ‘…/il2cpp.a’
Command Ld failed with a nonzero exit code
You have two main options:
Manually compile the IL2CPP source into libil2cpp.a using your own Xcode build settings. This can be complex but gives you full control.
Use Unity 2022.3.61f1 (LTS)(not specific to this version. but this is what i used) instead. This version still outputs the libil2cpp.a file automatically in the Libraries folder when you build with IL2CPP backend. It’s a reliable workaround if you’re not tied to Unity 6.
Also, make sure you build using the Device SDK (ARM64) and test on a real iOS device — this avoids many issues that occur with simulator builds and IL2CPP.
I had resolved this sh*t issue that deleted Library and Temp folders in your Unity Project and restart Unity again and output Xcode project, then you can find the world are beautiful.
My version is 2023.2.20.f1c1
It is still happening on Unity 6000.0.55f1. macOS 15.6, Xcode 16.2 & 16.4, M4 Max.
This is a nearly empty project. iOS build works without any problem. My latest error:
cp: /Users/USERNAME/Library/Developer/Xcode/DerivedData/macOS-gorgnkprasdasdasdciekxjfvlecy/Build/Products/Debug/il2cpp.usym: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
There is also no problem when I directly build as macOS app; it works (but I need to build from Xcode). I’ll probably send a bug report, because I think nobody sent it yet.
UPDATE: I think I found the problem. If you selected IL2CPP Stacktrace Information as “Method Name, File Name, and Line Number”; the build will fail in Xcode. And if you select “Method Name”; the build will not fail in Xcode. I’ll create a bug report with a minimal project; but for now, this is my workaround.
This might not be related to the original thread. Because I can’t reproduce this in iOS builds (I tried ~50 different build scenarios for macOS & iOS).