架构armv7错误的未定义符号

时间:2014-06-01 09:26:30

标签: ios makefile

我在github上找到了Unlock7示例项目,现在我试图在显示音乐控制器时将模糊(stackblur)添加到后台,但是当我编译它时我有这个错误:

AXel-4:/var/mobile/unlock7 root# make package install
/var/mobile/unlock7/theos/makefiles/targets/Darwin-arm/iphone.mk:43: Targeting iOS 4.0 and higher is not supported with iphone-gcc. Forcing clang.
/var/mobile/unlock7/theos/makefiles/targets/Darwin-arm/iphone.mk:53: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
/var/mobile/unlock7/theos/makefiles/master/bundle.mk:17: warning: overriding commands for target `Unlock7'
/var/mobile/unlock7/theos/makefiles/master/tweak.mk:20: warning: ignoring old commands for target `Unlock7'
Making all for tweak Unlock7...
make[2]: Nothing to be done for `internal-library-compile'.
Making all for bundle Unlock7...
 Copying resource directories into the bundle wrapper...
 Linking bundle Unlock7...
Undefined symbols for architecture armv7:
  "_MSHookMessageEx", referenced from:
      _logosLocalInit() in Tweak.xm.a06cfd38.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/Unlock7.bundle/Unlock7.64873355.unsigned] Error 1
make[1]: *** [internal-bundle-all_] Error 2
make: *** [Unlock7.all.bundle.variables] Error 2

这是makefile:

export GO_EASY_ON_ME = 1
include theos/makefiles/common.mk

TWEAK_NAME = Unlock7
BUNDLE_NAME = Unlock7
com.bushe.unlock7_INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries
Unlock7_FILES = Tweak.xm UIImage+StackBlur.m
Unlock7_FRAMEWORKS = UIKit CoreGraphics

include $(THEOS_MAKE_PATH)/tweak.mk
include $(THEOS)/makefiles/bundle.mk

after-install::
    install.exec "killall -9 SpringBoard"

以下是代码:

#import <UIKit/UIKit.h>
#import <UIImage+StackBlur.h>
#import <logos/logos.h>

#define kBundlePath @"/Library/MobileSubstrate/DynamicLibraries/Unlock7.bundle"

@interface NowPlayingArtPluginController : NSObject
- (id)view;
@end

@interface SBAwayView : UIView
-(id)topBar;
-(id)bottomBar;
-(id)_defaultDesktopImage;
@end

@interface SBAwayDateView : UIView
-(void)setPositon;
@end

@interface SBDeviceLockViewWithKeypad : UIView
@end

@interface SBAwayController : NSObject
-(id)sharedAwayController;
@end



@interface TPLCDTextView : UIView {}
-(void)setShadowColor:(UIColor *)fp8;
-(void)setText:(id)fp8;
-(void)setTextColor:(UIColor *)fp8; 
-(void)setFont:(UIFont*)font;
- (void)setLCDTextFont:(id)arg1;
@end

CGPoint _priorPoint;

%hook SBAwayView
-(void)finishedAnimatingIn{
    %orig;
    UIView *&_backgroundView(MSHookIvar<UIView *>(self, "_backgroundView"));
    [_backgroundView setUserInteractionEnabled:YES]; //Allows backbround to use gesture

    [[self dateHeaderView] setPositon]; //reset the position of the date view to be below the larger clock

    UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(newUnlockStyleMover:)];
    [panRecognizer setMinimumNumberOfTouches:1];
    [panRecognizer setMaximumNumberOfTouches:1];
    //[_backgroundView addGestureRecognizer:panRecognizer] This can be used but is incompatible with LockHTML 
    [[self.subviews objectAtIndex:0] addGestureRecognizer:panRecognizer]; //Add gesture to the background view or LockHTML's z order organizer
    [panRecognizer release];

    panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(newUnlockStyleMover:)];
    [panRecognizer setMinimumNumberOfTouches:1];
    [panRecognizer setMaximumNumberOfTouches:1];
    [[self bottomBar] addGestureRecognizer:panRecognizer]; //Lockbar
    [panRecognizer release];

    panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(newUnlockStyleMover:)];
    [panRecognizer setMinimumNumberOfTouches:1];
    [panRecognizer setMaximumNumberOfTouches:1];
    [[self topBar] addGestureRecognizer:panRecognizer]; //Clock and Date View's
    [panRecognizer release];

    [self _setTopBarImage:[self getUIImageForControls] shadowColor:[UIColor clearColor]];

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter]
       addObserver:self selector:@selector(orientationChanged:)
       name:UIDeviceOrientationDidChangeNotification
       object:[UIDevice currentDevice]];
}

%new
- (void) orientationChanged:(NSNotification *)note
{
   [[self dateHeaderView] setPositon];
}

%new
- (void)newUnlockStyleMover:(UIPanGestureRecognizer *)sender {
        UIView *&_lockBar(MSHookIvar<UIView *>(self, "_lockBar"));
        float width = ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown) ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.height;
        CGPoint point = [sender locationInView:sender.view.superview];
        if (sender.state == UIGestureRecognizerStateChanged){
            UIImage *_defaultDesktopImage = [self _defaultDesktopImage];
            for(UIView *obj in [self subviews]){    
                if(obj != [self.subviews objectAtIndex:0]){
                    CGPoint center = obj.center;
                    if(center.x < width/2)
                        center.x += (point.x - _priorPoint.x)/3;
                    else
                        center.x += point.x - _priorPoint.x;

                    obj.center = center;
                }
            }
        }
        else if (sender.state == UIGestureRecognizerStateEnded){
            if(_lockBar.center.x < width){

                for(UIView *obj in [self subviews]){    
                    if(obj != [self.subviews objectAtIndex:0]){
                        CGPoint center = obj.center;
                        center.x = width/2;
                        [UIView animateWithDuration:0.6
                             animations:^{ 
                                obj.center = center;
                             } 
                             completion:^(BOOL finished){
                             }];
                    }
                }
            }
            else{
                for(UIView *obj in [self subviews]){    
                    if(obj != [self.subviews objectAtIndex:0]){
                        CGPoint center = obj.center;
                        center.x = width+(width/2);
                        [UIView animateWithDuration:0.2
                             animations:^{ 
                                obj.center = center;
                             } 
                             completion:^(BOOL finished){
                             }];
                    }
                }
                if([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"/Library/MobileSubstrate/DynamicLibraries/AndroidLock.dylib"]] == TRUE && [[[NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.zmaster.AndroidLock.plist"] objectForKey:@"Enable"] boolValue] == TRUE){
                    [[%c(SBAwayController) sharedAwayController] unlockWithSound:TRUE bypassPinLock:[[%c(SBDeviceLockController) sharedController] isPasswordProtected]];
                    CGPoint center = _lockBar.center;
                    center.x = width/2;
                    _lockBar.center = center;
                }
                else{
                    //[[%c(SBAwayController) sharedAwayController] _sendToDeviceLockOwnerSetShowingDeviceLock:TRUE animated:FALSE];
                    [[[[%c(SBAwayController) sharedAwayController] awayView] bottomBar] setHidden:YES];

                    [[[[%c(SBAwayController) sharedAwayController] awayView] bottomBar] unlock];
                }
            }
        }
        _priorPoint = point; 

}

-(id)_topBarLCDImage{
    return [self _topBarLCDControlsImage];
}

- (id)_topBarLCDControlsImage{
    return [self getUIImageForControls];
}

%new
-(UIImage*)getUIImageForControls{
    UIGraphicsBeginImageContextWithOptions(CGSizeMake([[UIScreen mainScreen] bounds].size.width, 133), NO, 0.0);
    NSBundle *bundle = [[[NSBundle alloc] initWithPath:kBundlePath] autorelease];
    NSString *imagePath = [bundle pathForResource:@"blurbackground" ofType:@"png"];
    UIImage *blank = UIGraphicsGetImageFromCurrentImageContext();
    UIImage *myImage = [UIImage imageWithContentsOfFile:imagePath];
    UIImage *myIma=[[UIImage imageNamed:@"blurbackground.png"] normalized];
    UIImage *blurIma=[myIma stackBlur:29.8];
    UIGraphicsEndImageContext();
    return blank;
}

- (void)_setPluginController:(id)arg1{ 
    %orig(arg1);
    if ([arg1 isMemberOfClass:NSClassFromString(@"NowPlayingArtPluginController")]){
        id pluginController = [self currentAwayPluginController];
        if ([pluginController isMemberOfClass:NSClassFromString(@"NowPlayingArtPluginController")]){
        UIView *pluginView = [(NowPlayingArtPluginController *)pluginController view];
                UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(newUnlockStyleMover:)];
                [panRecognizer setMinimumNumberOfTouches:1];
                [panRecognizer setMaximumNumberOfTouches:1];
                //[panRecognizer setDelegate:self];
                [pluginView addGestureRecognizer:panRecognizer];
                [panRecognizer release];
            for(UIView *obj in [[(NowPlayingArtPluginController *)pluginController view] subviews]){        
                    if([obj isKindOfClass:[UIImageView class]]){
                        if([[UIScreen mainScreen] bounds].size.width == 320)
                            obj.frame = CGRectMake(0, 0, 256, 256);
                    }
                    if([obj isKindOfClass:NSClassFromString(@"NowPlayingReflectionView")]){
                        [obj removeFromSuperview];
                    }
            }
            if([[UIScreen mainScreen] bounds].size.width == 320)
                pluginView.frame = CGRectMake(32,160,256,256);
        }
    }
}

%end

%hook SBAwayController
- (void)undimScreen:(BOOL)arg1{
    //Slide Lockscreen back to default position after the screen sleeps
    float width = ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown) ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.height;
    [[[[%c(SBAwayController) sharedAwayController] awayView] bottomBar] setHidden:NO];
    for(UIView *obj in [[self awayView] subviews]){ 
        if(obj != [[[self awayView] subviews] objectAtIndex:0]){
            CGPoint center = obj.center;
            center.x = width/2;      
            [UIView animateWithDuration:0.6
                 animations:^{ 
                    obj.center = center;
                 } 
                 completion:^(BOOL finished){
                 }];
        }
    }
    %orig;
}
%end

%hook SBAwayDateView
-(void)setFrame:(CGRect)frame{
    %orig;

    TPLCDTextView *timeLabel = MSHookIvar<TPLCDTextView *>(self, "_timeLabel");
    [timeLabel setLCDTextFont:[[timeLabel font] fontWithSize:96]];
    [timeLabel setFrame:CGRectMake(timeLabel.frame.origin.x,timeLabel.frame.origin.y,timeLabel.frame.size.width,timeLabel.frame.size.height+60)];

    [self setPositon];  
}

%new
-(void)setPositon{
    TPLCDTextView *dateLabel = MSHookIvar<TPLCDTextView *>(self, "_dateAndTetheringLabel");
    [dateLabel setFrame:CGRectMake(dateLabel.frame.origin.x,100,dateLabel.frame.size.width,dateLabel.frame.size.height)];
}

- (void)setVisible:(BOOL)arg1{
    %orig;
    [self setPositon]; //attempt to keep date view in proper location
}

- (void)resizeAndPositionNowPlayingLabels{
    UILabel *_nowPlayingTitleLabel = MSHookIvar<UILabel *>(self, "_nowPlayingTitleLabel");
    UILabel *_nowPlayingArtistLabel = MSHookIvar<UILabel *>(self, "_nowPlayingArtistLabel");
    UILabel *_nowPlayingAlbumLabel = MSHookIvar<UILabel *>(self, "_nowPlayingAlbumLabel");
    [_nowPlayingTitleLabel setFrame:CGRectMake(0,95,[[UIScreen mainScreen] bounds].size.width,20)];
    [_nowPlayingArtistLabel setFrame:CGRectMake(0,109,[[UIScreen mainScreen] bounds].size.width,20)];
    [_nowPlayingAlbumLabel setFrame:CGRectMake(0,122,[[UIScreen mainScreen] bounds].size.width,20)];
}
%end

%hook TPLCDTextView
%new
-(UIFont *)font{
    UIFont *font = MSHookIvar<UIFont *>(self, "_font");
    return font;
}
%end

%hook SBAwayLockBar
-(id)wellImageName{
    return nil;
}

- (BOOL)usesBackgroundImage {
    return NO;
 }

- (id)initWithFrame:(struct CGRect)frame knobColor:(int)color{
    UIView *lockBar = %orig;    
    UIImageView *&_shadowView(MSHookIvar<UIImageView *>(self, "_shadowView"));
    [_shadowView removeFromSuperview];
    return lockBar;
}

- (id)initWithFrame:(struct CGRect)frame knobImage:(id)image{
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(60, 47), NO, 0.0);
    UIImage *blank = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    UIView *lockBar = %orig(frame,blank); 
    UIImageView *&_shadowView(MSHookIvar<UIImageView *>(self, "_shadowView"));
    [_shadowView removeFromSuperview];
    return lockBar;
}
 %end

%hook SBDeviceLockView
- (void)notifyDelegateThatCancelButtonWasPressed{
    //Slide lockscreen back to default position after cancel button is pressed in lockscreen
    float width = ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown) ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.height;
    for(UIView *obj in [[[%c(SBAwayController) sharedAwayController] awayView] subviews]){  
        if(obj != [[[[%c(SBAwayController) sharedAwayController] awayView] subviews] objectAtIndex:0]){
            CGPoint center = obj.center;
            center.x = width/2;          
            [UIView animateWithDuration:0.6
                 animations:^{ 
                    obj.center = center;
                 } 
                 completion:^(BOOL finished){
                 }];
        }
        [[[[%c(SBAwayController) sharedAwayController] awayView] bottomBar] setHidden:NO];
    }
    %orig;  
}
%end

%hook SBAwayMediaControlsView 
- (void)layoutSubviews{
    %orig;
    for(UIView *obj in [self subviews]){
        if ([obj isMemberOfClass:NSClassFromString(@"UIView")]){ //This is the MediaContols Thin Line
            [obj removeFromSuperview];
        }
    }
}
%end

%hook TPLCDBar
//Everything here make sure there is no thin black/grey line below the view
- (id)initWithDefaultSize{
    id topBar = %orig;
    UIImageView *&_shadowView(MSHookIvar<UIImageView *>(self, "_shadowView"));
    [_shadowView removeFromSuperview];
    return topBar;
}

- (id)initWithDefaultSizeForOrientation:(int)arg1{
    id topBar = %orig;
    UIImageView *&_shadowView(MSHookIvar<UIImageView *>(self, "_shadowView"));
    [_shadowView removeFromSuperview];
    return topBar;
}

-(id)initWithFrame:(CGRect)frame{
    id topBar = %orig;
    UIImageView *&_shadowView(MSHookIvar<UIImageView *>(self, "_shadowView"));
    [_shadowView removeFromSuperview];
    return topBar;
}

%end

感谢任何帮助。 谢谢! (对不起英语)

1 个答案:

答案 0 :(得分:2)

这是因为TWEAK_NAME和BUNDLE_NAME拥有相同的值。 Makefile应该是这样的:

export GO_EASY_ON_ME = 1
include theos/makefiles/common.mk

TWEAK_NAME = Unlock7
$(TWEAK_NAME)_INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries
$(TWEAK_NAME)_FILES = Tweak.xm UIImage+StackBlur.m
$(TWEAK_NAME)_FRAMEWORKS = UIKit CoreGraphics
include $(THEOS_MAKE_PATH)/tweak.mk

BUNDLE_NAME = Unlock7img
$(BUNDLE_NAME)_INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries
include $(THEOS)/makefiles/bundle.mk

after-install::
    install.exec "killall -9 SpringBoard"

BUNDLE_NAME现在有一个与TWEAK_NAME不同的后缀。您可以使用任何其他名称进行捆绑。

根据新的包名称重新定义源包中的路径:

#define kBundlePath @"/Library/MobileSubstrate/DynamicLibraries/Unlock7img.bundle"