Xcode linker error: file too small for x86_64 architecture

I am developing an application in Xcode.

When I try to build, this error occurs:

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 is wrong?

+59
ios objective-c xcode cocoa macos
Dec 25
source share
9 answers

Theft @ martin-baulig answer:

Try rebuilding / clearing completely. The previous build may have been abnormally interrupted, leaving the TWRAppDelegate.o file damaged or null.

+130
Apr 29 '15 at 19:13
source share

Usually I add a space to this file (maybe any character), delete it and then save it. Easier and faster than a clean build.

+9
Mar 03 '17 at 15:04
source share

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

+2
Oct 20 '16 at 8:57
source share

Since creating a clean project can take too much time, the less opportunities there are for those who have access to a file that is damaged in the cache:

  • Delete file (Delete link)
  • Assembly project
  • Upload file
  • Assembly project

Full version, so it’s not difficult for you to find the file:

  • Find file in Xcode project navigator
  • Right-click the file and click "show in finder" (opens the search engine where the file is located)
  • Select the file in Xcode and click Backspace, then click Remove Link
  • Build a project (it will fail, but wait for it to complete)
  • Download the file by dragging it from the search device to the same place where you just deleted it.
  • Build project (should work now)
+1
Jun 29 '16 at 11:18
source share

You can simply delete the TWRAppDelegate.o file and continue building. Copy the full path specified in the error message and paste it behind the "rm" command in your terminal. There is no need to clean / rebuild, delete derived data, add / remove a file from a project, etc.

+1
Jun 04 '18 at 20:29
source share

just delete this file by running cmd in your terminal application:

 rm /Users/theodore/Library/Developer/Xcode/DerivedData/Tower-bkpdifuqssebjdgurzmtirbxejnn/Build/Intermediates/Tower.build/Debug/Tower.build/Objects-normal/x86_64/TWRAppDelegate.o 
+1
Sep 14 '18 at 2:34
source share

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

Step 2. Set β€œAlways search for user paths” to β€œYes”

Step 3. Build the project (you will receive a warning, but the project will be built.)

Step 4. Set "Always search for user paths" back to "No" and create again to eliminate the warning

0
Aug 02 '16 at 5:28
source share

There was no clean rebuild in my case, so I will explain how I solved the problem:
- Removed file link (do not delete file)
- add the file to the project again and run

0
Dec 05 '16 at 22:15
source share

To solve this problem automatically, you can add Build Script Phase . Go to Xcode β†’ Your project β†’ Your goal β†’ Build phases β†’ + β†’ The phase of the new script run

Rename it to Xcode Link Fix and move it above the Compile Sources phase. Insert this into the body of the script:

 # Legacy build system dirname "$LD_DEPENDENCY_INFO_FILE" | xargs -I {} find {} -size 0 | while read -d $'\n' file; do rm "$file" done # New build system find "$OBJECT_FILE_DIR_normal" -size 0 | while read -d $'\n' file; do rm "$file" done 

This script checks for object files with a size of zero and deletes them, so when the compilation is completed in the next step, it will be successful.

You need to add this script for each purpose of the application, if you have a lot of them.

This script takes ~ 0.1 seconds to run and saves you from a complete rebuild of the project.

0
Nov 21 '18 at 14:25
source share



All Articles