So guys, I've been struggling for two days trying to get GDAL libraries working with my iOS application. Whenever I try to build my program, I get a error like the following:
Ld /Users/scottdriggers/Library/Developer/Xcode/DerivedData/Mapper-goynotoybcqaezfpmrcmfwumcokh/Build/Products/Debug-iphoneos/Mapper.app/Mapper normal arm64
cd /Users/scottdriggers/Documents/XcodeProjects/Mapper
export IPHONEOS_DEPLOYMENT_TARGET=9.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk -L/Users/scottdriggers/Library/Developer/Xcode/DerivedData/Mapper-goynotoybcqaezfpmrcmfwumcokh/Build/Products/Debug-iphoneos -L-L/usr/local/Cellar/gdal/1.11.5_2/lib -L-lgdal -L/usr/local/Cellar/gdal/1.11.5_2/lib -F/Users/scottdriggers/Library/Developer/Xcode/DerivedData/Mapper-goynotoybcqaezfpmrcmfwumcokh/Build/Products/Debug-iphoneos -F/Users/scottdriggers/Documents/XcodeProjects/Mapper/Pods/DJI-SDK-iOS/iOS_Mobile_SDK -F/Users/scottdriggers/Documents/XcodeProjects/Mapper/Pods/DJI-UILibrary-iOS/iOS_UILibrary -filelist /Users/scottdriggers/Library/Developer/Xcode/DerivedData/Mapper-goynotoybcqaezfpmrcmfwumcokh/Build/Intermediates/Mapper.build/Debug-iphoneos/Mapper.build/Objects-normal/arm64/Mapper.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -Xlinker -rpath -Xlinker #loader_path/Frameworks -Xlinker -rpath -Xlinker #executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/scottdriggers/Library/Developer/Xcode/DerivedData/Mapper-goynotoybcqaezfpmrcmfwumcokh/Build/Intermediates/Mapper.build/Debug-iphoneos/Mapper.build/Objects-normal/arm64/Mapper_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -ObjC -framework DJISDK -framework DJIUILibrary -ObjC -framework DJISDK -framework DJIUILibrary -I/usr/local/Cellar/gdal/1.11.5_2/include -lgdal.1 -framework CoreGraphics -framework MapKit -framework CoreLocation -framework UIKit -framework Foundation /Users/scottdriggers/Library/Developer/Xcode/DerivedData/Mapper-goynotoybcqaezfpmrcmfwumcokh/Build/Products/Debug-iphoneos/VideoPreviewer.framework/VideoPreviewer -lPods-Mapper -Xlinker -dependency_info -Xlinker /Users/scottdriggers/Library/Developer/Xcode/DerivedData/Mapper-goynotoybcqaezfpmrcmfwumcokh/Build/Intermediates/Mapper.build/Debug-iphoneos/Mapper.build/Objects-normal/arm64/Mapper_dependency_info.dat -o /Users/scottdriggers/Library/Developer/Xcode/DerivedData/Mapper-goynotoybcqaezfpmrcmfwumcokh/Build/Products/Debug-iphoneos/Mapper.app/Mapper
ld: warning: directory not found for option '-L-L/usr/local/Cellar/gdal/1.11.5_2/lib'
ld: warning: directory not found for option '-L-lgdal'
ld: warning: ignoring file /usr/local/Cellar/gdal/1.11.5_2/lib/libgdal.1.dylib, file was built for x86_64 which is not the architecture being linked (arm64): /usr/local/Cellar/gdal/1.11.5_2/lib/libgdal.1.dylib
Undefined symbols for architecture arm64:
"_GDALGetRasterXSize", referenced from:
-[GEOTIFFManager averageFile:] in GEOTIFFManager.o
"_GDALGetRasterYSize", referenced from:
-[GEOTIFFManager averageFile:] in GEOTIFFManager.o
...many similar issues...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Like the EXPERT LEVEL PROGRAMMER I am, I immediately went to google to search for others with similar issues, and found that there were quite a few. Following their recommendations, I did all of the following things several times in several different orders:
I cleaned and tried to build the project again
I deleted the contents of the derived data folder for Xcode
I updated the Header Search Paths, the Other Linker Flags, the Framework Search Paths, and the Library Search Paths to everything I was recommended and nothing helped. The current state of these settings is as follows:
Framework Search Paths:
$(inherited)
Header Search Paths:
$(inherited)
"${PODS_ROOT}/Headers/Public/DJI-SDK-iOS"
"${PODS_ROOT}/Headers/Public/DJI-UILibrary-iOS"
/usr/local/Cellar/gdal/1.11.5_2/include
/usr/local/include
Library Search Paths:
-L/usr/local/Cellar/gdal/1.11.5_2/lib
-lgdal
/usr/local/Cellar/gdal/1.11.5_2/lib
Runpath Search Paths:
$(inherited)
#executable_path/Frameworks
I was receiving more of these errors and I was able to fix some of these by adding some libraries into the tab "Link Binary With Libraries" in the Build Phases of my target, but these GDAL errors wont go away, even when I link the library from the /usr/local/lib file.
Link Binaries With Libraries
Background: I need to view a pixel from a GEOTiff file for my program. I am writing my application in OBJC, but the GDAL libraries are for C++ or C.
I installed these libraries using Homebrew, and this went fine, all of the files linked in /usr/local, but they are not working right with Xcode. I originally started writing this file in C++ but switched to C after a day of errors like this. After switching to C (so I wouldn't have to compile in OBJC++), I am still going through the same errors.
Note: I am also using Cocoapods to run some other libraries, but Cocoapods didn't have a GDAL library or I would have tried that route.
The Plot Thickens: When I run the program for the iPhone simulator instead of trying to run it on my iPhone 7, the program compiles just fine and says "build succeeded", but I get another error when it tries to attach it to the simulator:
dyld: Library not loaded: /usr/local/opt/gdal/lib/libgdal.1.dylib
Referenced from: /Users/scottdriggers/Library/Developer/CoreSimulator/Devices/1618C362-7271-4E1D-93C7-DE7CE2F15F59/data/Containers/Bundle/Application/905B2454-C731-42DC-8963-5B5C3F4A62A6/Mapper.app/Mapper
Reason: no suitable image found.
Did find: /usr/local/opt/gdal/lib/libgdal.1.dylib: mach-o, but not built for iOS simulator
I don't think its necessary to include the file that causes the errors, but here is a sampling if anybody wants to take a look:
#include "GEOTIFFManager.h"
#include "gdal.h"
#include "cpl_conv.h"
#interface GEOTIFFManager()
#end
#implementation GEOTIFFManager
- (id) init{
self = [super init];
GDALAllRegister();
return self;
}
- (float) getPixelValueOfCoordinate:(double *)coordinate FromFile:(char *)name{
GDALDatasetH* inFile = (GDALDatasetH*)GDALOpen(name, GA_ReadOnly);
double* transformation = NULL;
GDALGetGeoTransform(inFile, transformation);
double* transformedCoord;
transformedCoord = reverseTransform(coordinate, transformation);
int pixelX = floor(transformedCoord[0]);
int pixelY = floor(transformedCoord[1]);
float tempArray[1] = {-1.0};
float* output = tempArray;
GDALRasterBandH Band = GDALGetRasterBand(inFile, 1);
GDALRasterIO(Band, GF_Read, pixelX, pixelY, 1, 1, output, 1, 1, GDT_CFloat32, 0, 0);
return output[0];
}
Anyways, thank you all for your help, I do appreciate it. Hope yall can provide some helpful tips.
I've not done any Xcode or iOS development, but I'd suggest fixing the linker errors before you do anything else:
ld: warning: directory not found for option '-L-L/usr/local/Cellar/gdal/1.11.5_2/lib'
The linker could not find the directory -L/usr/local/Cellar/gdal/1.11.5_2/lib. It looks like you've got two -L options one after the other, so I'd remove the first, and then double check that the directory /usr/local/Cellar/gdal/1.11.5_2/lib exists and includes the libraries you want. This might be an Xcode configuration problem. Look at wherever you configure the linker includes.
ld: warning: directory not found for option '-L-lgdal'
Same issue here, the -L option specifies an additional directory to look for libraries, and the -l option gives a specific library to include (in this case, gdal). The string -L-lgdal makes no sense, but -lgdal does make sense.
ld: warning: ignoring file /usr/local/Cellar/gdal/1.11.5_2/lib/libgdal.1.dylib, file was built for x86_64 which is not the architecture being linked (arm64): /usr/local/Cellar/gdal/1.11.5_2/lib/libgdal.1.dylib
The library that was found is for x86_64 architecture but you're trying to build an arm64 application. If you got the libraries as pre-built binaries then go find an arm64 binary. If you built the libraries then you want to re-build them for the arm64 architecture.
I found the answer. I was trying to install Mac OSX applications to my iOS application. Yea, I know, pretty dumb. I fixed this by googling around until I found someone who had a tutorial for this solution. Hope this helps somebody sometime.
Related
I am trying to implement admob in my app, so that it can display ads when iAd can't or won't. I am getting this error and I've tried everything that I could find online to fix it. Nothing seems to work.
Framework not found GoogleMobileAds
clang: error: linker command failed with exit code 1 (use -v to see invocation)
To implement admob, I downloaded the latest GoogleMobileAdsSDK and unzipped it. I then went to Linked Frameworks and Libraries and added it there. I had to browse the location to which I unzipped it to get it. I also saw something online about adding -ObjC to Linking > Other Linker Flags, and I did that. When I build it, I get the error. If I remove it from Linked Frameworks and Libraries, my app will once again compile.
This is the full linker error:
Ld /Users/Scott/Library/Developer/Xcode/DerivedData/SampleProject-bkpjdyfrfcdilmegqcqkdlsewsiu/Build/Products/Debug-iphonesimulator/SampleProject.app/SampleProject normal x86_64
cd "/Users/Scott/Documents/Production Code/iOS7/Production/SampleProject"
export IPHONEOS_DEPLOYMENT_TARGET=9.0
export PATH="/Applications/Xcode 7/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode 7/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode\ 7/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode\ 7/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk -L/Users/Scott/Library/Developer/Xcode/DerivedData/SampleProject-bkpjdyfrfcdilmegqcqkdlsewsiu/Build/Products/Debug-iphonesimulator -F/Users/Scott/Library/Developer/Xcode/DerivedData/SampleProject-bkpjdyfrfcdilmegqcqkdlsewsiu/Build/Products/Debug-iphonesimulator -F/Users/Scott/Documents/Production\ Code/iOS7/Production/SampleProject -filelist /Users/Scott/Library/Developer/Xcode/DerivedData/SampleProject-bkpjdyfrfcdilmegqcqkdlsewsiu/Build/Intermediates/SampleProject.build/Debug-iphonesimulator/SampleProject.build/Objects-normal/x86_64/SampleProject.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -mios-simulator-version-min=9.0 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -L/Applications/Xcode\ 7/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/Scott/Library/Developer/Xcode/DerivedData/SampleProject-bkpjdyfrfcdilmegqcqkdlsewsiu/Build/Intermediates/SampleProject.build/Debug-iphonesimulator/SampleProject.build/Objects-normal/x86_64/SampleProject.swiftmodule -framework GoogleMobileAds -framework iAd -Xlinker -dependency_info -Xlinker /Users/Scott/Library/Developer/Xcode/DerivedData/SampleProject-bkpjdyfrfcdilmegqcqkdlsewsiu/Build/Intermediates/SampleProject.build/Debug-iphonesimulator/SampleProject.build/Objects-normal/x86_64/SampleProject_dependency_info.dat -o /Users/Scott/Library/Developer/Xcode/DerivedData/SampleProject-bkpjdyfrfcdilmegqcqkdlsewsiu/Build/Products/Debug-iphonesimulator/SampleProject.app/SampleProject
Any ideas on this?
I was able to solve the same problem with the following code.
Remove your GoogleMobileAds framework from your project. And add it again
Add this to the Library Search Paths in Build Settings and make sure you select recursive, delete other library paths which might be absolute paths.
$(PROJECT_DIR)
May be it will help you.
This happened to me on two of my apps and caused me hours of frustration.
I will write down the process that I took:
Delete all GoogleADMOB frameworks from Xcode project
Move the files to the trash
Navigate to
/Users/jeremy/Library/Developer/Xcode/
and delete "DerivedData". Xcode will regenerate this on the next execution of your project.
Empty Trash
Force quit Xcode and any simulators
Restart Computer
Download a new SDK from google
Download GoogleADMob SDK
I did try to do this by avoiding to redownload the SDK but had no success.
Place them into your project as you had them before and run.
I have seen many different solutions, but they personally did not work for me. I really hope this helps anyone else who comes across this issue. It will save you the time and stress.
So for one of my classes, we are supposed to refactor this project from last quarter that was left in a pretty bad state.
So we are trying to write unit tests for the project, but they used an old version of Xcode, so we had to re-add the XCTest framework to "Link Binary With Libraries".
I accidentally added the MacOSX version of it the first time, and noticed my error. I removed the OS X version from the linker, and added the iPhoneSimulator version to it. It kept giving me the same error. So I removed all XCTest.framework files from the Build Phases, and it gave me an error about OCMock (which is a totally different problem that I'm not concerned about right now), which means it knows it's gone. So I then tried re-adding XCTest.framework to my test target, making sure it was the iOSSimulator version, and it gives me the same error about it being the Mac OS X version. I have tried restarting Xcode and did correctly that I did before but that did not work. Below is the full output from the error.
Ld /Users/MY_USERNAME/Library/Developer/Xcode/DerivedData/Henry-ayqkhtmgjufxaagawvfjprhgilji/Build/Products/Debug-iphonesimulator/HenryTests.xctest/HenryTests normal x86_64
cd /Users/MY_USERNAME/Git/JrProj-1415-Mike/Code/iOS/Henry
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk -L/Users/MY_USERNAME/Library/Developer/Xcode/DerivedData/Henry-ayqkhtmgjufxaagawvfjprhgilji/Build/Products/Debug-iphonesimulator -L/Users/MY_USERNAME/Git/JrProj-1415-Mike/Code/iOS/Henry -F/Users/MY_USERNAME/Library/Developer/Xcode/DerivedData/Henry-ayqkhtmgjufxaagawvfjprhgilji/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Users/MY_USERNAME/Git/JrProj-1415-Mike/Code/iOS/Henry -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk/Developer/Library/Frameworks -filelist /Users/MY_USERNAME/Library/Developer/Xcode/DerivedData/Henry-ayqkhtmgjufxaagawvfjprhgilji/Build/Intermediates/Henry.build/Debug-iphonesimulator/HenryTests.build/Objects-normal/x86_64/HenryTests.LinkFileList -bundle_loader /Users/MY_USERNAME/Library/Developer/Xcode/DerivedData/Henry-ayqkhtmgjufxaagawvfjprhgilji/Build/Products/Debug-iphonesimulator/Henry.app/Henry -Xlinker -objc_abi_version -Xlinker 2 -framework XCTest -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework XCTest -lOCMock -framework UIKit -framework Foundation -framework Firebase -Xlinker -dependency_info -Xlinker /Users/MY_USERNAME/Library/Developer/Xcode/DerivedData/Henry-ayqkhtmgjufxaagawvfjprhgilji/Build/Intermediates/Henry.build/Debug-iphonesimulator/HenryTests.build/Objects-normal/x86_64/HenryTests_dependency_info.dat -o /Users/MY_USERNAME/Library/Developer/Xcode/DerivedData/Henry-ayqkhtmgjufxaagawvfjprhgilji/Build/Products/Debug-iphonesimulator/HenryTests.xctest/HenryTests
ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework/XCTest' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
In case anyone come across this problem too, pretty much the only solution is to make a new project, and add all the files to that new project. I've talked to some professionals in iOS development, and they could come up with no other solution. I think it has something to do with the project being from a pretty old version of Xcode, and the new XCTest framework being pretty new. Good luck to you if you come across this too.
Compiling my main target (not a test target like here) yields this error:
ld: warning: Auto-Linking supplied
'~/Documents/my_app/MyApp/Crashlytics.framework/Crashlytics',
framework linker option at
~/Documents/my_app/MyApp/Crashlytics.framework/Crashlytics
is not a dylib
From this build command:
Ld /Build/Products/Debug-iphonesimulator/MyApp.app/MyApp normal i386
cd ~/Documents/my_app/MyApp
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk -L~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Products/Debug-iphonesimulator -F~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Products/Debug-iphonesimulator -F~/Documents/my_app/MyApp -filelist ~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-CocoaLumberjack -lPods-Mantle -framework CFNetwork -framework Foundation -framework Security -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.0 -framework CoreGraphics -lPods -framework MapKit -framework Fabric -lPods-MyApp -Xlinker -dependency_info -Xlinker ~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp_dependency_info.dat -o ~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp
The Missing Link:
This error is almost always produced by not having the binary linked to the library (In this case it would be the Crashlytics.framework):
Trying to build the target MyApp (which includes headers with #import <Crashlytics/Crashlytics.h> will produce the error:
ld: warning: Auto-Linking supplied
'../../Crashlytics.framework/Crashlytics', framework linker option at
../../Crashlytics.framework/Crashlytics is not a dylib
Link the Framework:
Fortunately, it should be easy to fix the problem simply by dragging the Crashlytics.framework from the Frameworks folder in the project navigator into the list of Link Binary With Libraries or by using the +.
Make sure you have your App selected/highlighted under Targets while doing this process.
I had the same issue but my reason was different.
Error Output
ld: warning: Auto-Linking supplied '~/GameFolder/Pods/Fabric/tvOS/Fabric.framework/Fabric', framework linker option at ~/GameFolder/Pods/Fabric/tvOS/Fabric.framework/Fabric is not a dylib
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Answers", referenced from:
type metadata accessor for __ObjC.Answers in GameScene.o
type metadata accessor for __ObjC.Answers in AppDelegate.o
"_OBJC_CLASS_$_Crashlytics", referenced from:
type metadata accessor for __ObjC.Crashlytics in AppDelegate.o
"_OBJC_CLASS_$_Fabric", referenced from:
type metadata accessor for __ObjC.Fabric in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Reason
My target was overriding the OTHER_LDFLAGS.
Solution
Changed the OTHER_LDFLAGS to just inherit the Linker Flags. Basically, changed it to $(inherited)
I followed all steps provided by #i'L'i but I was not able to find Crashlytics.framework and Fabric.framework file in build phases.
So this helped me.
Step 1: Follow all the steps given Here.
Step 2: Now when you are unable to find Crashlytics.framework and Fabric.framework files in Link Binary With Libraries by clicking + do following.
2.1: Click on + button in Link Binary With Libraries.
2.2: Click on Add Other... button.
2.3: Now chose Crashlytic.framework and Fabric.framework from Pod folder - if using cocoapods, else choose both file from where you have downloaded it.
Step 3: Build Succeeded, Enjoy. :)
For future reference, this can also happen if you link your test files to your app target.
For example:
https://github.com/realm/realm-cocoa/issues/1661
I had the same problem. Maybe I messed up the initial fabric install but once I added Fabric.framework to the list of frameworks (should be in the root folder of your app by default) everything worked.
Conversely to what I'L'I and user3517250 mention, the problem might also be that you have #import statements that shouldn't be there.
Xcode does infer the frameworks to link against from the #import statements. If you import a framework that you don't link against, then you get this warning.
I am thinking of rebuilding the project from scratch which I would like to avoid, so I am asking for help.
When trying to build the project on release I get the following link error:
Ld
/Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos/MyStreamPlayer.app/MyStreamPlayer
normal armv7
cd /Users/MAS/iphoneApps/AlfsreamPlayer/MyStreamPlayer
setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk
-L/Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos
-L/Users/MAS/iphoneApps/AlfsreamPlayer/MyStreamPlayer -L/Users/MAS/iphoneApps/AlfsreamPlayer/MyStreamPlayer/../build -F/Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos
-filelist /Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Intermediates/MyStreamPlayer.build/Release-iphoneos/MyStreamPlayer.build/Objects-normal/armv7/MyStreamPlayer.LinkFileList
-Xlinker -map -Xlinker /Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Intermediates/MyStreamPlayer.build/Release-iphoneos/MyStreamPlayer.build/MyStreamPlayer-LinkMap-normal-armv7.txt -dead_strip -finalize -prefinalized-library libViewRightWebiOS.a -finalized-product /Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos/MyStreamPlayer.app/MyStreamPlayer
-libVideoWebiOS -fobjc-link-runtime -miphoneos-version-min=6.0 -framework Foundation -framework UIKit -framework CoreGraphics -framework MediaPlayer -framework CFNetwork -libVideoWebiOS_debug -libVideoWebiOS -o /Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos/MyStreamPlayer.app/MyStreamPlayer
clang: error: no such file or directory:
'/Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos/MyStreamPlayer.app/MyStreamPlayer'
No problem with debug mode. The project runs fine on another computer on xcode 4.5.1. I thought the xcode version could be the problem but when I tried it on another computer with xcode 4.5.1 I got the same problem.
The project uses a library libVideoWebiOS. I have it on the Build Phases -> Link Binary With Libraries. Any idea what produce could this issue? Here is the screenshot of build settings -> architectures.
There are lot of suggestions to Change "Build Active Architecure Only" to Yes but unfortunately that didn't work for me.
From your comment, it seems you are having multiple targets in your project. If you are using any third party libraries or wrapper classes, don't import the project. Add only the required files and folders you want. I don't know how to make the project in release mode which having multiple targets. But making your project with one target might solve your problem. Remove the references of your third party project.xcodeproj and add the source files what are all you needed in that project. Hope it helps.
Ron is correct, you must use the Finalizer before you can create a release build. Be sure you have Xcode closed for the finalizer to work.
I have no idea where to look to find where this error is, because I am having a hard time interpreting these error messages. I'm used to C# and the error messages are amazing apparently... anyways, how can I fix this and what does it even mean?
Ld /Users/Ryan/Library/Developer/Xcode/DerivedData/MiniStories-aburzjgfwocruwabfufijwygorxl/Build/Products/Debug-iphonesimulator/MiniStories.app/MiniStories normal i386
cd /Users/Ryan/Desktop/MiniStories
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang
-arch i386 - isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer SDKs/iPhoneSimulator5.0.sdk
-L/Users/Ryan/Library/Developer/Xcode/DerivedData/MiniStories-aburzjgfwocruwabfufijwygorxl/Build/Products/Debug-iphonesimulator
-F/Users/Ryan/Library/Developer/Xcode/DerivedData/MiniStories-aburzjgfwocruwabfufijwygorxl/Build/Products/Debug-iphonesimulator
-filelist /Users/Ryan/Library/Developer/Xcode/DerivedData/MiniStories-aburzjgfwocruwabfufijwygorxl/Build/Intermediates/MiniStories.build/Debug-iphonesimulator/MiniStories.build/Objects-normal/i386/MiniStories.LinkFileList
-mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker
-no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -lsqlite3
-framework QuartzCore -framework AVFoundation -framework UIKit
-framework Foundation -framework CoreGraphics
-o /Users/Ryan/Library/Developer/Xcode/DerivedData/MiniStories-aburzjgfwocruwabfufijwygorxl/Build/Products/Debug-iphonesimulator/MiniStories.app/MiniStories
Undefined symbols for architecture i386:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This error shows when you're trying to link against a precompiled library that is built in a different architecture than your target.
My guess is that you are trying to compile something for the simulator, but you're using some external library in your project (file with a .a extension) that was built for the device architecture. If the library was actually built for the device, it will probably compile for the device, but if you want to test stuff on the simulator, you'll have to either recompile the library and make it universal if possible, or use a separate build for the simulator if one is available.
I had the same issue and I just figured it out and made it work. I am following Stanford IOS development tutorial and I was about to complete (a few final touches) assignment III, The application was working fine all along and once I got this error, I was convinced that I messed up something, I almost spend 3 hours trying to debug and finally realized something else is wrong, while I was not able to figure out the exact reason, I overcame it by creating an another project and just copied (not linking) the files from the project to this new one and it started working.
I think the situation I encountered was weird, one thing I can say is I did reboot my mac since I had it up and running (almost 1 month),in the middle I had couple of OS updates, so I am attributing this error to that :)