习惯性地更新了Archlinux所有软件包,发现Navicat无法运行了。命令行运行报错如下:

symbol lookup error: /usr/lib/libgio-2.0.so.0: undefined symbol: g_module_open_full

网上查到libgio-2.0.so.0glib2包的文件,显然是版本不兼容了。考虑到AppImage本质上就是把各依赖库打包起来做成了便携应用,便考虑把老版本的glib2打包进应用镜像,结果完美解决。

把glib2 2.68.4打包到应用镜像里

这是我在Archlinux论坛的回复,懒得翻译了,内容如下。

Solution: Patch glib2 version 2.68.4 into appimage

Steps:

  1. Extract appimage file. All files will be in a directory called squashfs-root

    your-path/navicat15-premium-en.AppImage --appimage-extract
    

    Tips: When extracting ends in error as follow, you can try to mount appimage file then copy app source to directory squashfs-root.

    ./navicat15-premium-en.AppImage –appimage-extract qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 471, resource id: 12928710, major code: 40 (TranslateCoords), minor code: 0 /tmp/.mount_whnQrp/AppRun: symbol lookup error: /usr/lib/libgio-2.0.so.0: undefined symbol: g_module_open_full

    # create app source mount point
    mkdir src
    # mount appimage file(read only)
    sudo mount -o loop your-path/navicat15-premium-en.AppImage src
    # copy all source file(writable)
    cp -r src squashfs-root
    # umount appimage file
    sudo umount src
    rmdir src
    
  2. Find your glib2-2.68.4-1-x86_64.pkg.tar.zst package file. If you are lucky enough, there will be one in path /var/cache/pacman/pkg/glib2-2.68.4-1-x86_64.pkg.tar.zst. Or download it from package repository. Or anywhere.

    https://archive.archlinux.org/packages/g/glib2/glib2-2.68.4-1-x86_64.pkg.tar.zst
    
  3. Extract glib2-2.68.4-1-x86_64.pkg.tar.zst to squashfs-root

    tar xvf glib2-2.68.4-1-x86_64.pkg.tar.zst -C squashfs-root
    
  4. Repack squashfs-root into appimage file

    appimagetool squashfs-root navicat15-premium-en-patched.AppImage
    
  5. no more steps, just run it

参考文章