Xcode Obj-C Can't open output file for writing, errno=21 for architecture x86_64

Viewed 3729

First of all the project I'm working at is written in Objective-C and I use XCode 8.3.2.

When I want to run my app in Debug-Mode I don't have any problems, it runs on simulator and on real devices.

But when I try to run the app in Release-Mode, then there are two errors:

ld: can't open output file for writing: /Users/rr/Library/Developer/Xcode/DerivedData/LehrerApp-abwqpnehycsrglaplrxtulrrlplf/Build/Intermediates/LehrerApp.build/Release-iphonesimulator/LehrerApp.build/Objects-normal/x86_64/LehrerApp, errno=21 for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I know there are already some answers here, but they didn't helped. I tried the following:

  • delete derived data, clean, clean folder, build etc.
  • in my Info.plist there is no "Architecture Priority" set
  • set Build Active Architecture Only to No

My Build Settings look as follows:

  • Architectures: Standard architectures(arm7, arm64)
  • Valid Architectures: arm64 arm7 armv7s

I don't know any further. Please help me, what can I do?

1 Answers

This error may occur if you add the root (folders / files) inside sub folder. So in my case I had a requirement for adding the images into the images folder. But instead of adding image, I added all the files present in my project folder. After a long time, found that there is something wrong within the project structure. So, I removed the reference of the duplicated files, now this error is no more. I hope this may help someone.

Related