macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.47k stars 680 forks source link

MacVim: Missing vim directory in MacVim.app/Contents/Resources #1335

Closed mario-grgic closed 1 year ago

mario-grgic commented 1 year ago

Steps to reproduce

I am building macvim from source (I do this couple of times a week to keep up to date). Today I am building as of commit d311aae87, using the following configure options

./configure --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-python3interp --enable-perlinterp --enable-luainterp=yes --with-lua-prefix=/usr/local --enable-cscope --enable-terminal

which produces MacVim.app without vim directory in MacVim.app/Contents/Resources/ directory, so entire runtime directory is not available. This is a recent regression.

By the way I am building on macOS 10.15 Catalina, with Xcode 12.1.

This does not happen on macOS 13.0 Ventura and Xcode 14.1.

Expected behaviour

vim and runtime directories should be installed in Runtime.

Version of Vim and architecture

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 3 2022 13:19:30) macOS version - x86_64 Included patches: 1-827

Environment

macOS 10.15.7 Catalina Built in Terminal.app echo $TERM xterm-256color shell: GNU bash, version 5.2.0(1)-release (x86_64-apple-darwin19.6.0)

How MacVim was installed

Built from git

Logs and stack traces

No response

Vim configuration where issue is reproducable

No response

Issue has been tested with given configuration

Issue has been tested with no configuration

Other conditions

eirnym commented 1 year ago

It's important, that if you need both python3 and python2, dynamic option is required. It's neither possible to build Vim with both versions of Python statically, nor use both Python versions in the same Vim session.

ychin commented 1 year ago

Do you see any error messages @mario-grgic? Your issue report seems to suggest it completed building but didn't include the "vim" folder but I'm guessing that the build just failed?

I have seen that Sparkle 2's framework doesn't really work well with older versions of Xcode before. I have been wondering about filing a bug report on Sparkle. Can you try this and see if it fixes the issue locally (run it from repo root folder)?

ln -fhs Sparkle_1.framework src/MacVim/Sparkle.framework

If it does fix the issue, you can just use that for now. I'll think about if there's a way to handle this better.

ychin commented 1 year ago

Actually, I think this may be related to a code signing bug in older Xcode versions (https://github.com/sparkle-project/Sparkle/issues/2069). Can you try the following @mario-grgic (apply the patch) instead of what I mentioned above? You didn't include an error message so I'm guessing that you are failing at the code signing stage, but if it's something else then we have to debug further:

diff --git a/src/MacVim/MacVim.xcodeproj/project.pbxproj b/src/MacVim/MacVim.xcodeproj/project.pbxproj
index 010838316e..0ca1b98705 100644
--- a/src/MacVim/MacVim.xcodeproj/project.pbxproj
+++ b/src/MacVim/MacVim.xcodeproj/project.pbxproj
@@ -65,7 +65,7 @@
                52818B031C1C08CE00F59085 /* QLStephen.qlgenerator in Copy QuickLookPlugin */ = {isa = PBXBuildFile; fileRef = 52818AFF1C1C075300F59085 /* QLStephen.qlgenerator */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
                528DA66A1426D4F9003380F1 /* macvim-askpass in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 528DA6691426D4EB003380F1 /* macvim-askpass */; };
                52A364731C4A5789005757EC /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
-               52A364761C4A57C1005757EC /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+               52A364761C4A57C1005757EC /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
                8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
                8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
                8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };

If you don't want to apply the patch you can just go to Xcode, select MacVim.xcodeproj, go to Build Phases -> Copy Framework, and then turn off Code Sign On Copy for Sparkle.framework.

mario-grgic commented 1 year ago

This is a build failure, which I didn't originally notice since post build I run a few scripts to copy over custom MacVim icons, etc. But here is build failure:

    cd /Volumes/ramdisk/macvim.git/src/MacVim
    builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -strip-debug-symbols -strip-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -resolve-src-symlinks /Volumes/ramdisk/macvim.git/src/MacVim/build/Release/PSMTabBarControl.framework /Volumes/ramdisk/macvim.git/src/MacVim/build/Release/MacVim.app/Contents/Frameworks
warning: skipping copy phase strip, binary is code signed: /Volumes/ramdisk/macvim.git/src/MacVim/build/Release/PSMTabBarControl.framework/Versions/A/PSMTabBarControl (in target 'MacVim' from project 'MacVim')

CodeSign /Volumes/ramdisk/macvim.git/src/MacVim/build/Release/MacVim.app/Contents/Frameworks/PSMTabBarControl.framework/Versions/A (in target 'MacVim' from project 'MacVim')
    cd /Volumes/ramdisk/macvim.git/src/MacVim
    export CODESIGN_ALLOCATE\=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "-"

    /usr/bin/codesign --force --sign - --timestamp\=none --preserve-metadata\=identifier,entitlements,flags /Volumes/ramdisk/macvim.git/src/MacVim/build/Release/MacVim.app/Contents/Frameworks/PSMTabBarControl.framework/Versions/A
/Volumes/ramdisk/macvim.git/src/MacVim/build/Release/MacVim.app/Contents/Frameworks/PSMTabBarControl.framework/Versions/A: replacing existing signature

CodeSign /Volumes/ramdisk/macvim.git/src/MacVim/build/Release/MacVim.app/Contents/Frameworks/Sparkle.framework/Versions/A (in target 'MacVim' from project 'MacVim')
    cd /Volumes/ramdisk/macvim.git/src/MacVim
    export CODESIGN_ALLOCATE\=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "-"

    /usr/bin/codesign --force --sign - --timestamp\=none --preserve-metadata\=identifier,entitlements,flags /Volumes/ramdisk/macvim.git/src/MacVim/build/Release/MacVim.app/Contents/Frameworks/Sparkle.framework/Versions/A
/Volumes/ramdisk/macvim.git/src/MacVim/build/Release/MacVim.app/Contents/Frameworks/Sparkle.framework/Versions/A: bundle format unrecognized, invalid, or unsuitable
Command CodeSign failed with a nonzero exit code

warning: Traditional headermap style is no longer supported; please migrate to using separate headermaps and set 'ALWAYS_SEARCH_USER_PATHS' to NO. (in target 'QuickLookStephen' from project 'QuickLookStephen')
** BUILD FAILED **

and yes it is related to code signing.

I tried applying the patch, but get:

$ patch -p1 < /Volumes/ramdisk/macvim.patch
patching file src/MacVim/MacVim.xcodeproj/project.pbxproj
Hunk #1 FAILED at 65.
1 out of 1 hunk FAILED -- saving rejects to file src/MacVim/MacVim.xcodeproj/project.pbxproj.rej
$ 

And here is the rejects file:

***************
*** 65,71 ****
                 52818B031C1C08CE00F59085 /* QLStephen.qlgenerator in Copy QuickLookPlugin */ = {isa = PBXBuildFile; fileRef = 52818AFF1C1C075300F59085 /* QLStephen.qlgenerator */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
                 528DA66A1426D4F9003380F1 /* macvim-askpass in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 528DA6691426D4EB003380F1 /* macvim-askpass */; };
                 52A364731C4A5789005757EC /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
-                52A364761C4A57C1005757EC /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
                 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
                 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
                 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
--- 65,71 ----
                 52818B031C1C08CE00F59085 /* QLStephen.qlgenerator in Copy QuickLookPlugin */ = {isa = PBXBuildFile; fileRef = 52818AFF1C1C075300F59085 /* QLStephen.qlgenerator */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
                 528DA66A1426D4F9003380F1 /* macvim-askpass in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 528DA6691426D4EB003380F1 /* macvim-askpass */; };
                 52A364731C4A5789005757EC /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
+                52A364761C4A57C1005757EC /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
                 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
                 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
                 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
ychin commented 1 year ago

You can just open src/MacVim/MacVim.xcodeproj/project.pbxproj and remove CodeSignOnCopy, from the Sparkle.framework line.

mario-grgic commented 1 year ago

Fixing the Xcode project to remove code signing step for sparkle framework works.

eirnym commented 1 year ago

MacPorts removes Sparkle framework entirely

ychin commented 1 year ago

Fixing the Xcode project to remove code signing step for sparkle framework works.

Cool thanks for confirming. #1336 will fix this. Feel free to try it out once it's merged.

ychin commented 1 year ago

MacPorts removes Sparkle framework entirely

Yes but it requires a custom patch to manually strip it. Homebrew also disables Sparkle but it only removes Sparkle after the build is done. During build phase it still links against Sparkle.

ychin commented 1 year ago

Alright this is merged. @mario-grgic you can revert the change and just pull the latest. Let me know if you see more issues with building/running.

mario-grgic commented 1 year ago

@ychin Just to confirm, the issue is fixed. Thank you all for fast responses and speedy fix.