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 inside an AppImage: can I enable 32-bit architecture for 64-bit apps? #361

Open
alexgleason opened this issue Feb 23, 2017 · 12 comments

Comments

@alexgleason
Copy link

alexgleason commented Feb 23, 2017

Wine requires 32-bit libs in order to run, even if I'm trying to run a 64-bit Windows application. I've gotten my Wine application working perfectly in an AppImage, except it needs libc6:i386 to be installed on the local machine (which kind of defeats the purpose of having one app that "just works").

I'm wondering if I can bundle libc6:i386 into the appimage itself. So far I've had no such luck. Copying in the files from the package into the appimage still leaves me with:

./bin//myapp: line 4: ../bin/wine: No such file or directory

(^ Classic error message when architecture of the file isn't supported)

If anyone has ideas I'd appreciate it. Been stuck on this for hours.

@probonopd
Copy link
Member

probonopd commented Feb 23, 2017

This is tough. You basically would have to ship your own ld-linux.so. See
https://joeyh.name/blog/entry/completely_linux_distribution-independent_packaging/ and AppImageCommunity/pkg2appimage#84

That being said,

Wine requires 32-bit libs in order to run, even if I'm trying to run a 64-bit application.

Looks like they found a way to do without 32-bit libs (don't know how):
https://download.teamviewer.com/download/version_11x/teamviewer_qs.tar.gz

You could also check what they are doing:
https://www.codeweavers.com/products/crossover-linux/download

@probonopd
Copy link
Member

Skype and Steam would also benefit from this.

@alexgleason
Copy link
Author

alexgleason commented Feb 24, 2017

I've tried including a 32-bit ld-linux.so inside of the AppImage. It's not affecting the ability to run 32-bit ELF files in the AppImage. I'm wondering if there's something else that needs to be configured on the system to allow this to work.

On Ubuntu, you basically just need to install the package libc6:i386 for 32-bit ELFs to work. But I'm perplexed that I can't just unpack libc6 into the AppImage (it includes ld-linux.so) and have that work. I'm wondering if the package does something else to the system. I've been reading the postinst and preinst scripts in the package and not finding what I need. It's like magic to me. But I don't fully understand how this works.

Thank you for the links. TeamViewer isn't using AppImage so I can't inspect how they're doing it (it doesn't mount a directory in /tmp and appimagetool doesn't find a squashfs image). I agree with the concepts in the article, so now it's just a matter of executing those concepts.

Packaging Wine software with AppImages could make Linux so much more viable for people looking to switch. Their favorite Windows program can be downloaded and launched in a single click... even more simple than what happens on Windows. I hope we can figure this out.

@wwderw
Copy link

wwderw commented Feb 24, 2017

Packaging Wine software with AppImages could make Linux so much more viable for people looking to switch. Their favorite Windows program can be downloaded and launched in a single click... even more simple than what happens on Windows. I hope we can figure this out.

I hope so to. I've been trying to use the scripts that are in the Portable Linux Games with no avail.

I never could figure out the path to the user (I don't think it's talking about the .wine directory in the home folder (and another user asked that question that was never answered from a year ago), which was the only thing showing up in searches, but I also it was a portable Windows app as well. Well, almost portable, it had 3 files that needed to be in the same directory. So never could figure that out.

I have several programs that I know work in Wine 1.6, that if I could get working in the Appimage that would be great as not all computers that I have Linux on, I want to have Wine running on as well.

@probonopd
Copy link
Member

But I'm perplexed that I can't just unpack libc6 into the AppImage (it includes ld-linux.so) and have that work.

Despite its (confusing) name, ld-linux.so is not a dynamic library but an executable. Hence, it must be explicitly called. It is reponsible for loading the shared libraries. Unfortunately, it has hardcoded absolute paths (in /usr and /lib) which makes it actively hard to have ld-linux.so relocateable (=working from changing paths in the filesystem). Possibly we'd need to patch it, or use something like http://bitwagon.com/rtldi/rtldi.html.

Check http://joeyh.name/blog/entry/completely_linux_distribution-independent_packaging/ for more information.

TeamViewer isn't using AppImage so I can't inspect how they're doing it (it doesn't mount a directory in /tmp and appimagetool doesn't find a squashfs image).

Apparently they manage to run Wine without 32-bit libs. If we understand how this works, we can do it, too. Putting all of this into an AppImage in the end shouldn't be a problem. Remember an AppImage is just a self-mounting filesystem that executes whatever payload you put into it.

I've been trying to use the scripts that are in the Portable Linux Games with no avail.

Which particular part of https://github.com/RazZziel/PortableLinuxGames/wiki/Creating-appimages-from-windows-applications are you having problems with? Maybe @RazZziel can help.

@wwderw
Copy link

wwderw commented Feb 24, 2017

Which particular part of https://github.com/RazZziel/PortableLinuxGames/wiki/Creating-appimages-from-windows-applications are you having problems with? Maybe @RazZziel can help.

It's path to WINE's user directory, that I can't find out what it is. The only thing that Google comes up with is the .wine directory in Home, which it doesn't sound like that's the right one. At least based on the example that was given in that repository.

I'm not the only one that has that question. That is actually the last issue posted in that very repository that hasn't been answered (at least not publicly), for close to a year now. A year in August.

Until I know what to do there, I don't know if everything else that I'm doing is correctly. It visually looks correct (as far as what the scripts generate), but I can't be sure. I know it doesn't work, but I don't know if it's because I don't know that one step or if it's that step plus another one (or more) that I'm missing.

The only other thing that I would have a question is that one my my Windows programs is a self enclosed program itself. If you wanted the help file, you have to have a second file in the same directory, but otherwise it is a single EXE file as well. I didn't see anything to handle those. It all seems to be ones that still do the more "traditional" install.

I had contemplated of just having an AppImage of WINE itself and then chmod that and try to install the programs that I wanted from that point, but I didn't have much luck with that either. I'm sure there is something that I'm missing and probably rather simple.

@probonopd
Copy link
Member

probonopd commented Feb 24, 2017

WINE's usr/ directory is not the same as "user directory", $HOME/.wine/

@probonopd
Copy link
Member

@wwderw is your Windows application available for download?

@wwderw
Copy link

wwderw commented Feb 24, 2017

WINE's usr/ directory is not the same as "user directory", $HOME/.wine/

That's what I was figuring based on the example, but that example only had something like /path/to/Wine user/directory and I couldn't find anything to give me an idea of where to look. It all seemed to be about the .wine directory.

@wwderw is your Windows application available for download?

Not anymore as far as I'm aware of. It's a 17 yr old program from the good ole 9x days.

@probonopd
Copy link
Member

Please check (and contribute to) https://github.com/AppImage/AppImageKit/wiki/Bundling-Windows-applications. It covers the 32-bit problem in detail.

Particularly, with other programs it is usually possible to manually load the 32-bit
ELF file with a private, bundled version of ld-linux.so.2 like so:

wget -c http://security.ubuntu.com/ubuntu/pool/main/g/glibc/libc6-i386_2.24-9ubuntu2.2_amd64.deb
dpkg -x ./libc6*.deb .

HERE="$(dirname "$(readlink -f "${0}")")"

WINEPREFIX="$HERE/wineprefix/" \
"$HERE/lib32/ld-linux.so.2" --library-path "$HERE/lib32"
"$HERE/wine-stable/bin/wine" \
"$WINEPREFIX/drive_c/Program Files/App/App.exe" "$@"

However, with WINE, this does not work. My guess is that WINE launches
other WINE instances through other mechanisms in the background, which
in turn don't get loaded using the specified
"$HERE/lib32/ld-linux.so.2" and --library-path "$HERE/lib32".

WINE developer Alexandre Julliard answered on wine-devel:

It's not possible in standard Wine, but you could probably hack
wine_exec_wine_binary() in libs/wine/config.c to add your special magic.

🚧 This needs to be done. We would highly welcome contributions.

In the meantime, we may get around this limitation by placing a symlink to our custom ld-linux.so.2 at a fixed location such as /tmp, but it is an ugly hack.

Please see https://github.com/AppImage/AppImageKit/wiki/Bundling-Windows-applications. The information on this page reflects ongoing research. We would appreciate your experimentation and contributions. Feel free to edit the page or reach out to us in #AppImage on irc.freenode.net.

@pirate486743186
Copy link

pirate486743186 commented Dec 2, 2018

have you tried fakechroot?
Never mind. It can't deal with /lib/ld-linux.so.2

@probonopd
Copy link
Member

Yes, it now can be done. @Hackerl has just created the missing piece at Hackerl/Wine_Appimage#11.

Contact me if you need more information.

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

4 participants