XCode - ld: library not found for -lfile_vacuum - xcode

I added a CocoaPod (SwiftySandboxFileAccess) to my project and now I'm getting the following error:
Ld /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Products/Debug/FileVacuum.app/Contents/MacOS/FileVacuum normal x86_64 (in target 'FileVacuum' from project 'FileVacuum')
cd /Users/mike/Documents/Mikeumus/code/FileVacuum/menubar-filevacuum
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-macos10.15 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -L/Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Products/Debug -L. -LCarthage -LFileVacuum -LFileVacuum.xcworkspace -LFileVacuumLauncher2 -LFileVacuumTests -LFileVacuumUITests -LMenubar-FileVacuumTests -LMenubar-FileVacuumUITests -LPods -LCarthage/Build -LCarthage/Checkouts -LFileVacuum/FileVacuum\ 2020-06-08\ 11-57-59 -LFileVacuum/FileVacuum.xcarchive -LFileVacuum/Pods -LFileVacuum.xcworkspace/xcshareddata -LFileVacuum.xcworkspace/xcuserdata -LPods/Headers -LPods/Local\ Podspecs -LPods/SwiftySandboxFileAccess -LPods/Target\ Support\ Files -LCarthage/Build/Mac -LCarthage/Build/iOS -LCarthage/Checkouts/AppReceiptValidator -LFileVacuum/FileVacuum.xcarchive/Products -LFileVacuum/FileVacuum.xcarchive/SwiftSupport -LFileVacuum/Pods/Headers -LFileVacuum/Pods/Local\ Podspecs -LFileVacuum/Pods/Target\ Support\ Files -LFileVacuum.xcworkspace/xcshareddata/swiftpm -LFileVacuum.xcworkspace/xcuserdata/mike.xcuserdatad -LPods/Headers/Public -LPods/SwiftySandboxFileAccess/SwiftySandboxFileAccess -LPods/Target\ Support\ Files/Pods-FileVacuum -LPods/Target\ Support\ Files/SwiftySandboxFileAccess -LCarthage/Build/Mac/AppReceiptValidator.framework.dSYM -LCarthage/Build/iOS/AppReceiptValidator.framework.dSYM -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator -LFileVacuum/FileVacuum.xcarchive/Products/Applications -LFileVacuum/FileVacuum.xcarchive/SwiftSupport/macosx -LPods/Headers/Public/SwiftySandboxFileAccess -LPods/SwiftySandboxFileAccess/SwiftySandboxFileAccess/Classes -LCarthage/Build/Mac/AppReceiptValidator.framework.dSYM/Contents -LCarthage/Build/iOS/AppReceiptValidator.framework.dSYM/Contents -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Demo\ iOS -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Demo\ macOS -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ Shared -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ iOS -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ macOS -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app -LCarthage/Build/Mac/AppReceiptValidator.framework.dSYM/Contents/Resources -LCarthage/Build/iOS/AppReceiptValidator.framework.dSYM/Contents/Resources -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/Supporting\ Files -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ Shared/Test\ Assets -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ Shared/Tools -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app/Contents -LCarthage/Build/Mac/AppReceiptValidator.framework.dSYM/Contents/Resources/DWARF -LCarthage/Build/iOS/AppReceiptValidator.framework.dSYM/Contents/Resources/DWARF -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/include-ios -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/include-macos -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/lib-ios -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/lib-macos -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/Supporting\ Files/iOS -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/Supporting\ Files/macOS -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ Shared/Test\ Assets/Other\ Receipts -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app/Contents/Frameworks -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app/Contents/MacOS -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app/Contents/Resources -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app/Contents/_CodeSignature -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/include-ios/openssl -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/include-macos/openssl -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ Shared/Test\ Assets/Other\ Receipts/unparseable -L/Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Products/Debug/SwiftySandboxFileAccess -F/Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Products/Debug -F/Users/mike/Documents/Mikeumus/code/FileVacuum/menubar-filevacuum/Carthage/Build/Mac -filelist /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Intermediates.noindex/FileVacuum.build/Debug/FileVacuum.build/Objects-normal/x86_64/FileVacuum.LinkFileList -Xlinker -rpath -Xlinker #executable_path/../Frameworks -Xlinker -object_path_lto -Xlinker /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Intermediates.noindex/FileVacuum.build/Debug/FileVacuum.build/Objects-normal/x86_64/FileVacuum_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-link-runtime -fprofile-instr-generate -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Intermediates.noindex/FileVacuum.build/Debug/FileVacuum.build/Objects-normal/x86_64/FileVacuum.swiftmodule -ObjC -lSwiftySandboxFileAccess -framework AppReceiptValidator -framework Automator -lfile_vacuum -lresolv -lPods-FileVacuum -Xlinker -dependency_info -Xlinker /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Intermediates.noindex/FileVacuum.build/Debug/FileVacuum.build/Objects-normal/x86_64/FileVacuum_dependency_info.dat -o /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Products/Debug/FileVacuum.app/Contents/MacOS/FileVacuum -Xlinker -add_ast_path -Xlinker /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Intermediates.noindex/SwiftyStoreKit.build/Debug/SwiftyStoreKit.build/Objects-normal/x86_64/SwiftyStoreKit.swiftmodule
ld: library not found for -lfile_vacuum
clang: error: linker command failed with exit code 1 (use -v to see invocation)
pod install and pod update was giving the following warnings:
[!] The `FileVacuum [Debug]` target overrides the `LIBRARY_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-FileVacuum/Pods-FileVacuum.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `FileVacuum [Release]` target overrides the `LIBRARY_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-FileVacuum/Pods-FileVacuum.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
I changed the "Target" level LIBRARY_SEARCH_PATHS to $(inherited) and these warnings went away but I changed the "Project" level LIBRARY_SEARCH_PATHS and don't remember what it was before I changed it so I just set it to $(inherited), $(PROJECT_DIR) recursive
I have done the following:
Close the Xcode;
Run pod install and pod update;
Open the new .xcworkspace;
Clean and Build Project;
Here's some of app's settings:
LIBRARY_SEARCH_PATH setting is the same for the "Project" and "Target" levels:
"file_vacuum" doesn't result in a file/settings search:
In the screenshot above this one you can see I'm linking a libfile_vacuum.a, I don't know if this is the same file_vacuum causing the issue.
Podfile
platform :macos, '10.15'
target 'FileVacuum' do
pod 'SwiftySandboxFileAccess', '~> 2.0'
end

It looks like it is failing to locate file_vacuum library which is a static library based on your screenshots. Make sure you add the path for that file in your LIBRARY_SEARCH_PATH in your target Build Settings. You can also just search for search paths and find it there. In general, whenever there's an error about not finding a header file or an object, it's related to search paths and means Compiler isn't able to find information for that type / library.
Framework, Library, and Header search paths are the three types you can define and help the Compiler to find those files.

Related

OSX application fails to compile after adding the Firebase Library

I'm building a windowless menubar application (agent) with a popover. This application requires an integration with Firebase to retrieve some data from this store. XCode version is 6.3.
After installing the latest version of cocoapods (0.38.2) and creating the Podfile as such:
# Uncomment this line to define a global platform for your project
platform :osx, '10.10'
pod 'Firebase', '>= 2.3.3'
target 'dTrain-osx-agent' do
end
target 'dTrain-osx-agentTests' do
end
I'm getting the following build failure error:
Ld /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug/dTrain-osx-agent.app/Contents/MacOS/dTrain-osx-agent normal x86_64
cd /Users/user/Projects/interop/dtrain_osx/dTrain-osx-agent
export MACOSX_DEPLOYMENT_TARGET=10.10
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -L/Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug -F/Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug -F/Users/user/Projects/interop/dtrain_osx/dTrain-osx-agent/Pods/Firebase -filelist /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Intermediates/dTrain-osx-agent.build/Debug/dTrain-osx-agent.build/Objects-normal/x86_64/dTrain-osx-agent.LinkFileList -Xlinker -rpath -Xlinker #executable_path/../Frameworks -mmacosx-version-min=10.10 -ObjC -lc++ -licucore -framework CFNetwork -framework Firebase -framework Security -framework SystemConfiguration -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -add_ast_path -Xlinker /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Intermediates/dTrain-osx-agent.build/Debug/dTrain-osx-agent.build/Objects-normal/x86_64/dTrain_osx_agent.swiftmodule -lPods -Xlinker -dependency_info -Xlinker /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Intermediates/dTrain-osx-agent.build/Debug/dTrain-osx-agent.build/Objects-normal/x86_64/dTrain-osx-agent_dependency_info.dat -o /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug/dTrain-osx-agent.app/Contents/MacOS/dTrain-osx-agent
ld: framework not found OpenGLES for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Edit:
XCode upgraded to 6.4 (6E35b) and still facing the problem
It looks like this issue is a result of some changes we made to how we build the Firebase SDK in 2.3.3. For now, can you pleas use the 2.3.2 version of the SDK, by modifying your Podfile as such:
pod 'Firebase', '2.3.2'
Meanwhile we'll investigate and try to get this fixed in a future version of the SDK. I'll update this answer once we do.
Note that if you're using Swift and Firebase SDK 2.3.2, you'll need to use a bridging header to import Firebase into a swift app.
To do that, create a new Objective-C file in your project. When prompted if you would like to include a bridging header, say “yes”. Then, delete the .m file that you created, keeping only the bridging-header.h file that was created for you. Add the following line to that file:
#import <Firebase/Firebase.h>
If you still getting errors after you have done the install and adding the #import .
Try this. Open Terminal, then cd to your project and type Pod Install, it will prompt you, says something like your project was edit by another application, if you want to Revert or Keep The XCode Version. Chose Revert.
This fixed my error. Hope will help others.

Compile protobuf with Xcode 5 using CocoaPods

I am trying to add GoogleProtobuf (2.5.0) to my application. From what I have read, the best way is to use CocoaPods. So I went through a tutorial for getting started with CocoaPods. I got all the way to where I ran pod install in my project folder and it created the project workspace. I open the project workspace and try to clean/build and I receive the following error:
I'm a newb at this. Does this mean anything to anyone?
Wow! That's a little picture.
Let me see if I can copy the info in:
Resolving target dependencies
Pods was rejected as an implicit dependency for 'libPods.a' because its architectures 'arm64' didn't contain all required architectures 'armv7'
Write auxiliary files
Ld /Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Products/Debug-iphoneos/Demo.app/Demo normal armv7
cd "/Users/pdl/Development/Application-Demos/iPhone_Demos/Demo"
export IPHONEOS_DEPLOYMENT_TARGET=7.0
export 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/iPhoneOS7.1.sdk -L/Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Products/Debug-iphoneos -L/Library/FlurryAnalytics/Flurry_iPhone_SDK_viPhone_4/Flurry-iOS-4.3.1/Flurry -F/Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Products/Debug-iphoneos -F/Library/OpenCV -F/Users/pdl/Library/Developer/Xcode/DerivedData/QlmMobileDeviceSample-cuzqlikbteeedbeaonfqofugyyql/Build/Products/Release-iphoneos -F/Users/pdl/Library/Developer/Xcode/DerivedData/Dummy-iOS-gumpxuupcpajbvamflgypgfwjshp/Build/Products/Release-iphoneuniversal -filelist /Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Intermediates/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/armv7/Demo.LinkFileList -dead_strip -ObjC -lstdc++ -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.0 -framework Dummy-iOS-1.1.0 -lFlurry_4.3.1 -framework QlmLicenseMobile -lc++ -framework opencv2 -framework AdSupport -lz -lxml2.2 -framework Security -framework SystemConfiguration -framework AssetsLibrary -framework CoreGraphics -framework UIKit -framework Foundation -lPods -Xlinker -dependency_info -Xlinker /Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Intermediates/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/armv7/Demo_dependency_info.dat -o /Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Products/Debug-iphoneos/Demo.app/Demo
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My Podfile contains this:
platform :ios, '7.0'
pod 'GoogleProtobuf', '~> 2.5.0'
When I ran the install, this is the output:
pdl-mbp:Demo pdl$ pod install
Analyzing dependencies
CocoaPods 0.32.1 is available.
Downloading dependencies
Installing GoogleProtobuf (2.5.0)
Generating Pods project
Integrating client project
[!] From now on use `Demo.xcworkspace`.
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
[!] The target `Demo [Debug]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target `Demo [Debug - Release]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target `Demo [Debug - Release - Ad Hoc Distribution]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
pdl-mbp:Demo pdl$
Okay, so I found s lot of information at the two links provided in my last two comments. Especially this answer to the SO Question.
My issue ended up being that my Pods Valid Architectures had to be the same as the Valid Architectures are in my project.
I spent all day on this and the minute I posted the question, I found an answer that helped me figure out my problem.
I hope this helps somebody else! :-)
Check all libraries of projects. If you see anyone missing (red color) , update it specifically. Or you can thoroughly update all libraries with command "pod update" with going into the projects directory. It solved my problem.

XCode with Single View Application (MonoDevelop) Fails Build - Undefined symbols for architecture i386

On the MonoTouch cruise ship wet behind the ears.
Steps I followed the Hellow World tut from the Xamarin site; http://docs.xamarin.com/ios/getting_started/hello_iphone
1) Installed XCode via App Store
2) Installed MonoDevelop fresh from the Xamarin site
Created new project "HelloApple" (Single View Application) in MonoDevelop.
Built the app (command+B).
Opened the generated HelloApple_UIViewController.xib file with XCode Interface Builder
Clicked the Run button.
Received the following error;
Ld
DerivedData/HelloApple.UI/Build/Products/MonoTouch-iphonesimulator/HelloApple.UI.app/HelloApple.UI
normal i386
cd /Users/randerson/Projects/HelloApple/HelloApple.UI/obj/Xcode/1
setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/MonoDevelop.app:/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/iPhoneSimulator6.0.sdk
-L/Users/randerson/Projects/HelloApple/HelloApple.UI/obj/Xcode/1/DerivedData/HelloApple.UI/Build/Products/MonoTouch-iphonesimulator
-F/Users/randerson/Projects/HelloApple/HelloApple.UI/obj/Xcode/1/DerivedData/HelloApple.UI/Build/Products/MonoTouch-iphonesimulator
-filelist /Users/randerson/Projects/HelloApple/HelloApple.UI/obj/Xcode/1/DerivedData/HelloApple.UI/Build/Intermediates/HelloApple.UI.build/MonoTouch-iphonesimulator/HelloApple.UI.build/Objects-normal/i386/HelloApple.UI.LinkFileList
-Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -framework UIKit -framework MapKit -framework Foundation -framework CoreGraphics -o /Users/randerson/Projects/HelloApple/HelloApple.UI/obj/Xcode/1/DerivedData/HelloApple.UI/Build/Products/MonoTouch-iphonesimulator/HelloApple.UI.app/HelloApple.UI
Undefined symbols for architecture i386: "_main", referenced from:
start in crt1.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I have uninstalled XCode and MonoDevelop thinking I did things out of order or something a few times.
Really stumped. I would think the example would work out the box, so I gotta be missing something here.
Several posts on StackOverflow revolve around more complex already built apps, this is adding nothing to the project right out of the box and build.
What am I missing?
You do not build from Xcode itself, you build from MonoDevelop.
The most commonly used part of Xcode is the Interface Builder. You can create your UI using this tool (or using code) and then save it to disk. You then switch back to MonoDevelop to compile verything into a native application.
Note: MonoTouch itself will use parts of Xcode (command line tools) to build the native application. However, for most developers, this is not something you'll be aware of.

CUDA Programming and xCode

I'm completely new to Mac OS X and the main reason why I bought my new MacBook Pro R15 Retina Edition is to start studying CUDA API.
But I can't get my project build.
For example, when I create a new CUDA project, I go in the project properties and make the following changes :
Compiler for C/C++/Objective-C : LLVM GCC 4.2
Other Linker Flag : -lcuda, -lcudart
Header Search Path : /usr/local/cuda/include
Library Search Path : /usr/local/cuda/lib
When I start adding the necessary libraries in my code, everything runs fine. My code gets no typing error.
When I build the project, I get linking errors (paths shortened and message broken up for readability):
Ld /my_test_project/Build/Products/Debug/test normal x86_64 cd /Users/Admin/Documents/test setenv MACOSX_DEPLOYMENT_TARGET 10.7 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-arch x86_64
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
-L/my_test_project/Build/Products/Debug
-L/usr/local/cuda/lib -F/my_test_project/Build/Products/Debug
-filelist /my_test_project/Build/Intermediates/test.build/Debug/test.build/Objects-normal/x86_64/test.LinkFileList
-mmacosx-version-min=10.7
-lcudart
-lcuda
-o /my_test_project/Build/Products/Debug/test
ld: file not found: #rpath/CUDA.framework/Versions/A/CUDA for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
What's weird, is that when I go to the described path, I see the CUDA executable. The file is there!
When I use the cuComplex.h, which uses the library, every single mathematical expression (such as log, cos, sin, etc...) is an "undefined variable". However, the cuComplex.h library has inside it the library.
The driver, the SDK and toolkit are well installed and everything works like a charm. I can get the SDK examples working. But I think I miss a detail to get the whole thing working.
I have the same problem with CUDA 5.0 and Xcode 4.4.1 installed on Mountain Lion. The reason is that libcuda.dylib links CUDA.framework with rpath, which you can inspect with otool.
otool -L /usr/local/cuda/lib/libcuda.dylib
/usr/local/cuda/lib/libcuda.dylib:
/usr/local/cuda/lib/libcuda.dylib (compatibility version 1.1.0, current version 5.0.17)
#rpath/CUDA.framework/Versions/A/CUDA (compatibility version 1.1.0, current version 5.0.17)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
However, Xcode does not seem to recognize CUDA.framework under /Library/Frameworks. The reason is unknown. You have to add it yourself to your project.
In your project property page, click Build Phases -> Link with Libraries. Select CUDA.framework. Add it using "Add Others" if it does not appear in the list. This way you get it linked.
If you are writing Makefiles, you want to add this to fully automate the linking stage:
-F/Library/Frameworks -framework CUDA
As an alternative that worked better for my setup is to change the path at libcuda like this:
sudo install_name_tool -change #rpath/CUDA.framework/Versions/A/CUDA \
/Library/Frameworks/CUDA.framework/CUDA \
/usr/local/cuda/lib/libcuda.dylib
As usual, don't paste a sudo command into your terminal if you don't understand what it does.
I had the same problem compiling the CUDA 6.5 examples on OS X 10.10, with Xcode 6.1. The problem happened in the examples whose Makefiles contained the line:
ALL_LDFLAGS += -Xlinker -framework -Xlinker CUDA
The fix was to tell the linker about /Library/Frameworks, so that the above was replaced with 2 lines:
ALL_LDFLAGS += -Xlinker -F/Library/Frameworks
ALL_LDFLAGS += -Xlinker -framework -Xlinker CUDA
Presumably your question is answered at this point, but this page is almost literally the only google result for "ld: framework not found CUDA" and hopefully this can save others some time.
I had a similar CUDA linking issue with CUDA 8.0 and OSX 10.12 while compiling the sample files. Adding the following to the make files solved the problem.
LDFLAGS += -Xlinker -F/Library/Frameworks

How does Xcode generate the list of framework directories used in the final linking step?

question:
How does Xcode generate the list of framework directories (-F flags in the call to ld) when building a Cocoa app? I keep getting a warning for an old directory which (I think) I have removed from the project settings.
details:
I moved a working Xcode project from one directory to another. I had to fix some broken references to frameworks that now have a different relative path. Everything appears to be working, except for a single warning on the final linker step:
ld: warning: directory '../Some/Path/To/Framework' following -F not found
../Some/Path/To/Framework is definitely part of the old setup. The external frameworks were stored in a directory that was one level up from the project file.
The full text of the call to ld looks something like this (lightly sanitized):
Ld /Volumes/Projects/Builds/Debug/MyApp.app/Contents/MacOS/MyApp normal i386
cd /Volumes/Projects/MyApp
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk
-L/Volumes/Projects/Builds/Debug -F/Volumes/Projects/Builds/Debug
-F../Some/Path/To/Framework
-F/Correct/Path/To/Framework
-filelist /Volumes/Projects/Builds/MyApp.build/Debug/MyApp.build/
Objects-normal/i386/MyApp.LinkFileList
-mmacosx-version-min=10.6
-framework Cocoa
-framework FRAMEWORK
-framework Carbon
-framework Quartz
-o /Volumes/Projects/Builds/Debug/MyApp.app/Contents/MacOS/MyApp
The warning is triggered by that old value for -F. I have searched through all of the build settings, and everything points to /Correct/Path/To/Framework, not ../Some/Path/To/Framework. I have also cleaned the entire build, but to no avail.
Check your build settings. The framework search paths are under Framework Search Paths, or build variable FRAMEWORK_SEARCH_PATHS.

Resources