2

I have been trying to test my Unity3D application on iPhone, and that requires me to open it through Xcode in order to run it on my iPhone device. However, I keep getting the same error message once I hit the Run button on Xcode. I have checked all the player settings on Unity, and also went through a lot of answers of similar questions and all of them did not help me solve the issue. Please help me find a solution as I cannot proceed with my work without it..

Here is the detailed error message:

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

Maryoomi1
  • 113
  • 1
  • 3
  • 16
  • check if you have some space in some lib folder name. sometimes this can give clang errors. :O – ゴスエン ヘンリ Nov 10 '15 at 18:29
  • @ゴスエンヘンリ thanks for the reply, but what do you mean by space in lib folder name? There is one folder in the project called "Libraries" and it has a file name called libiPhone-lib.a. I can see no spaces in the name of the file and it also appears in red color (I don't know why). – Maryoomi1 Nov 10 '15 at 19:22
  • just another question, do you have plugins on it? – ゴスエン ヘンリ Nov 11 '15 at 01:13
  • Trying to remember what I did when that happened to me. Something with spaces on folders or quotations. Or some deleted unused lib/content that is still inside build phases. Also I read somewhere that some plugins like Prime31 sometimes give clang errors. still no luck? :O – ゴスエン ヘンリ Nov 11 '15 at 01:22
  • @ゴスエン ヘンリ what type of plugins are you referring to? And where can I find them? And I never deleted any files or edited names, I just tried to directly run my project from Unity to Xcode and I got surprised with this error that I have no clue about and I have not found any right solution to it. Please help.. – Maryoomi1 Nov 11 '15 at 13:39
  • I'm afraid to bit "general" in the response, cause I got this error long time ago. Now xCode kind updated and has new features. since no one is helping you here, for a matter of test, try disable bitcode. On tthe folders, tap on your project, Build Settings, Build Options & 'Set Bitcode Enabled' to NO. just for test. – ゴスエン ヘンリ Nov 12 '15 at 02:10
  • Also, what version of Unity and what version of xcode are you developing? – ゴスエン ヘンリ Nov 12 '15 at 02:12
  • @ゴスエン ヘンリ the bitcode is already disabled in the project. I am using the latest versions of both Unity and Xcode (Unity 5.2.2f1 and Xcode 7.1). I have seen many answers to similar questions telling about disabling bitcode but it's clearly not the issue in my case. Thank you very much for being here for me. I hope we can find a solution soon! – Maryoomi1 Nov 12 '15 at 11:39
  • can you check the library and framework searchpaths in xcode? – ゴスエン ヘンリ Nov 12 '15 at 11:45
  • @ゴスエンヘンリ This is what I have in the library search path: $(inherited) "$(SRCROOT)" "$(SRCROOT)/Libraries" and nothing selected in the framework search path – Maryoomi1 Nov 12 '15 at 14:19
  • mmm, looks fine. Wait, I will answer a lil longer outside comment section. – ゴスエン ヘンリ Nov 12 '15 at 17:49

2 Answers2

2

Final edit:

The OP problem was opening the xcode project from a temp file.

If anyone have clang problems, maybe some of this stuff below can help.

Last Try

1- delete the xcode project folder and build again? (just build. and not "build and run) run inside xcode)

2- In Building Settings, if the Symlink Unity Libraries is checked, uncheck it!

Extras:

1- Clean before every new build.

What was tested and didn't work

Test 0

Folder views, tap blue project icon: Build Settings > Build Options > 'Set Bitcode Enabled' to NO

Test 1

Keep everything and try adding:

$(SRCROOT)/Libraries/Plugins/iOS and remove quotation for: $(SRCROOT)/Libraries

Test 2

change your target for deployment for iOS 9.0

Test 3

1- In Xcode's project navigator, press the blue top-level project icon.

2- Click on your target, then the General tab.

3- Remove "libiPhone-lib.a" from the Linked Frameworks and Libraries.

4- Now re-add "libiPhone-lib.a" to the Linked Frameworks and Libraries.

5- Build and Run your Xcode project from Xcode.

Test 4

Update xcode to 7.1.1

Test 5

"If you previously was deploying project to Simulator, then you need to switch "SDK Version" from "Simulator" back to "Device" in Unity Player Settings and re-export Unity project."

  • Thank you very much! That seems a great help!! I will try each point right after updating Xcode (I have just discovered now that 7.1 is not really the latest version, so sorry for that!). I will get back to you once I am done! – Maryoomi1 Nov 12 '15 at 18:08
  • I can see that the new version got released just 2 days ago! I hope this will solve everything! – Maryoomi1 Nov 12 '15 at 18:12
  • So sad to say that nothing worked! The other thing I have noticed is that when re-adding the libiPhone-lib.a file, I had to drag it from the library folder on the left pane, as it was not available within the list of frameworks and libraries when hitting the + sign. – Maryoomi1 Nov 12 '15 at 19:53
  • This really makes me disappointed.. It has to be solved.. =_= – Maryoomi1 Nov 12 '15 at 20:54
  • It is the first time you trying on iPhone and it failed? Did you tried on simulator or something like that? – ゴスエン ヘンリ Nov 12 '15 at 22:41
  • Yes there is no previous time that I tried it on iPhone and worked. And yes I did try it on the simulator and I got other issues.. I can post them for you if you want but what I mainly need is a working project on iOS devices! – Maryoomi1 Nov 12 '15 at 23:34
  • The new surprise is I managed to solve the previous errors I got when running on the simulator, and now what did I see again? ld: library not found for -liPhone-lib clang: error: linker command failed with exit code 1 (use -v to see invocation) Tadaaaa! – Maryoomi1 Nov 12 '15 at 23:56
  • did you change the "SDK version" on player settings? from simulator to device? – ゴスエン ヘンリ Nov 13 '15 at 01:30
  • Yes I did. And now I got the project built successfully when running on the simulator, however I see only a black screen on the simulator. What I did to make it work is looking for the actual path/directory of the libiphone-lib.a file and pasting it in the library search path. I tried this for the device SDK but it showed me 72 errors!! – Maryoomi1 Nov 13 '15 at 01:48
  • Did you try: delete the xcode project folder and build again? (just build. and not "build and run) run inside xcode) also, I see this somewhere for a random clang error... why not try: "Uncheck box - sym-link unity libraries in build window Uncheck it if you are going to share build." – ゴスエン ヘンリ Nov 13 '15 at 02:01
  • I don't think I need to delete the Xcode folder as I replace it with a new project every time when I build it from Unity. I got different news about the simulator build now. I am finally able to see the interface on the simulator, but I get an error once I hit on my app icon. This is the error: dyld: lazy symbol binding failed: Symbol not found: _UnityParseCommandLine Referenced from: /Users/~/Library/Developer/CoreSimulator/Devices/A4152D04-AD65-49F7-84F8-E1A310096F98/data/Containers/Bundle/Application/04A99AA7-0E98-4788-B29D-B814D9DA9DD9/AppName.app/AppName Expected in: flat namespace – Maryoomi1 Nov 13 '15 at 02:19
  • And I didn't get the part about the uncheck box. Sorry =_=" – Maryoomi1 Nov 13 '15 at 02:22
  • nah. simulator will do no good, forget about it. Make sure the SDK version is device at all and: In Building Settings, if the Symlink Unity Libraries is checked, uncheck it! – ゴスエン ヘンリ Nov 13 '15 at 02:32
  • and please check for me what it is set on xcode > build settings Base SDK and supported platforms. – ゴスエン ヘンリ Nov 13 '15 at 03:00
  • also, in the $(SRCROOT) part, remove quotations of everything you can! xD – ゴスエン ヘンリ Nov 13 '15 at 03:13
  • Hello my friend!! First of all I am so grateful to you struggling with me for 2 days!! Secondly I found out that all of the time I have been opening the Xcode file from the wrong directory (Temp folder), while it was clearly in the folder I renamed in unity... If I had to apologize here then I am really sorry and if I had to say thank you then all the thanks go to you as you kept on popping different ideas and solutions into my mind!! You taught me a lot =) – Maryoomi1 Nov 13 '15 at 03:29
  • I love Japan by the way! =D – Maryoomi1 Nov 13 '15 at 03:30
  • hahah no problem. that "Temp" on the path was on my sight. xD And, I'm from Brazil haha – ゴスエン ヘンリ Nov 13 '15 at 03:35
0

Switching iPhone / iPad launch screen settings to "none" in the Player Settings (Edit | Project Settings | Player | iOS tab) also seems to generate the same Xcode linker error.

When building for iOS, Unity 5.4 does put an error into the console, but it is easily missed as Unity continues the build and launches Xcode anyway.

Matt Parkins
  • 24,208
  • 8
  • 50
  • 59