As is know to us all, objc's runtime is open source and can be downloaded from: http://www.opensource.apple.com/tarballs/objc4/
After I download the tarball an extract it. I open objc.xcodeproj using xcode. However, when I build it, there are many erros, such as, can not find some headers. I googled all the missing headers, download them, put them in /tmp/objc.dst/usr/include. But without luck, still errors.
I searched the internet, but I can find few documents or instructions about:
how to compile apple's objc runtime from source code?
After compile it , I should get libobjc.A.dylib, how to use it (as a replace of the system's libobjc.A.dylib) ?
I really appreciate any help you can provide.
Compile with no error under 10.10.2(14C1514), Xcode 6.2 (6C131e).
You need OSX 10.8 SDK, which you can get from early Xcode install dmg or this repository https://github.com/phracker/MacOSX-SDKs (If you download sdk from this repo, you may need to fix the soft links using this script http://blog.jeswang.org/blog/2014/10/26/fix-slash-soft-slash-links-slash-in-slash-an-slash-archived-slash-file/, you may need to run the script two times for the recursion of references)
More the 10.8 sdk to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
Clone this repository https://github.com/Jeswang/objc4-532.2
Compile and Run the debug-objc scheme
You can set any breakpoint in the source and debug the whole runtime.
Related
I searched through existing Stackoverflow questions related to this problem but didn't find any help to solve it.
So here's the problem:
I am trying to integrate .framework file into the project but it's giving me an error saying that module compiles with 4.0.3 can't be imported by swift 5.0 compiler.
I wanted to know how to compile that.framework file? so that it will become compilable to swift 5.0
Please help if you come across such a problem.
Note: .framework file is created by a third-party developer
If the framework you're trying to integrate is binary only, then your best option is to check with the 3rd party developer regarding their support for Swift 5.0.
In case there are sources available, you can try checking if there is any work being done in their repository (usually a separate branch), or you can try forking the sources yourself.
Note that with the source option, you'll have access to possibly unstable and untested code, and depending on the experience I'd be very careful in this case.
I am trying to use codeblocks to compile the code available here
The thing is every time I try to build and run, I run into the following error:
|/.../head_pose_estimation/opencv2/core/core.hpp|48|fatal error: opencv2/core.hpp: No such file or directory
Does anyone know how I can fix this? Thank you!
You do not have the pre-built (compiled) version of OpenCV, what you currently have are the source files. If you want to do something special with OpenCV (Target/GPU SUpport etc) then you will need to build the framework using an appropriate guide.
If however you simply want to use OpenCV in the most common way then download the pre-built libraries from the OpenCV.org website.
NOTE:
If you are using OpenCV with MinGW compiler, I do not remember if the pre-built is actually pre-built for MinGW. (I dont think they do) In this case you will HAVE to built the libraries. You can find a guide here
Is there a way to have Xcode tell me when I'm calling a method that isn't available in the SDK of the minimum supported target?
For example, the method [NSURLConnection sendAsynchronousRequest:queue:completionHandler:]. This method is available on iOS5 and up. But my application's minimum target is iOS4.
If I use that method (sendAsync), I'd like Xcode to tell me that that method isn't available for the minimum target I'm trying to support.
I've tried putting __IPHONE_OS_VERSION_MAX_ALLOWED=40000 in the preprocessor settings, but that just triggers a bunch of Apple SDK errors that aren't helpful. (Probably because my active SDK is iOS5.1)
Is the only solution to get ahold of old SDKs and install them in Xcode?
Are there any easier solutions?
There is unfortunately no standard way of doing this. By setting the target OS to a lower number than the base SDK, Xcode will weakly link the libraries and frameworks. When doing that Xcode will not warn you for using methods that may not be available on the target OS.
You could temporarily set the base SDK lower, but that might not always work. Since you want to ignore most of the errors and warnings produced (because they are only called conditionally in your code path), and many warnings and errors are dependant on other error that you may need to resolve before the compiler will give any meaningful output.
I do not think there exist any static analysis tools for this, neither from Apple nor third party.
After doing some research, reading the Apple Doc about it, and trying a number of things. The solution is downloading an old Xcode DMG from Apple, grab the .pkg file for the same SDK as your deployment target and install it in your version of Xcode. Here's how:
Download older Xcode.dmg from Apple
Open the DMG
In Terminal, go into packages: "cd /Volumes/[DMG]/Packages; open ."
Find the SDK you want, something like iPhoneSDK_4.0.pkg
Install that package, but change the install directory to /Applications/Xcode/Contents/Developer
Restart Xcode if it was open.
Now that you have the same SDK as your deployment target, set your BaseSDK to the same. When you build you'll get warnings about missing methods. Your project may or may not successfully build with an older BaseSDK in a new version of Xcode, but that doesn't matter - you've just found the method calls you need to wrap in a feature check with respondsToSelector:.
As of Xcode 7.3, the compiler can now generate these warnings for you. All you need to do is set the -Wpartial-availability warning flag in the Build Settings, as described in this answer.
I'm using iOS 6.1 and XCode 4.6
I have a problem, OpenCV needs to be compiled with libc++ (LLVM C++ 11), while Tesseract 3.02.03 needs to be compiled with "default compiler".
How can I overcome this problem. at this point I can compile and link only If I comment out OpenCV code or comment out OCR code. cannot make them both work together.
Any ideas??
I am by no means an expert with C++ but I had the same problem and by some trial and error and lots of internet searching I think I managed to solve it.
As I understand it, the problem is that opencv and tesseract are built with different standard libraries. The latest opencv is built with libc++ while tesseract is built with stdlibc++
The solution is to rebuild one of them so they both use the same standard library. I decided to recompile tesseract and followed the instructions found here which references a build script that is used to build the library.
I modified this script (again, by trial an error, not really sure this is the best way) to used the clang++ compiler (CXX="/usr/bin/clang++") and use libc++ (CXXFLAGS="$CFLAGS -stdlib=libc++") and it compiles (albiet with some warnings). You may also need to copy some headers as the script doesn't seem to copy them all.
Then just use this library instead of the downloaded one in your iOS project (remember to change back to libc++ in build settings) and everything will compile and link just fine.
So far it seems to work properly in runtime.
I've to de-compile iOS .app file and then insert my code and then re-package back to ipa file.
Can you please suggest some pointers how to do it?
You simply can't do this.
Once the app is compiled down to machine code, the best you can get from reverse engineering it is just assembly and unless you are willing to write your fix in assembly I don't see how you are going to integrate your code.
Also the code signing will be corrupted by doing this as well.
Unless you have valid provisioning set up on your machine you can't repackage the app with the original code signing.
Try to get the source or similar source to write an app with the functionality you need.
Yes you can if the device is jailbroken and the signature check is removed.
Here there is one case:
Is it possible to edit and recompile an iOS Binary?
In the reply they suggest that the modifications have been taken directly on the binary (by replacing some functions with other of the same size). However, I believe that you can do more advanced things.
You could, for instance, include the assembly of the application into your own objective-c code using XCode:
Compiling Assembly (.S) file alongside iPhone project
Or directly compile the modified assembly into the binary (mach-o) and then repackage.
How to create an iPhone mach-o file?
Maybe GNU ARM or LLVM toolchain can assit you on doing this: Compile, Assemble and Disassemble Using the LLVM Tool Chain
There are just some approaches which I'm currently investigating on. It is not straightforward, so any other know-how on the topic will be very appreciated.