Please scroll down, update below
I used this tutorial to get my hands dirty on Theos and jailbreak tweak development:
http://iphonedevwiki.net/index.php/Theos/Getting_Started
The question has been posted before ( Theos for armv7 and arm64 ), but it hasn't been answered.
To start, I just want to make a console message appear whenever I unlock the device. I followed the tutorial, but had to install dpkg
via MacPorts to get ldid
up and running.
Here's my code:
Tweak.xm:
%hook SBAwayLockBar
- (void)unlock {
%orig;
NSLog( @"SBAwayLockBar.unlock()" );
}
%end
makefile:
include theos/makefiles/common.mk
TWEAK_NAME = TweakTest01
TweakTest01_FILES = Tweak.xm
TweakTest01_FRAMEWORKS = UIKit
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"
This happens when I try to either make
or make package install
:
/tmp/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for tweak TweakTest01...
Linking tweak TweakTest01...
ld: warning: ignoring file /tmp/theos/lib/libsubstrate.dylib, missing required architecture armv7 in file /tmp/theos/lib/libsubstrate.dylib (2 slices)
Undefined symbols for architecture armv7:
"_MSHookMessageEx", referenced from:
_logosLocalInit() in Tweak.xm.6991e5bc.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [obj/TweakTest01.dylib.ba964c90.unsigned] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [TweakTest01.all.tweak.variables] Error 2
I tried a /usr/bin/xcode-select --install
(as suggested by Failed to build Saurik's ldid utility), but that didn't help at all - mainly because I had all Xcode tools already installed.
Any hints?
UPDATE 2014-03-25
So... it seems like the problem was a space in the path names that I worked in. After renaming the folder from "jailbreak stuff" to "jailbreakstuff", make
ran fine. But since the tweak I wrote didn't really do anything, I started from scratch.
Here's what I did:
- Get a theos installer script from https://gist.github.com/tom-go/3342263
- Edit
install_theos.sh
line 40 to msdeb="mobilesubstrate_0.9.5001_iphoneos-arm.deb"
(newest version when browsing http://apt.saurik.com/debs/ )
I noticed getting ldid
from the given Dropbox URL resulted in an error because the file that had been downloaded only included some HTML ("You will be redirected..."); so I referred back to http://iphonedevwiki.net/index.php/Theos/Getting_Started#For_Mac_OS_X and executed step #4
git clone git://git.saurik.com/ldid.git
cd ldid
git submodule update --init
./make.sh
cp -f ./ldid $THEOS/bin/ldid
Here are my sources:
Tweak.mm/Tweak.mm (symlink)
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <SpringBoard/SpringBoard.h>
%hook SBAwayLockBar
- (void)unlock {
%orig;
%log;
// Call flash on SBScreenFlash => will flash Screen
[[%c(SBScreenFlash) sharedInstance] flash];
}
%end
makefile
export ARCHS = armv7 armv7s arm64
export TARGET = iphone:clang:7.1:7.1
include theos/makefiles/common.mk
TWEAK_NAME = TweakTest01
TweakTest01_FILES = Tweak.xm
TweakTest01_FRAMEWORKS = UIKit Foundation
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"
Here's some console output of make package
(I replaced "mycompanyname" before posting here):
Making all for tweak TweakTest01...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
Linking tweak TweakTest01...
Stripping TweakTest01...
Signing TweakTest01...
Making stage for tweak TweakTest01...
dpkg-deb: Baue Paket »com.mycompanyname.tweaktest01« in »./com.mycompanyname.tweaktest01_0.0.1-9_iphoneos-arm.deb«.
Now I transfer the file with iFunBox and install the package by selecting it in iFile. Installation works fine. I respring my device, unlock it... and no flash, no log output. The only thing the (Xcode - Organizer) log shows is
SpringBoard[4602] <Notice>: MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/TweakTest01.dylib
SpringBoard[4602] <Warning>: MS:Warning: nil class argument for selector unlock
I tried two different libsubstrate.dylib
versions
but the behaviour is the same. What's next? :)