Xcode linker error: file too small for architecture x86_64

匿名 (未验证) 提交于 2019-12-03 01:05:01

问题:

I'm developing an application in Xcode.

When I try to build, this error comes up:

ld: in /Users/theodore/Library/Developer/Xcode/DerivedData/Tower-bkpdifuqssebjdgurzmtirbxejnn/Build/Intermediates/Tower.build/Debug/Tower.build/Objects-normal/x86_64/TWRAppDelegate.o, file too small for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 

Does anyone know what's wrong?

回答1:

Stealing @martin-baulig's answer:

Try a full rebuild / clean. It's possible that the previous build has been abnormally aborted, leaving the TWRAppDelegate.o file corrupted or zero-size.



回答2:

I usually add a space (could be any character for that matter), remove it and then save. Easier and quicker than a clean/build.



回答3:

Since building a clean project may take way too long there is shorter way for those that have the access to the file that is corrupt in the cache:

  • Delete the file (Remove reference)
  • Build project
  • Reinsert file
  • Build project

Full version so you have no trouble finding the file:

  • Find the file in Xcode project navigator
  • Right click the file and press "show in finder" (opens a finder at the location where the file is)
  • Select the file in Xcode and press backspace then click "Remove reference"
  • Build project (it will fail but wait for it to finish)
  • Reinsert file by dragging it from the finder into the same location you just deleted it
  • Build project (should work now)


回答4:

Step 1. Go to: Project > Build Settings > Search Paths

Step 2. Set "Always Search User Paths" to Yes

Step 3. Build the project (You'll get a warning but the project will build.)

Step 4. Set "Always Search User Paths" back to No and build again to eliminate the warning



回答5:

rm -rf /Users/hostname/Library/Developer/Xcode/DerivedData



回答6:



- Add the file to the project again and run



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!