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

⚙️ Portable rootless xonsh build on AppImage #3357

Closed
wants to merge 6 commits into from
Closed

⚙️ Portable rootless xonsh build on AppImage #3357

wants to merge 6 commits into from

Conversation

anki-code
Copy link
Member

@anki-code anki-code commented Oct 15, 2019

AppImage is a format for distributing portable software on Linux without needing superuser permissions to install the application. It tries also to allow Linux distribution-agnostic binary software deployment for application developers, also called Upstream packaging.

AppImage allows xonsh to be run on any AppImage supported Linux distributive without installation and root access.

asciicast

Try it now

You can download and try prebuilded xonsh.AppImage:

wget https://github.com/anki-code/appimage-xonsh/raw/master/xonsh-x86_64.AppImage && chmod +x xonsh-x86_64.AppImage
./xonsh-x86_64.AppImage
./xonsh-x86_64.AppImage --help

Build xonsh.AppImage

Let's start:

  1. Run docker with fuse:
sudo docker run --rm -it --privileged --device /dev/fuse -v `pwd`:/appimage ubuntu:16.04 bash
  1. Install libraries for future building:
apt update -y && apt upgrade -y
apt install -y fuse wget mc \
	build-essential python-dev python-setuptools python-pip python-smbus \
	libncursesw5-dev libgdbm-dev libc6-dev  \
	zlib1g-dev libsqlite3-dev tk-dev \
	libssl-dev openssl \
	libffi-dev autoconf libfuse-dev

Not all required. Feel free to clean.

  1. Getting the build scripts based on linuxdeploy plugin python:
mkdir -p /appimage && cd /appimage
wget https://github.com/anki-code/linuxdeploy-plugin-python/archive/entrypoint.zip -O linuxdeploy-plugin-python-entrypoint.zip
unzip linuxdeploy-plugin-python-entrypoint.zip

Here we see downloading of entrypoint branch from anki-code/linuxdeploy-plugin-python because the origin niess/linuxdeploy-plugin-python repository has not yet accepted the pull request with xonsh.

  1. Building:
cd linuxdeploy-plugin-python-entrypoint/appimage
./build-python.sh xonsh
ls -l

As result you'll find executable file xonsh-x86_64.AppImage that runs xonsh and can take command line arguments like xonsh:

# ./xonsh-x86_64.AppImage -c "echo @(1+1)"
2

Enjoy!

Troubleshooting

GLIBs versions

You can noticed that we build AppImage in docker with older version of Ubuntu (16.04) to avoid error with core libraries versions when binary compiled on modern version can't use older version of libraries. In this nasty case you can see the error like /xonsh-x86_64.AppImage: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.25 not found (required by /ppp/xonsh-x86_64.AppImage). This means you should rebuild the AppImage for older version of distributive. If you know how to fix it once and forever feel free to tell us.

Windows Subsystem for Linux (WSL)

Need WSL support:

wsl$ ./xonsh-x86_64.AppImage
fuse: device not found, try 'modprobe fuse' first

Cannot mount AppImage, please check your FUSE setup.
You might still be able to extract the contents of this AppImage
if you run it with the --appimage-extract option.
See https://github.com/AppImage/AppImageKit/wiki/FUSE
for more information
open dir error: No such file or directory

Workaround is extracting appimage and run manually:

wsl$ ./xonsh --appimage-extract
wsl$ ./squashfs-root/usr/bin/python3.7

@anki-code
Copy link
Member Author

anki-code commented Oct 15, 2019

@scopatz @adqm @melund @gforsyth

  • please use this PoC to build AppImage in regular basis and add it to AppImage Hub and AppImages list
  • please review the xonsh recipe to check that appropriate packages and libs are included

@probonopd tag you just for info and your fun :)

And many thanks to @niess for linuxdeploy-plugin-python

@anki-code anki-code changed the title Portable rootless xonsh build on AppImage ⚙️ Portable rootless xonsh build on AppImage Oct 15, 2019
@scopatz
Copy link
Member

scopatz commented Oct 15, 2019

Thanks for this @anki-code! This is really neat to see! Can you maybe make the gif into an asciinema instead, so it can be hosted elsewhere and not go into the repo. Then please open up another branch and copy the doc file in. You can use the rST .. raw directive to include the embed code for the asciinema

@scopatz scopatz added the docs label Oct 15, 2019
@anki-code anki-code mentioned this pull request Oct 15, 2019
@anki-code
Copy link
Member Author

@scopatz please review #3358 :)

@scopatz
Copy link
Member

scopatz commented Oct 17, 2019

Thanks again!

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

Successfully merging this pull request may close these issues.

None yet

2 participants