Hackerl / Wine_Appimage

Appimage For Wine
480 stars 69 forks source link

Wine Cleaning up (/tmp/ld-linux.so.2 冲突的文件) #21

Closed probonopd closed 5 years ago

probonopd commented 5 years ago
# My system
me@host:~$ cat /etc/os-release 
NAME="KDE neon"
VERSION="Developer Edition"
ID=neon
ID_LIKE="ubuntu debian"
PRETTY_NAME="KDE neon Developer Edition"
VERSION_ID="18.04"

# Trying to run WeChat
me@host:~$ Downloads/Wechat-x86_64.AppImage 
I require wine.
You can download Wine-x86_64.AppImage from https://github.com/Hackerl/Wine_Appimage/releases.
Then run: chmod 777 $(pwd)/Wine-x86_64.AppImage; sudo ln -s $(pwd)/Wine-x86_64.AppImage /usr/bin/wine

me@host:~$ sudo ln -s /home/me/Wine-x86_64.AppImage /usr/bin/wine

# WINE does not work
me@host:~$ wine
Wine Cleaning up

# WeChat does not work
me@host:~$ Downloads/Wechat-x86_64.AppImage 
Wine Cleaning up
Cleaning up
probonopd commented 5 years ago

/tmp/ld-linux.so.2 already exists because I am running my own QQ AppImage. Wine AppImage should use another path. Better, solve the root cause: https://www.winehq.org/pipermail/wine-devel/2017-November/119944.html

/tmp/ld-linux.so.2已经存在,因为我正在运行自己的QQ AppImage。 Wine AppImage应该使用另一条路径。 更好,解决根本原因: https://www.winehq.org/pipermail/wine-devel/2017-November/119944.html

Hackerl commented 5 years ago

如同 issus 11 所说。 ld.so是由preloader中的map_so_lib函数手动加载的,所以只需要修改一下preloader对环境变量的支持即可。

    map_so_lib( argv[1], &main_binary_map );

    /* load the ELF interpreter */
    interp = (char *)main_binary_map.l_addr + main_binary_map.l_interp;
    map_so_lib( interp, &ld_so_map );

修改为:

    map_so_lib( argv[1], &main_binary_map );

    /* load the ELF interpreter */
    interp = (char *)main_binary_map.l_addr + main_binary_map.l_interp;
    char fullpath[256] = {};
    wld_memset(fullpath, 0, sizeof(fullpath));
    if (rootpath != NULL)
        wld_strcat(fullpath, rootpath);
    wld_strcat(fullpath, interp);
    map_so_lib( fullpath, &ld_so_map );

具体参考 Commit

AppRun修改为:

#!/bin/bash
HERE="$(dirname "$(readlink -f "${0}")")"

export LD_LIBRARY_PATH="$HERE/usr/lib":$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="$HERE/usr/lib/i386-linux-gnu":$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="$HERE/lib":$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="$HERE/lib/i386-linux-gnu":$LD_LIBRARY_PATH

#Sound Library
export LD_LIBRARY_PATH="$HERE/usr/lib/i386-linux-gnu/pulseaudio":$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="$HERE/usr/lib/i386-linux-gnu/alsa-lib":$LD_LIBRARY_PATH

#LD Root Path
export LINUXFILEROOT="$HERE"

"$HERE/lib/ld-linux.so.2" "$HERE/bin/wine" "$@" | cat

我已经测试成功,之后会打包文件。


As issus 11 said. Ld.so is manually loaded by the map_so_lib function in the preloader, so you only need to modify the preloader support for environment variables.

    Map_so_lib( argv[1], &main_binary_map );

    /* load the ELF interpreter */
    Interp = (char *) main_binary_map.l_addr + main_binary_map.l_interp;
    Map_so_lib( interp, &ld_so_map );

change into:

    Map_so_lib( argv[1], &main_binary_map );

    /* load the ELF interpreter */
    Interp = (char *) main_binary_map.l_addr + main_binary_map.l_interp;
    Char fullpath[256] = {};
    Wld_memset(fullpath, 0, sizeof(fullpath));
    If (rootpath != NULL)
        Wld_strcat(fullpath, rootpath);
    Wld_strcat(fullpath, interp);
    Map_so_lib( fullpath, &ld_so_map );

Specific reference Commit

AppRun is modified to:

#!/bin/bash
HERE="$(dirname "$(readlink -f "${0}")")"

Export LD_LIBRARY_PATH="$HERE/usr/lib":$LD_LIBRARY_PATH
Export LD_LIBRARY_PATH="$HERE/usr/lib/i386-linux-gnu":$LD_LIBRARY_PATH
Export LD_LIBRARY_PATH="$HERE/lib":$LD_LIBRARY_PATH
Export LD_LIBRARY_PATH="$HERE/lib/i386-linux-gnu":$LD_LIBRARY_PATH

#Sound Library
Export LD_LIBRARY_PATH="$HERE/usr/lib/i386-linux-gnu/pulseaudio":$LD_LIBRARY_PATH
Export LD_LIBRARY_PATH="$HERE/usr/lib/i386-linux-gnu/alsa-lib":$LD_LIBRARY_PATH

#LD Root Path
Export LINUXFILEROOT="$HERE"

"$HERE/lib/ld-linux.so.2" "$HERE/bin/wine" "$@" | cat

I have tested it successfully and will package the file later.

probonopd commented 5 years ago

让我很开心。非常感谢你的工作。 Making me really happy. Thank you very much for your work.