修复在CentOS 7上使用wine运行应用失败的问题

修复 在CentOS 7上使用wine运行应用失败的问题

起因

CentOS 7 上安装 wine以后运行Navicat 报错
bad-exe-format
无法运行 但在Ubuntu上运行成功
主要原因是epel中未有32位版本的wine

分析

首先得知 wine是通过epel安装的
翻看官方文档 官方是说epel里面只有对64位支持 无32位的支持

For the same reasons that a functional wine package in EPEL 7 is still a no-go, it used to be a labyrinth trying to build wine on CentOS 7. The same lack of 32-bit libraries mentioned above is still a potential obstacle. Fortunately, most of the necessary libraries are part of the CentOS base repository, so with the 32-bit release of CentOS 7, only a few extra libraries need to be built manually.
对于32位的支持需要手动构建一些库
且官方文档中说明 64位的wine只能运行64的application 如果 64位的应用调用了32位的库 需要安装32位的wine
64-bit Wine runs only on 64 bit installations, and so far has only been extensively tested on Linux. It requires the installation of 32 bit libraries in order to run 32 bit Windows applications. Both 32-bit and 64-bit Windows applications (should) work with it; however, there are still many bugs .
所以怀疑是没有32位的支持 而Navicat调用了32位的库应用的导致了无法解析格式

解决方案

Build 一个32位的 wine 用32位的运行
https://wiki.winehq.org/Building_Wine
Build 需要时间过长
GitLab上有现成的打包好的RPM 直接安装进去即可

1
2
3
4
# Install repos
sudo yum -y install epel-release https://harbottle.gitlab.io/wine32/7/i386/wine32-release.rpm
# Install Wine 64 bit and 32 bit
sudo yum -y install wine wine.i686

Asianux系统中 源会缺失一些包会出现一些依赖问题 如下面所示
原因是因为red-flag源中没有提供wine.i686需要的32位库 所以就会导致安装失败 这时候就需要手动换源进行处理

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Error: Package: wine-core-4.0-2.el7.i686 (wine32)
Requires: libpcap(x86-32)
Error: Package: wine-core-4.0-2.el7.i686 (wine32)
Requires: libXinerama(x86-32)
Error: Package: wine-core-4.0-2.el7.i686 (wine32)
Requires: libgstbase-1.0.so.0
Error: Package: wine-core-4.0-2.el7.i686 (wine32)
Requires: libgphoto2_port.so.12(LIBGPHOTO2_5_0)
...
Error: Package: wine-core-4.0-2.el7.i686 (wine32)
Requires: libxml2.so.2(LIBXML2_2.6.14)
Error: Package: wine-core-4.0-2.el7.i686 (wine32)
Requires: libgphoto2_port.so.12
Error: Package: wine-core-4.0-2.el7.i686 (wine32)
Requires: libxml2.so.2(LIBXML2_2.5.7)

#blog