Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
probonopd opened this issue Dec 9, 2018 · 3 comments
Closed

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

probonopd opened this issue Dec 9, 2018 · 3 comments

Comments

@probonopd
Copy link

# 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
Copy link
Author

probonopd commented Dec 9, 2018

/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

@probonopd probonopd changed the title Wine Cleaning up Wine Cleaning up (/tmp/ld-linux.so.2`冲突的文件) Dec 9, 2018
@probonopd probonopd changed the title Wine Cleaning up (/tmp/ld-linux.so.2`冲突的文件) Wine Cleaning up (/tmp/ld-linux.so.2 冲突的文件) Dec 9, 2018
@Hackerl
Copy link
Owner

Hackerl commented Dec 9, 2018

如同 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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants