msys2+ mingw拒绝编译Windows的64位VIM

发布于 2025-01-31 15:33:02 字数 4880 浏览 5 评论 0原文

我正在遵循 https://github.com/vim/vim/ vim/blob/master/src/installpc.txt (第2节 - 带有mingw的MSYS2)

我已经安装了MSYS2,并通过msys64目录中的mingw64文件运行,安装了所有依赖项等。我得到了直到2.4 2.4

我导航到VIM 8.1安装的SRC文件夹并运行命令,但是当我运行 make -f shake_ming.mak gui = no 时,我遇到了此错误

    $ make -f Make_ming.mak
    g++ -I. -Iproto - ..[omitted].. -luuid
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/buffer.o:buffer.c:(.text+0xf01): undefined reference to `python3_buffer_free'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/eval.o:eval.c:(.text+0xea4): undefined reference to `set_ref_in_python3'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/evalfunc.o:evalfunc.c:(.text+0x4505): undefined reference to `python3_enabled'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/evalfunc.o:evalfunc.c:(.text+0x6990): undefined reference to `do_py3eval'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/evalfunc.o:evalfunc.c:(.text+0x7bd2): undefined reference to `do_py3eval'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_cmds2.o:ex_cmds2.c:(.text+0x277d): undefined reference to `ex_py3file'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_cmds2.o:ex_cmds2.c:(.text+0x2891): undefined reference to `ex_py3'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_cmds2.o:ex_cmds2.c:(.text+0x28a1): undefined reference to `ex_py3do'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x4fa8): undefined reference to `ex_py3'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x4fc8): undefined reference to `ex_py3do'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x4fe8): undefined reference to `ex_py3'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x5008): undefined reference to `ex_py3file'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/main.o:main.c:(.text+0x2785): undefined reference to `python3_end'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/window.o:window.c:(.text+0x569a): undefined reference to `python3_window_free'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/window.o:window.c:(.text+0x6117): undefined reference to `python3_tabpage_free'
    collect2.exe: error: ld returned 1 exit status
    make: *** [Make_cyg_ming.mak:1042: gvim.exe] Error 1

我正在慢慢失去理智,我花了3天的时间试图将其进行编译。我还尝试了使用Windows-native mingw32(巧克力)的方法,尝试了WSL Ubuntu的交叉编译,并在MSYS2中编译而不是Mingw64端子。其目的是最终与特定版本的VIM(8.1)一起编译Python的特定版本(3.7)。

这是我的MSYS上安装的内容:

$ pacman -Qqe
base
base-devel
filesystem
mingw-w64-x86_64-binutils
mingw-w64-x86_64-crt-git
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-ada
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-gcc-libgfortran
mingw-w64-x86_64-gcc-libs
mingw-w64-x86_64-gcc-objc
mingw-w64-x86_64-gdb
mingw-w64-x86_64-gdb-multiarch
mingw-w64-x86_64-headers-git
mingw-w64-x86_64-libgccjit
mingw-w64-x86_64-libmangle-git
mingw-w64-x86_64-libwinpthread-git
mingw-w64-x86_64-make
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-tools-git
mingw-w64-x86_64-winpthreads-git
mingw-w64-x86_64-winstorecompat-git
msys2-runtime

以及我的编译器的位置/版本

C:\tools\msys64\mingw64\bin\mingw32-make.exe

C:\tools\msys64\mingw64\bin\gcc.exe

C:\tools\msys64\mingw64\bin\g++.exe

除非我非常绝望并且没有选择,否则我通常会拒绝寻求帮助,因此,如果这个问题写得不好或难以理解,我深表歉意。

I was following the guide in https://github.com/vim/vim/blob/master/src/INSTALLpc.txt
(Section 2 - Msys2 with MinGW)

I've installed msys2 and ran it through the mingw64 file in the msys64 directory, installed all dependencies, etc. I got until 2.4
2.4.

I navigated to the SRC folder of the vim 8.1 installation and ran the command, but I got this error when I run make -f Make_ming.mak GUI=no

    $ make -f Make_ming.mak
    g++ -I. -Iproto - ..[omitted].. -luuid
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/buffer.o:buffer.c:(.text+0xf01): undefined reference to `python3_buffer_free'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/eval.o:eval.c:(.text+0xea4): undefined reference to `set_ref_in_python3'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/evalfunc.o:evalfunc.c:(.text+0x4505): undefined reference to `python3_enabled'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/evalfunc.o:evalfunc.c:(.text+0x6990): undefined reference to `do_py3eval'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/evalfunc.o:evalfunc.c:(.text+0x7bd2): undefined reference to `do_py3eval'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_cmds2.o:ex_cmds2.c:(.text+0x277d): undefined reference to `ex_py3file'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_cmds2.o:ex_cmds2.c:(.text+0x2891): undefined reference to `ex_py3'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_cmds2.o:ex_cmds2.c:(.text+0x28a1): undefined reference to `ex_py3do'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x4fa8): undefined reference to `ex_py3'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x4fc8): undefined reference to `ex_py3do'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x4fe8): undefined reference to `ex_py3'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x5008): undefined reference to `ex_py3file'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/main.o:main.c:(.text+0x2785): undefined reference to `python3_end'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/window.o:window.c:(.text+0x569a): undefined reference to `python3_window_free'
    C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/window.o:window.c:(.text+0x6117): undefined reference to `python3_tabpage_free'
    collect2.exe: error: ld returned 1 exit status
    make: *** [Make_cyg_ming.mak:1042: gvim.exe] Error 1

I am slowly losing my mind, I've spent 3 days trying to get this to compile. I've also tried approaches with windows-native mingw32 (chocolatey), tried cross-compiling from WSL ubuntu, compiling inside of msys2 instead of mingw64 terminal.. The purpose of this is to eventually compile a specific version of vim (8.1) with a specific version of python (3.7).

Here is what is installed on my msys:

$ pacman -Qqe
base
base-devel
filesystem
mingw-w64-x86_64-binutils
mingw-w64-x86_64-crt-git
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-ada
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-gcc-libgfortran
mingw-w64-x86_64-gcc-libs
mingw-w64-x86_64-gcc-objc
mingw-w64-x86_64-gdb
mingw-w64-x86_64-gdb-multiarch
mingw-w64-x86_64-headers-git
mingw-w64-x86_64-libgccjit
mingw-w64-x86_64-libmangle-git
mingw-w64-x86_64-libwinpthread-git
mingw-w64-x86_64-make
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-tools-git
mingw-w64-x86_64-winpthreads-git
mingw-w64-x86_64-winstorecompat-git
msys2-runtime

and the locations/versions of my compilers

C:\tools\msys64\mingw64\bin\mingw32-make.exe

C:\tools\msys64\mingw64\bin\gcc.exe

C:\tools\msys64\mingw64\bin\g++.exe

I most often refuse to request help unless I am extremely desperate and out of options, so I apologize if this question was written poorly or difficult to understand.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

锦爱 2025-02-07 15:33:02

看来,在Python 3.9中,_py_dec_reftotal被完全删除而没有任何替代。 thread(redhat.com)。它不会构建某些VIM的版本。我通过巧克力安装了Python3.6,所有内容都完美地编译和链接。

要进行将来的参考,请首先安装Python3版本,

(choco install python --version=3.6.7)

然后在VIM的SRC文件夹中使用Mingw64 Shell中使用此版本:

> mingw32-make -f Make_ming.mak PYTHON3=C:/Python36
PYTHON3_HOME=C:/Python36 PYTHON3INC=-IC:/Python36/include DYNAMIC_PYTHON3=yes 
PYTHON3_VER=36 DYNAMIC_PYTHON3_DLL=libpython36.dll 
STATIC_STDCPLUS=yes

It seems that in Python 3.9, _Py_DEC_REFTOTAL was removed completely without any substitute. Thread (redhat.com). It will not build certain versions of vim. I installed Python3.6 through chocolatey, and everything compiled and linked perfectly.

For future reference, first install a version of python3 that works

(choco install python --version=3.6.7)

then use this in mingw64 shell in src folder of vim:

> mingw32-make -f Make_ming.mak PYTHON3=C:/Python36
PYTHON3_HOME=C:/Python36 PYTHON3INC=-IC:/Python36/include DYNAMIC_PYTHON3=yes 
PYTHON3_VER=36 DYNAMIC_PYTHON3_DLL=libpython36.dll 
STATIC_STDCPLUS=yes
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文