菜鸟教程小白 发表于 2022-12-12 10:08:46

ios - 架构 armv7 错误的 undefined symbol


                                            <p><p>我在 github 上找到了 Unlock7 示例项目,现在我尝试在显示音乐 Controller 时将模糊(stackblur)添加到背景中,但在编译时出现此错误:</p>

<pre><code>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&#39;
/var/mobile/unlock7/theos/makefiles/master/tweak.mk:20: warning: ignoring old commands for target `Unlock7&#39;
Making all for tweak Unlock7...
make: Nothing to be done for `internal-library-compile&#39;.
Making all for bundle Unlock7...
Copying resource directories into the bundle wrapper...
Linking bundle Unlock7...
Undefined symbols for architecture armv7:
&#34;_MSHookMessageEx&#34;, 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: *** Error 1
make: *** Error 2
make: *** Error 2
</code></pre>

<p>这是生成文件:</p>

<pre><code>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 &#34;killall -9 SpringBoard&#34;
</code></pre>

<p>这里是代码:</p>

<pre><code>#import &lt;UIKit/UIKit.h&gt;
#import &lt;UIImage+StackBlur.h&gt;
#import &lt;logos/logos.h&gt;

#define kBundlePath @&#34;/Library/MobileSubstrate/DynamicLibraries/Unlock7.bundle&#34;

@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 *&amp;_backgroundView(MSHookIvar&lt;UIView *&gt;(self, &#34;_backgroundView&#34;));
    ; //Allows backbround to use gesture

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

    UIPanGestureRecognizer *panRecognizer = [ initWithTarget:self action:@selector(newUnlockStyleMover:)];
    ;
    ;
    // This can be used but is incompatible with LockHTML
    [ addGestureRecognizer:panRecognizer]; //Add gesture to the background view or LockHTML&#39;s z order organizer
    ;

    panRecognizer = [ initWithTarget:self action:@selector(newUnlockStyleMover:)];
    ;
    ;
    [ addGestureRecognizer:panRecognizer]; //Lockbar
    ;

    panRecognizer = [ initWithTarget:self action:@selector(newUnlockStyleMover:)];
    ;
    ;
    [ addGestureRecognizer:panRecognizer]; //Clock and Date View&#39;s
    ;

    shadowColor:];

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

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

%new
- (void)newUnlockStyleMover:(UIPanGestureRecognizer *)sender {
      UIView *&amp;_lockBar(MSHookIvar&lt;UIView *&gt;(self, &#34;_lockBar&#34;));
      float width = (.statusBarOrientation == UIInterfaceOrientationPortrait || .statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown) ? [ bounds].size.width : [ bounds].size.height;
      CGPoint point = ;
      if (sender.state == UIGestureRecognizerStateChanged){
            UIImage *_defaultDesktopImage = ;
            for(UIView *obj in ){   
                if(obj != ){
                  CGPoint center = obj.center;
                  if(center.x &lt; 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 &lt; width){

                for(UIView *obj in ){   
                  if(obj != ){
                        CGPoint center = obj.center;
                        center.x = width/2;
                        [UIView animateWithDuration:0.6
                           animations:^{
                              obj.center = center;
                           }
                           completion:^(BOOL finished){
                           }];
                  }
                }
            }
            else{
                for(UIView *obj in ){   
                  if(obj != ){
                        CGPoint center = obj.center;
                        center.x = width+(width/2);
                        [UIView animateWithDuration:0.2
                           animations:^{
                              obj.center = center;
                           }
                           completion:^(BOOL finished){
                           }];
                  }
                }
                if([ fileExistsAtPath:] == TRUE &amp;&amp; [[ objectForKey:@&#34;Enable&#34;] 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 ;
}

- (id)_topBarLCDControlsImage{
    return ;
}

%new
-(UIImage*)getUIImageForControls{
    UIGraphicsBeginImageContextWithOptions(CGSizeMake([ bounds].size.width, 133), NO, 0.0);
    NSBundle *bundle = [[ initWithPath:kBundlePath] autorelease];
    NSString *imagePath = ;
    UIImage *blank = UIGraphicsGetImageFromCurrentImageContext();
    UIImage *myImage = ;
    UIImage *myIma=[ normalized];
    UIImage *blurIma=;
    UIGraphicsEndImageContext();
    return blank;
}

- (void)_setPluginController:(id)arg1{
    %orig(arg1);
    if (){
      id pluginController = ;
      if (){
      UIView *pluginView = [(NowPlayingArtPluginController *)pluginController view];
                UIPanGestureRecognizer *panRecognizer = [ initWithTarget:self action:@selector(newUnlockStyleMover:)];
                ;
                ;
                //;
                ;
                ;
            for(UIView *obj in [[(NowPlayingArtPluginController *)pluginController view] subviews]){      
                  if(]){
                        if([ bounds].size.width == 320)
                            obj.frame = CGRectMake(0, 0, 256, 256);
                  }
                  if(){
                        ;
                  }
            }
            if([ 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 = (.statusBarOrientation == UIInterfaceOrientationPortrait || .statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown) ? [ bounds].size.width : [ bounds].size.height;
    [[[[%c(SBAwayController) sharedAwayController] awayView] bottomBar] setHidden:NO];
    for(UIView *obj in [ subviews]){
      if(obj != [[ 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&lt;TPLCDTextView *&gt;(self, &#34;_timeLabel&#34;);
    fontWithSize:96]];
    ;

    ;
}

%new
-(void)setPositon{
    TPLCDTextView *dateLabel = MSHookIvar&lt;TPLCDTextView *&gt;(self, &#34;_dateAndTetheringLabel&#34;);
    ;
}

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

- (void)resizeAndPositionNowPlayingLabels{
    UILabel *_nowPlayingTitleLabel = MSHookIvar&lt;UILabel *&gt;(self, &#34;_nowPlayingTitleLabel&#34;);
    UILabel *_nowPlayingArtistLabel = MSHookIvar&lt;UILabel *&gt;(self, &#34;_nowPlayingArtistLabel&#34;);
    UILabel *_nowPlayingAlbumLabel = MSHookIvar&lt;UILabel *&gt;(self, &#34;_nowPlayingAlbumLabel&#34;);
    bounds].size.width,20)];
    bounds].size.width,20)];
    bounds].size.width,20)];
}
%end

%hook TPLCDTextView
%new
-(UIFont *)font{
    UIFont *font = MSHookIvar&lt;UIFont *&gt;(self, &#34;_font&#34;);
    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 *&amp;_shadowView(MSHookIvar&lt;UIImageView *&gt;(self, &#34;_shadowView&#34;));
    ;
    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 *&amp;_shadowView(MSHookIvar&lt;UIImageView *&gt;(self, &#34;_shadowView&#34;));
    ;
    return lockBar;
}
%end

%hook SBDeviceLockView
- (void)notifyDelegateThatCancelButtonWasPressed{
    //Slide lockscreen back to default position after cancel button is pressed in lockscreen
    float width = (.statusBarOrientation == UIInterfaceOrientationPortrait || .statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown) ? [ bounds].size.width : [ 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 ){
      if (){ //This is the MediaContols Thin Line
            ;
      }
    }
}
%end

%hook TPLCDBar
//Everything here make sure there is no thin black/grey line below the view
- (id)initWithDefaultSize{
    id topBar = %orig;
    UIImageView *&amp;_shadowView(MSHookIvar&lt;UIImageView *&gt;(self, &#34;_shadowView&#34;));
    ;
    return topBar;
}

- (id)initWithDefaultSizeForOrientation:(int)arg1{
    id topBar = %orig;
    UIImageView *&amp;_shadowView(MSHookIvar&lt;UIImageView *&gt;(self, &#34;_shadowView&#34;));
    ;
    return topBar;
}

-(id)initWithFrame:(CGRect)frame{
    id topBar = %orig;
    UIImageView *&amp;_shadowView(MSHookIvar&lt;UIImageView *&gt;(self, &#34;_shadowView&#34;));
    ;
    return topBar;
}

%end
</code></pre>

<p>感谢任何帮助。
谢谢!
(对不起英语不好)</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>这是因为 TWEAK_NAME 和 BUNDLE_NAME 具有相同的值。 Makefile 应该是这样的:</p>

<pre><code>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 &#34;killall -9 SpringBoard&#34;
</code></pre>

<p>BUNDLE_NAME 现在有一个不同于 TWEAK_NAME 的后缀。您可以为 bundle 使用任何其他名称。</p>

<p>根据新的bundle名称重新定义source中bundle的路径:</p>

<pre><code>#define kBundlePath @&#34;/Library/MobileSubstrate/DynamicLibraries/Unlock7img.bundle&#34;
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 架构 armv7 错误的 undefined symbol ,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/23978423/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/23978423/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 架构 armv7 错误的 undefined symbol