Windows子系统Ubuntu或虚拟机Ubuntu通过编译源码的方式安装wine8.0.1

发布时间 2023-07-15 11:19:59作者: 木人草

wine源码编译安装

下载源码

源码链接为:wine源码
本文以8.1.1版本为例,下载的源码包为:wine-8.11.tar.xz

拷贝包到Ubuntu

使用xftp或其他工具,将压缩包拷贝到ubuntu下的home/$username/目录

解包

tar -Jxf wine-8.11.tar.xz	// xz格式的包

tar -xvf your_tar_file.tar	// tar格式的包

准备工作

若在64位系统编译32位程序,需要启用i386架构,且GCC安装32位所需的环境,以下是启用i386架构:

sudo dpkg --add-architecture i386
sudo apt-get update

安装以下依赖包:

sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install libx11-dev:i386	//X 32位开发文件
sudo apt-get install libfreetype6-dev:i386	//FreeType开发文件

编译

进入到源代码的目录

cd /home/$USER/wine-8.11

然后

./configure --enable-win32 	//如果想编译64位,则为win64,如果提示缺少某种依赖包,根据提示安装就是了
make 
make install 

如果想指定编译后的文件存放路径:

./configure --prefix=/path/to/installation/directory --enable-win32

如果编译遇到:
error: FreeType 32-bit development files not found. Fonts will not be built.
Use the --without-freetype option if you really want this.

那么可以使用--without-freetype选项来编译,以跳过字体的构建。

./configure --without-freetype	--enable-win32

编译安装参考:https://tecadmin.net/install-wine-centos8/


另外,wine如果安装的是64位,只能运行64位的windows程序,如果想兼容32位程序,需要先编译64位,然后再编译32位(指定编译路径到64位那个目录),可参考:
https://wiki.winehq.org/Building_Wine#Shared_WoW64

非编译安装wine

参考:https://blog.csdn.net/ymz641/article/details/129110605