XVimProject / XVim

Xcode plugin for Vim keybindings
MIT License
5.16k stars 596 forks source link

Link error #1069

Open magiclyx opened 7 years ago

magiclyx commented 7 years ago

Link error

Description

Build failure with a link error. The IDEPlaygroundEditor class not have an implementation。 I tried to add the following code in IDEPlaygroundEditor + XVim file to solve this problem

@implementation IDEPlaygroundEditor @end

Operation

make

Expected behaviour

Build XVim and install it to Xcode's plugins.

Environments

Crash log

Ld build/Release/XVim.xcplugin/Contents/MacOS/XVim normal x86_64 cd /Users/yuxiliu/Desktop/xvim/XVim export MACOSX_DEPLOYMENT_TARGET=10.7 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -L/Users/yuxiliu/Desktop/xvim/XVim/build/Release -L/Applications/Xcode.app/Contents/Developer/../PlugIns/IDESourceEditor.ideplugin/Contents/MacOS -F/Users/yuxiliu/Desktop/xvim/XVim/build/Release -F/Applications/Xcode.app/Contents/Developer/../Frameworks -F/Applications/Xcode.app/Contents/Developer/../PlugIns -F/Applications/Xcode.app/Contents/Developer/../SharedFrameworks -filelist /Users/yuxiliu/Desktop/xvim/XVim/build/XVim.build/Release/XVim.build/Objects-normal/x86_64/XVim.LinkFileList -mmacosx-version-min=10.7 -Xlinker -object_path_lto -Xlinker /Users/yuxiliu/Desktop/xvim/XVim/build/XVim.build/Release/XVim.build/Objects-normal/x86_64/XVim_lto.o -fobjc-arc -fobjc-link-runtime -framework AppKit -framework Cocoa -framework IDEFoundation -framework IDEKit -framework DVTFoundation -framework DVTKit /Applications/Xcode.app/Contents/PlugIns/IDELanguageSupportUI.ideplugin/Contents/MacOS/IDELanguageSupportUI /Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.ideplugin/Contents/MacOS/IDESourceEditor -Xlinker -dependency_info -Xlinker /Users/yuxiliu/Desktop/xvim/XVim/build/XVim.build/Release/XVim.build/Objects-normal/x86_64/XVim_dependency_info.dat -o /Users/yuxiliu/Desktop/xvim/XVim/build/Release/XVim.xcplugin/Contents/MacOS/XVim Undefined symbols for architecture x86_64: "_OBJCCLASS$_IDEPlaygroundEditor", referenced from: anon in IDEPlaygroundEditor+XVim.o lOBJC$_CATEGORYIDEPlaygroundEditor$_XVim in IDEPlaygroundEditor+XVim.o objc-class-ref in XVimHookManager.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

BUILD FAILED

The following build commands failed: Ld build/Release/XVim.xcplugin/Contents/MacOS/XVim normal x86_64 (1 failure) make: *** [release] Error 65

daniel-beard commented 7 years ago

Also seeing this.

daniel-beard commented 7 years ago

@magiclyx commenting out the IDEPlaygroundEditor+XVim sources and the initialize call to that was enough to get it working for me (and I don't really care about playground editing too much right now anyway). Here's a patch that does that:

diff --git a/XVim/IDEPlaygroundEditor+XVim.h b/XVim/IDEPlaygroundEditor+XVim.h
index dd8e790..77197ba 100644
--- a/XVim/IDEPlaygroundEditor+XVim.h
+++ b/XVim/IDEPlaygroundEditor+XVim.h
@@ -6,17 +6,17 @@
 //  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
 //

-#import <Foundation/Foundation.h>
-#import "IDESourceCodeEditor+XVim.h"
-
-@interface IDEPlaygroundEditor : IDESourceCodeEditor
-@end
-
-@interface IDEPlaygroundEditor(XVim)
-+ (void)xvim_initialize;
-
-// The reason to append "2" at end of the method name is because this class is inheited from IDESourceCodeEdtior
-// which we also swizzle. It interfares if we us the same name.
-- (void)xvim_didSetupEditor2;
-
-@end
\ No newline at end of file
+//#import <Foundation/Foundation.h>
+//#import "IDESourceCodeEditor+XVim.h"
+//
+//@interface IDEPlaygroundEditor : IDESourceCodeEditor
+//@end
+//
+//@interface IDEPlaygroundEditor(XVim)
+//+ (void)xvim_initialize;
+//
+//// The reason to append "2" at end of the method name is because this class is inheited from IDESourceCodeEdtior
+//// which we also swizzle. It interfares if we us the same name.
+//- (void)xvim_didSetupEditor2;
+//
+//@end
diff --git a/XVim/IDEPlaygroundEditor+XVim.m b/XVim/IDEPlaygroundEditor+XVim.m
index 2198e8b..ab274d9 100644
--- a/XVim/IDEPlaygroundEditor+XVim.m
+++ b/XVim/IDEPlaygroundEditor+XVim.m
@@ -5,26 +5,26 @@
 //  Created by Tomas Lundell on 31/03/12.
 //  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
 //
-
-#import "IDEKit.h"
-#import "DVTFoundation.h"
-#import "XVimWindow.h"
-#import "Logger.h"
-#import "XVimStatusLine.h"
-#import "XVim.h"
-#import "NSObject+XVimAdditions.h"
-#import "NSObject+ExtraData.h"
-#import <objc/runtime.h>
-#import "IDEPlaygroundEditor+XVim.h"
-
-@implementation IDEPlaygroundEditor(XVim)
-
-+ (void)xvim_initialize{
-    [self xvim_swizzleInstanceMethod:@selector(didSetupEditor) with:@selector(xvim_didSetupEditor2)];
-}
-
-- (void)xvim_didSetupEditor2{
-    [self xvim_didSetupEditor2]; // This is original didSetupEditor of IDEPlaygroundEditor class
-    [super didSetupEditor]; // This is super class (IDESourceCodeEditor) didSetupEditor, which is hooked by XVim, resulting in calling xvim_didSetupEditor.
-}
-@end
\ No newline at end of file
+//
+//#import "IDEKit.h"
+//#import "DVTFoundation.h"
+//#import "XVimWindow.h"
+//#import "Logger.h"
+//#import "XVimStatusLine.h"
+//#import "XVim.h"
+//#import "NSObject+XVimAdditions.h"
+//#import "NSObject+ExtraData.h"
+//#import <objc/runtime.h>
+//#import "IDEPlaygroundEditor+XVim.h"
+//
+//@implementation IDEPlaygroundEditor(XVim)
+//
+//+ (void)xvim_initialize{
+//    [self xvim_swizzleInstanceMethod:@selector(didSetupEditor) with:@selector(xvim_didSetupEditor2)];
+//}
+//
+//- (void)xvim_didSetupEditor2{
+//    [self xvim_didSetupEditor2]; // This is original didSetupEditor of IDEPlaygroundEditor class
+//    [super didSetupEditor]; // This is super class (IDESourceCodeEditor) didSetupEditor, which is hooked by XVim, resulting in calling xvim_didSetupEditor.
+//}
+//@end
diff --git a/XVim/Info.plist b/XVim/Info.plist
index 99948e1..3d24fcd 100644
--- a/XVim/Info.plist
+++ b/XVim/Info.plist
@@ -20,6 +20,7 @@
    <string>1</string>
    <key>DVTPlugInCompatibilityUUIDs</key>
    <array>
+       <string>DFFB3951-EB0A-4C09-9DAC-5F2D28CC839C</string>
        <string>1637F4D5-0B27-416B-A78D-498965D64877</string>
        <string>AD68E85B-441B-4301-B564-A45E4919A6AD</string>
        <string>A2E4D43F-41F4-4FB9-BB94-7177011C9AED</string>
@@ -42,7 +43,7 @@
        <string>E71C2CFE-BFD8-4044-8F06-00AE685A406C</string>
        <string>8A66E736-A720-4B3C-92F1-33D9962C69DF</string>
        <string>DA4FDFD8-C509-4D8B-8B55-84A7B66AE701</string>
-        <string>E0A62D1F-3C18-4D74-BFE5-A4167D643966</string>
+       <string>E0A62D1F-3C18-4D74-BFE5-A4167D643966</string>
    </array>
    <key>NSHumanReadableCopyright</key>
    <string>Copyright © 2012 JugglerShu.Net. All rights reserved.</string>
diff --git a/XVim/XVimHookManager.m b/XVim/XVimHookManager.m
index 3d764f9..86a2889 100644
--- a/XVim/XVimHookManager.m
+++ b/XVim/XVimHookManager.m
@@ -53,7 +53,7 @@ + (void)hookWhenPluginLoaded
     [DVTTextSidebarView xvim_initialize];
     [DVTSourceTextScrollView xvim_initialize];
     [IDESourceCodeEditor xvim_initialize];
-    [IDEPlaygroundEditor xvim_initialize];
+//    [IDEPlaygroundEditor xvim_initialize];
     [IDEEditor xvim_initialize];
     [IDEApplicationController xvim_initialize];
 }
vgribov commented 7 years ago

There is a better way:

diff --git a/XVim/IDEPlaygroundEditor+XVim.m b/XVim/IDEPlaygroundEditor+XVim.m
index 2198e8b..a5245df 100644
--- a/XVim/IDEPlaygroundEditor+XVim.m
+++ b/XVim/IDEPlaygroundEditor+XVim.m
@@ -17,6 +17,9 @@
 #import <objc/runtime.h>
 #import "IDEPlaygroundEditor+XVim.h"

+@implementation IDEPlaygroundEditor
+@end
+
 @implementation IDEPlaygroundEditor(XVim)

 + (void)xvim_initialize{
@@ -27,4 +30,4 @@ - (void)xvim_didSetupEditor2{
     [self xvim_didSetupEditor2]; // This is original didSetupEditor of IDEPlaygroundEditor class
     [super didSetupEditor]; // This is super class (IDESourceCodeEditor) didSetupEditor, which is hooked by XVim, resulting in calling xvim_didSetupEditor.
 }
-@end
\ No newline at end of file
+@end
PandaraWen commented 7 years ago

@vgribov Yeah, works fine for me

bruce-bai22 commented 7 years ago

Great.

makomori commented 7 years ago

@vgribov works for me also, thanks

abeazam commented 7 years ago

thx @vgribov worked a chard :)

0xmax commented 7 years ago

Thank you @vgribov

devapps19 commented 7 years ago

Still not compiling for me. Same error. Did I make the changes by @vgibov correctly ?

1 // 2 // XVimSourceCodeEditor.m 3 // XVim 4 // 5 // Created by Tomas Lundell on 31/03/12. 6 // Copyright (c) 2012 MyCompanyName. All rights reserved. 7 // 8 9 #import "IDEKit.h" 10 #import "DVTFoundation.h" 11 #import "XVimWindow.h" 12 #import "Logger.h" 13 #import "XVimStatusLine.h" 14 #import "XVim.h" 15 #import "NSObject+XVimAdditions.h" 16 #import "NSObject+ExtraData.h" 17 #import <objc/runtime.h> 18 #import "IDEPlaygroundEditor+XVim.h" 19 20 @implementation IDEPlaygroundEditor 21 @end 22 23 @implementation IDEPlaygroundEditor(XVim) 24 25 + (void)xvim_initialize{ 26 [self xvim_swizzleInstanceMethod:@selector(didSetupEditor) with:@selector(xvim_didSetupEditor2)]; 27 } 28 29 - (void)xvim_didSetupEditor2{ 30 [self xvim_didSetupEditor2]; // This is original didSetupEditor of IDEPlaygroundEditor class 31 [super didSetupEditor]; // This is super class (IDESourceCodeEditor) didSetupEditor, which is hooked by XVim, resulting in calling xvim_didSetupEditor. 32 } 33 34 @end

griffind commented 7 years ago

@devapps19 your IDEPlaygroundEditor.m should look like the following:

//
//  XVimSourceCodeEditor.m
//  XVim
//
//  Created by Tomas Lundell on 31/03/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

//#import "IDEKit.h"
//#import "DVTFoundation.h"
//#import "XVimWindow.h"
//#import "Logger.h"
//#import "XVimStatusLine.h"
//#import "XVim.h"
//#import "NSObject+XVimAdditions.h"
//#import "NSObject+ExtraData.h"
#import <objc/runtime.h>
#import "IDEPlaygroundEditor+XVim.h"

@implementation IDEPlaygroundEditor

//+ (void)xvim_initialize{
//    [self xvim_swizzleInstanceMethod:@selector(didSetupEditor) with:@selector(xvim_didSetupEditor2)];
//}
//
//- (void)xvim_didSetupEditor2{
//    [self xvim_didSetupEditor2]; // This is original didSetupEditor of IDEPlaygroundEditor class
//    [super didSetupEditor]; // This is super class (IDESourceCodeEditor) didSetupEditor, which is hooked by XVim, resulting in calling xvim_didSetupEditor.
//}
@end