Xcode 16 project build malfunction

I have one project, it has one Swift (AppKit) App and one C++ dylib project, I don't have problem in build the dylib, but when build the UI App, there will be an error: "ld: multiple errors: file cannot be open()ed, errno=2 path=/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/AppDelegate.o in '/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/AppDelegate.o'; file cannot be open()ed, errno=2 path=/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/ViewController.o in '/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/ViewController.o'; file cannot be open()ed, errno=2 path=/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/GeneratedAssetSymbols.o in '/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/GeneratedAssetSymbols.o' clang++: error: linker command failed with exit code 1 (use -v to see invocation)"

Clean project folder and rebuild - it won't fix I tried remove the two Swift files and added it again- it won't fix Delete DerivedData folder - it won't fix

I upgraded to Xcode 16.1 - also tried above, it won't fix

BUT: the project doesn't have any problem when build with Xcode 15

Answered by stang2021 in 814064022

Thanks to ycc_ch, I did the stupid way to resolve the problem: created both projects with Xcode 16, and then copy the code over.

"I’ve been struggling with this issue for two weeks, and I’ve tried everything I could think of. The error I kept encountering was:

file cannot be open()ed, errno=2 path=path_to_my_project/arm64/xxxxx.o;

After a lot of trial and error, here's what finally worked for me:

  • Identify the files referenced in the error (in this case, xxxxx.o).
  • Open your Xcode project and locate the xxxxx.swift file mentioned in the error.
  • Rename the xxxxx.swift file to xxxxx_old.swift.
  • Create a new untitled file in the same folder, and give it the original name (xxxxx.swift).
  • Copy the code from the xxxxx_old.swift file into the newly created xxxxx.swift.
  • Rebuild the project. In the build log, the error should now reference the xxxxx_old.o instead of the xxxxx.o that was previously causing the issue.
  • Delete the xxxxx_old.swift file, then rebuild the project again.

After doing this, the error should no longer appear in the log for that class. I had to repeat this process for every file referenced in the log. In some cases, I had to apply the same steps twice for the same file for the solution to work.

Good luck and let me know if it helped.

Best regards,

Accepted Answer

Thanks to ycc_ch, I did the stupid way to resolve the problem: created both projects with Xcode 16, and then copy the code over.

Xcode 16 project build malfunction
 
 
Q