Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - can't link with a main executable file (release)?

Tags:

xcode

ios

I recently updated XCode to V 11.1, and since updating, for some reason when I run my app in release mode, I'm thrown the following error:

ld: can't link with a main executable file '/Users/me/Library/Developer/Xcode/DerivedData/myapp-btokobigvkxtgwgcjrapocxlexno/Build/Products/Release-iphoneos/myapp.app/myapp' for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have absolutely no clue how to resolve this - and I can't run my app in release mode without it (and yes, I'm using a Distribution profile). Help would be much appreciated. I've browsed a few other answers but none seem to solve this issue.

When I navigate to that file path, 'myapp' is simply an icon with a circle and a slash through it (can't be a good sign). This same thing occurs even after I clean the build folder. When I try to rebuild in release mode, the build fails and throws me the above yet again.

See full error:

Ld /Users/admin/Library/Developer/Xcode/DerivedData/myapp-btokobigvkxtgwgcjrapocxlexno/Build/Intermediates.noindex/myapp.build/Release-iphoneos/myappTests.build/Objects-normal/armv7/Binary/myappTests normal armv7 (in target 'myappTests' from project 'myapp') cd /Users/admin/Desktop/myapp /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target armv7-apple-ios8.4 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk -L/Users/admin/Library/Developer/Xcode/DerivedData/myapp-btokobigvkxtgwgcjrapocxlexno/Build/Products/Release-iphoneos -F/Users/admin/Library/Developer/Xcode/DerivedData/myapp-btokobigvkxtgwgcjrapocxlexno/Build/Products/Release-iphoneos -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/Developer/Library/Frameworks -F/Users/admin/Desktop/myapp/Pods/FirebaseAnalytics/Frameworks -F/Users/admin/Desktop/myapp/Pods/GoogleAppMeasurement/Frameworks -F/Users/admin/Desktop/myapp/Pods/GoogleMaps/Base/Frameworks -F/Users/admin/Desktop/myapp/Pods/GoogleMaps/Maps/Frameworks -F/Users/admin/Desktop/myapp/Pods/GooglePlaces/Frameworks -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -filelist /Users/admin/Library/Developer/Xcode/DerivedData/myapp-btokobigvkxtgwgcjrapocxlexno/Build/Intermediates.noindex/myapp.build/Release-iphoneos/myappTests.build/Objects-normal/armv7/myappTests.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -bundle_loader /Users/admin/Library/Developer/Xcode/DerivedData/myapp-btokobigvkxtgwgcjrapocxlexno/Build/Products/Release-iphoneos/myapp.app/myapp -Xlinker -object_path_lto -Xlinker /Users/admin/Library/Developer/Xcode/DerivedData/myapp-btokobigvkxtgwgcjrapocxlexno/Build/Intermediates.noindex/myapp.build/Release-iphoneos/myappTests.build/Objects-normal/armv7/myappTests_lto.o -fobjc-arc -fobjc-link-runtime -lc++ -licucore -lsqlite3 -lz -framework Accelerate -framework CFNetwork -framework CoreData -framework CoreGraphics -framework CoreImage -framework CoreLocation -framework CoreTelephony -framework CoreText -framework Foundation -framework GLKit -framework ImageIO -framework OpenGLES -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -framework UIKit -framework XCTest -lPods-myappTests -Xlinker -dependency_info -Xlinker /Users/admin/Library/Developer/Xcode/DerivedData/myapp-btokobigvkxtgwgcjrapocxlexno/Build/Intermediates.noindex/myapp.build/Release-iphoneos/myappTests.build/Objects-normal/armv7/myappTests_dependency_info.dat -o /Users/admin/Library/Developer/Xcode/DerivedData/myapp-btokobigvkxtgwgcjrapocxlexno/Build/Intermediates.noindex/myapp.build/Release-iphoneos/myappTests.build/Objects-normal/armv7/Binary/myappTests

ld: can't link with a main executable file '/Users/admin/Library/Developer/Xcode/DerivedData/myapp-btokobigvkxtgwgcjrapocxlexno/Build/Products/Release-iphoneos/myapp.app/myapp' for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

like image 682
Brittany Avatar asked Oct 22 '19 18:10

Brittany


2 Answers

Finally found the fix in my case. Hopefully this answer is helpful to others.

Product > Scheme > Edit Scheme, and then tap the 'Build' category on the left hand side.

Under your appTests targets, uncheck "Run".

Problem solved.

like image 149
Brittany Avatar answered Nov 12 '22 03:11

Brittany


Could you say where do you find the slashed icon - it may be a sign Xcode tries to look at a wrong path. You may easily verify it with right-click on the project from Project Navigator, show in Finder.
I recommend Changing deployment target to 8.4.
A solution might be going to Product > Scheme > Edit Scheme, choose Build and uncheck 'Run'

like image 30
Viktor Varsano Avatar answered Nov 12 '22 04:11

Viktor Varsano