4

我正在尝试在 Windows 上使用 Meld 作为 Git Difftool 并面临以下问题:

Launch 'meld' [Y/n]? Y
Cannot import: GTK+
DLL load failed: Das angegebene Modul wurde nicht gefunden.

发生以下 Python 错误:

cx_Freeze: Python error in main script

Traceback (most recent call last):
  File "bin/meld", line 205, in check_requirements
    import gi
  File "C:/msys64/MINGW32/lib/python3.7/site-packages/gi/__init__.py", line 42, in <module>
  File "ExtensionLoader_gi__gi.py", line 23, in <module>
  File "ExtensionLoader_gi__gi.py", line 15, in __bootstrap__
  File "C:/msys64/MINGW32/lib/python3.7/imp.py", line 342, in load_dynamic
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/msys64/MINGW32/lib/python3.7/site-packages\cx_Freeze/initscripts/__startup__.py", line 14, in run
  File "C:/msys64/MINGW32/lib/python3.7/site-packages\cx_Freeze/initscripts/Console.py", line 26, in run
  File "bin/meld", line 362, in <module>
    check_requirements()
  File "bin/meld", line 211, in check_requirements
    missing_reqs("GTK+", gtk_requirement, e)
  File "bin/meld", line 194, in missing_reqs
    show_error_and_exit(_("Cannot import: ") + mod + "\n" + str(exc))
  File "bin/meld", line 182, in show_error_and_exit
    raise Exception(error_text)
Exception: Cannot import: GTK+
DLL load failed: The specified module could not be found.

当我尝试在 git bash 中运行 meld.exe 时,也会出现同样的问题。

为了使用 meld 作为 difftool,我更改了用户 gitconfig 文件中的设置:

[merge]
    tool = meld
[mergetool "meld"]  
    path = C:\\Program Files (x86)\\Meld\\meld.exe
[diff]
    tool = meld

这似乎是正确的,因为 git 在工作区中使用命令 'git difftool' 后试图启动 meld.exe。

4

2 回答 2

7

以下 lib-workaround 有助于将 meld.exe 作为外部 git difftool 启动:

Meld 期望在错误目录中存在名为“libgirepository-1.0-1.dll”的特定 dll 文件,需要将文件 libgirepository-1.0-1.dll 从 C:\Program Files (x86)\Meld\lib 复制到C:\Program Files (x86)\Meld 上面的目录。

结果是 Meld 在命令 'git difftool' 之后启动并且在 git bash 中运行 meld.exe 之后,但是发生了以下错误:

2019-09-18 14:12:24,612 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.612: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,612 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.612: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,614 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.614: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,614 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.614: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,615 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.615: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,615 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.615: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,617 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.617: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,617 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.617: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,202 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.201: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,203 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.203: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,203 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.203: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,203 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.203: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,204 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.204: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,204 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.204: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,205 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.205: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,205 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.205: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,205 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.205: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,206 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.206: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,207 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.207: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,499 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.499: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,499 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.499: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,499 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.499: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,499 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.499: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,499 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.499: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,500 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.500: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,500 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.500: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,500 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.500: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,500 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.500: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,500 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.500: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,501 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.501: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,538 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.538: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,540 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.540: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,540 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.540: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,542 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.541: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,542 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.542: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,543 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.543: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,543 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.543: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,543 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.543: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,543 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.543: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,543 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.543: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,544 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.544: g_content_type_is_a: assertion 'type != NULL' failed
于 2019-09-18T12:16:44.183 回答
5

解决方法参考链接: https ://github.com/msys2/MINGW-packages/issues/3673#issuecomment-476861638

什么对我有用:将 Meld/lib/libgirepository-1.0-1.dll 复制到一个文件夹中(Meld.exe 旁边)。

于 2020-01-11T03:24:25.930 回答