I recently downloaded a fat, iOS static library for the popular C library boost. All my attempts in coaxing Xcode to link it have failed.
Things I have tried:
Adding it to Link Binary With Libraries.
Changing file type to Mach-O Object Code using File Inspector.
Renaming the file to libboost.a and adding -lboost to Other Linker Flags.
I am using Xcode 6.3 with the latest command line tools.
How To Link to an Xcode Project?
In Xcode Build Settings for your project: LIBRARY_SEARCH_PATHS
ofxiOSBoost/libs/boost/lib/ios
(Set this to the directory where the static library is)
In Target under Build Phases for your project
Add to 'Link Binary With Libraries' the boost.a found in the ofxiOSBoost/libs/boost/lib/ios directory.
Renaming to libboost.a may be breaking it. The ofxiOSBoost renames this file as to not conflict with internal OSX libs in the linking process if in path / sys, so it links correctly with the iOS Binary.
If you are still having this problem, please open an issue here:
https://github.com/danoli3/ofxiOSBoost/issues
Related
I'm working on a book project and the project is connected by API . I'm working on the book app which has different libraries imported from the various places.
Recently, i cloned the project from bitbucket in Xcode and tried to run it. The result i got i error as follows:
enter image description here
It shows :
ld: in /Users/ishinfoservices/Documents/vadltaldhambooks/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(FIRAnalyticsConnector_a8eeba373b74508311b8b22b8d3202a6.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/ishinfoservices/Documents/vadltaldhambooks/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Help needed to fix the error, as the project has lots of mixes of old libraries along with .h and .m files, the swift files with wireframes
According to the image I saw that you are trying run the app on the iOS simulator, then you could try to add the arm64 to the Excluded Architectures on the Build Settings section of your project or target, it would be like:
Take in mind that if you use Cocoa Pods is possible that also you should add the arm64 to the Exclude Architectures into the Pods project
After the above, clean, build and run the project on the iOS simulator, is possible that on your physical device you must remove the arm64 from the Exclude Architectures, it could depend on what you use in your project.
On the other hand, you can try the following: Select the project -> Select the target -> Go to the Build Phases -> Expand the Link Binary with libraries and add all pod libraries (remove if they exist in embedded binaries or Remove the old FrameWorks), after that, clean and build the project
There was a similar question, but the answer is no
I use appodeal-ios-sdk-mobile-adapter. I want to add them to your projects without copying each.
in the Link Binary with Libraries framework added
But I get:
ld: framework not found GoogleMobileAds
clang: error: linker command failed with exit code 1 (use -v to see invocation)
In order to add the framework to your project without copying proeta folder, drag the folder using the (Create groups), and add the path where you have a set framework -> "Build Setting -> Library Search Paths and Framework Search Paths
/Users/username/Framework/AppodealAdapters/**
Well you can open the system directory where all the frameworks are present
that is in the system folder where all the frameworks are installed
Hit Shift+Command+G
and use the below address
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks
Once in the directory copy the framework which you want to use. Take care to not mess around other frameworks in this directory.
Once the frameworks are copied into this directory you can add them to your project just like you include a regular system defined framework.
Try it out it works for me. I am using XCode 7.3.
I'm trying to build DLIB for an iOS project. Running the cmake results in a libdlib.a and a load of .o files.
When I add the library to an Xcode project I get warning that the library hasn't been built for arm64.
My question is two-part:
How can I build DLIB for iOS (I tried cmake **path_to_source** -DCMAKE_OSX_ARCHITECTURE="arm64" but it caused loads of errors e.g. unknown type name '__uint32_t'; did you mean '__uint128_t')?
What is the purpose of all the .o files that get built when you run cmake? Do I need to include them in an Xcode project?
I finally figured out how to do this:
Requirements
X11 (on a mac you can just open the X11 app and if X11 isn't installed it'll take you to the download).
Xcode
cmake (you can use home-brew for that)
Steps
In terminal make the lib-xx.xx/examples your root
Run:
mkdir build
cd build
cmake -G Xcode ..
cmake --build . --config Release
This will create a folder called dlib_build in which you can find an Xcode project that compiles the library. In the build settings of that Xcode project you can set the build architecture and SDK for any Xcode supported OS you like!
EDIT:
You have to include a lot of custom compiler flags and 3rd party libraries to get dlib to work in a project. Check out the examples.xcproject build settings.
To compliment RASS's answer, I am attaching screenshots showing how to change this to and from an iOS and OSX lib
After opening the project,
Select the project file from the project navigator
Select the dlib target all the way down the bottom
Select 'Build Settings'
Expand 'Base SDK' drop down
Select either iOS or macOS (OSX)
I hope this helps some people out! gl
Rob Sanders and mylogon already show how to build dlib for ios, here is how to use it:
add libdlib.a to project, and add path to library search paths
add all source to include directory(do not add to project), and add path to header search paths.
add accelerate framework, which contains blas symbols.
add preprocessor macros, from building settings, "custom compiler flag"/"other c flags". these macros make sure the header files match the lib.
-DDLIB_JPEG_SUPPORT
-DDLIB_NO_GUI_SUPPORT
-DNDEBUG
-DDLIB_USE_BLAS
-DDLIB_USE_LAPACK
I know there are lot of questions and answers are available like this but since 2 days I tried to figure out this issue and not got any success.
I have added the below listed frameworks in my projects,
libSqlite3.dylib
AddressBook.framework
AssetsLibrary.framework
AVFoundation.framework
CoreMotion.framework
MediaPlayer.framework
but not getting any success
I think you've copied the Frameworks into your project, rather than just linking to them, so they only contain the library compiled for device. Xcode will normally locate the Simulator version of the framework for you.
Delete any of the .framework folders in your project and Finder, then follow Step 6 of this tutorial with the frameworks you listed in your original post: http://quickblox.com/developers/IOS-how-to-connect-Quickblox-framework#Framework
This library AssetsLibrary.framework in Step 3, is not included in your project, that's why you are getting this error.
Try these:
You need to add the AssetsLibrary framework to the “Link Binary With Libraries” build phase of your target.
Try cleaning your project using Command+Shift+K and adding the required frameworks again. Hope it will start working
Copy files into your project but forgot to check the target to add the files to. To resolve: Open the Build Phases for the correct target, expand Compile Sources and add the missing .m files.
Another cause, may be:
You include a static library that is built for another architecture like i386, the simulator on your host machine. To resolve:
If you have multiple library files from your libraries vendor to include in the project you need to include the one for the simulator (i386) and the one for the device (armv7 for example).
Missing library or missing .m file
Check and add:
TargetSettings -> Build Phases -> Compile Sources -> add your .m class -> Build and Run
I am using third party library files which contains .h, static library (.a), .fin, .key files. The readme says:
1) .fin, .key & .a files should be present on same location.
2) Add flags "-finalize -prefinalized-library library_name.a" in "Other Linker Flags" option.
3) Click Yes on "Write Link Map File" option.
I have created a new group/folder in the project from the "Xcode's Project Navigator" window & placed .a, .key, .fin files & followed the same steps as mentioned & when I was trying to compile the application, .fin files were not found during linking.
When I removed the "Other Linker Flags option" the application was getting compiled. But the readme says "Other Linker Flags option" is mandatory for using the library.
Apart from this. When I copied .a, .key, .fin files without creating any folder then the application compiles successfully. But if these files are placed inside a folder in the application then application fails to compile.
Can anyone please help me on this. How & where to provide the path to .key, .fin files so that the application gets compiled using the finalizer.
Xcode 6.1.1
iOS SDK version 8.1
OS X - Yosemite 10.10.2
I had the same issue. I resolved by adding the flag -Wfin-data-files {PATH}. The path is where Xcode can find the .fin files