I am making a iPhone App. I am trying to use log4cpp libraray for logging in my project. I can statically compile this library on MAC OS using Makefile. When I try to use this lib woth my Iphone project, I geta linker error stating I need to compile this library against armv7 architecture. I don't know how to modify the makefile to compile against armv7 architecture. So I created a XCode project and add all the source files and tried to create a static libg of log4cpp against armv7 architecture, but I am getting too many compilation errors.
Please help on this.
Thanks.
Related
I've gone through the various solutions of compiling libical v1.0 for armv7, however the latest libical library available on github seems to have moved to cmake:
https://github.com/libical/libical
Can someone please guide me as to what I should be doing to get this to compile for iOS and Mac (one fat static library)? I've been able to compile it for the Mac but don't know how to do the same for armv7 and arm64. Thanks!
I tried everything from ios-toolchain for cmake to writing a build script myself. Nothing worked. In the end it turned out to be simple. Simply run cmake and compile libical on a 64-bit Mac. Then take all the produced code from under the "src" directory and add that straight to your iOS project. Then, replace #include with #include "config.h" globally and disable ICU support. Add a preprocessor macro to your build settings to include the generated config.h
Not sure it is related to Xcode 6.1.1 or Cocoapods 0.35.0.
I have generated new static iOS library with Xcode 6.1.1.
SUCCESS (without cocoapods)
Generate simulator and Device library
Lipo to both and generate FAT MyLib.a static final lib
Create new View Application project. (I haven't changed any default setting. e.g. Base SDK, Valid Architecture.)
Add MyLib.a and necessary header files to application project manually.
Build the app project and IT WORKS FINE !! NO ERROR NO WARNING.
ERROR
Upload same MyLib.a & headers (generated above) to HTTP direct download server(kind of artifact server).
Generate specs & podfile.
Remove all dependency (lib and header) from app project which i have done manually earlier.
Add pod file and local specs
"Pod install" command pull out MyLib.a and header properly in /Pods folder.
But while building the app project gives me
Ld Build/Products/Debug-iphonesimulator/LibTest.app/LibTest normal x86_64
cd /Users/admin/Cocoapods/Project/Library/TestProject/LibTest
export IPHONEOS_DEPLOYMENT_TARGET=8.1
ld: library not found for -lMyLib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
When i fire "lipo" command on MyLib.a
Architectures in the fat file: /Users/admin/Cocoapods/Project/Library/Libs/Final/MyLib.a are: armv7 armv7s i386 x86_64 arm64
Its not really architecture issue otherwise it should get failed in my first attempt which doesn't have cocoapods. Cocoapods does some build configuration changes and that creates this issue.
Help me to resolve this issue.
After spending 2 days to figure out the exact issue, i found very silly fix. Its basically issue with static library naming convention issue.
If you have static library in artifact/media http server and wanted to integrate with Cococapods, make sure library name should be lib(your name).a along with headers.
In my case i have kept MyLib and it got dowloaded currently while "pod install" but during app building it was failing.
After renaming to libMyLib.a, every thing works for me. :)
Very easy to apply yet difficult to find such solution]
Not sure whether cocoapods has documented this in there any guide or not.
As requested by Apple in the next February (February 2014), every app submitted to AppStore needs to support Arm64 architecture. In my project, I used many static libraries (*.a) and I can check if these libs support arm64 arch. However, I don't know if some frameworks such as Facebook.framework supports this new arch. How can I check it?
Each framework is really just a directory - not even like a package directory, but a plain directory you can browse directly into with Finder. Go into the .framework folder, at the top level you'll find a file with the same name as the framework (for older frameworks that file may be located under a folder called Versions/A within the .framework folder).
That file is really a static library (.a) file, just without the extension. Check it as you would any static library (using file or lipo -info) and you'll see what binaries the file contains.
You'll also know through XCode though. If you switch your project to support arm64 and the libraries you are linking to do not have arm64 support, XCode will not finish linking when compiling for a device.
Check below command in Terminal
lipo -info yourlib.a
Output like :
Architectures in the fat file: yourlib.a are: i386 x86_64 armv7 arm64
In case Framework.framework
Go to inside framework like below
cd /Your_Path_/CocoaLumberjack.framework
then run command
lipo -info CocoaLumberjack
I created my own iOS framework by following this tutorial, https://code.google.com/p/ios-static-framework/, which uses a static library template and aggregate target with a custom run script to create a framework.
At first it works fine. After including another library in the framework project creates the error when archive or build for device. I think the problem is with some wrong settings for that library. But I just don't know what to try. I have tried setting some sensible Other Linker Flags from https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/ld.1.html , but no luck. Can anyone help please ;(
What steps will reproduce the problem?
Follow the tutorial, but change the Aggregate script architecture from armv6 armv7 to armv7 armv7s. Here is the part of the aggregate target script I changed. Everything else is the same.
if [[ "$SF_SDK_PLATFORM" = "iphoneos" ]]
then
SF_OTHER_PLATFORM=iphonesimulator
SF_ARCHS=i386
else
SF_OTHER_PLATFORM=iphoneos
SF_ARCHS="armv7 armv7s"
fi
Add an external library to the project, here I use libBlocksKit.a.
Build the framework, success.
In another child project. Include my built framework.
Add -ObjC in the app Target > Build Settings > Other Linker Flags
Archive and get error. Building for device (iPhone5) gives error too. But building for simulator seems to work.
What is the error?
This error, basically "ld: warning: directory not found for option ... ld: lto: could not merge in ... symbol multiply defined!".
ld: warning: directory not found for option '-L/Users/hlung/Dropbox/- Notes/stackoverflow/RealFrameworkApp/RealFrameworkApp/External/BlocksKit'
ld: lto: could not merge in /Users/hlung/Library/Developer/Xcode/DerivedData/RealFrameworkTest-evagqzwzyyolhjenkkjbvzibxppf/Build/Products/Debug-iphonesimulator/RealFrameworkTest.framework/RealFrameworkTest(NSObject+BlockObservation.o) because 'Linking globals named 'OBJC_CLASS_$_BKObserver': symbol multiply defined!', using libLTO version 'LLVM version 3.2svn, from Apple Clang 4.2 (build 425.0.28)' for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I archive my child project with only one architecture (like armv7), it works. It shows this error with armv7 armv7s architectures ( $(ARCHS_STANDARD_32_BIT) ).
What version of the product are you using? On what operating system?
OS X 10.8.5, XCode 4.6.3
== Update 1 ==
Posted an issue at the tutorial's code.google.com page Update: 2 weeks no answer.
I found a set of useful suggestions from this answer. Update: Doesn't work
I have created a project so you can run and see for yourself here
Linking against a static library from within a framework can create some interesting challenges... It sounds like you may be linking to BlocksKit from both your framework and your application projects.
You should link in only one of those places. Try removing libBlocksKit.a from the Link Libraries build phase of your framework, but leave it in the other project.
You can do like this:
Click on your project (targets)
Click on Build Settings
Under Library Search Paths, delete the paths
I hope it can help you.
I am using Xcode 4.3.2, target architecture is armv7 and base sdk is iOS 5.1.
I try to use ZipArchive on some test project, and it works fine with the build settings set to "According to File Type". But when I change the settings to "Compile Sources as Objective-C++", which is the requirement for my main project, then compiler throws a lot of errors, (parse and semantic issues).
My problem then, is to compile .c files in this Objective-C++ project. So I saw this question, [here] and changed the type of files from ".c" to ".c.objc". Now, I am getting linker errors. The usual ones found when people import ZipArchive into their project. Like this ->
Undefined symbols for architecture i386: "_zipOpen", referenced from: -[ZipArchive CreateZipFile2:] in ZipArchive.o
And I think the solutions given on those linker error questions are for project sources that are compiled as "file-type", not for Objective-C++. Any idea what could be done?