AppImageCommunity / pkg2appimage

Tool and recipes to convert existing deb packages to AppImage
http://appimage.org
MIT License
697 stars 215 forks source link

AppImage request: Emacs 25.1 #94

Closed fusion809 closed 8 years ago

fusion809 commented 8 years ago

Hi,

I'm afraid I don't know how to do this myself, but I think an Emacs 25.1 AppImage would be excellent. The GNU Project provides no official binaries for GNU Emacs. I suppose you could use the Fedora ≥24 Emacs RPMs, but it sounds a little complicated as Fedora splits Emacs into several subpackages.

Thanks for your time, Brenton

probonopd commented 8 years ago

Please request it from the GNU project. The AppImages I provide are just samples for upstream app authors.

That being said, this is the beginnings of a recipe:

APP=Emacs
LOWERAPP=emacs24 # ${APP,,}

mkdir -p ./$APP/$APP.AppDir/usr/lib

cd ./$APP/

wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
. ./functions.sh

generate_status

echo "deb http://archive.ubuntu.com/ubuntu/ trusty main universe
deb http://ppa.launchpad.net/ubuntu-elisp/ppa/ubuntu trusty main
" > sources.list

apt-get $OPTIONS update

URLS=$(apt-get $OPTIONS -y install --print-uris $LOWERAPP | cut -d "'" -f 2 | grep -e "^http")

wget -c $URLS

cd ./$APP.AppDir/

find ../*.deb -exec dpkg -x {} . \; || true

get_desktop
get_icon
get_apprun

delete_blacklisted
rm -rf ./etc/ ./home/ || true

# patch_usr
# Patching only the executable files seems not to be enough for some apps
find usr/ -type f -exec sed -i -e "s|/usr|././|g" {} \;

However it seems not to be working 100% correctly. This is where the authors would probably need to do some fine-tuning, and make Emacs relocateable so that the find usr/ -type f -exec sed -i -e "s|/usr|././|g" {} \; would be no longer needed.

fusion809 commented 8 years ago

I've managed to produce a working Recipe. The problem is that my Emacs AppImage keeps starting with a beep and an error shown in this screenshot:

Also shown in this screenshot is that there's no GNU Emacs welcoming screen. My exact Recipe is shown here. Hoping you'll have some ideas as to how to solve this problem. I have tried using the desktop integration wrapper script, but it didn't help.

probonopd commented 8 years ago

It seems not to be working 100% correctly. This is where the authors (of Emacs) would probably need to do some fine-tuning. Please request an AppImage from the GNU project. AppImages should be provided by the people who wrote the software, since they are the ones who know best how their software is supposed to work. I don't know how Emacs works.

fusion809 commented 8 years ago

I've sent an email to the help-debbugs mailing list asking how I can ask GNU Emacs developers to provide an AppImage of their own, no reply so far (granted I only sent it a couple of hours ago).

fusion809 commented 8 years ago

I've created a second Recipe that generates an AppImage (that seems to have no bugs so far, it doesn't have that startup bug I mentioned earlier) from the latest emacs-snapshot package in the Ubuntu-Elisp ppa. The only dilemma is how to generate a VERSION function that automatically determines the latest snapshot version for Xenial (packages for which all have 16.04 in their package name, if you need a test). I've seen some of your VERSION functions, and I was wondering if you have any ideas here too.

probonopd commented 8 years ago

Don't use Xenial packages as input for AppImages, since they are too new and the resulting AppImages cannot run on older distributions.

fusion809 commented 8 years ago

OK, thanks, well then for Trusty how would you generate a suitable VERSION function?

fusion809 commented 8 years ago

Turns out I can't use Trusty. Once the package is built running the AppImage gives the error:

out/emacs-snapshot-201609240437-x86_64.AppImage: ./lib/x86_64-linux-gnu/libgomp.so.1: version `GOMP_4.0' not found (required by
/usr/lib/libMagickWand-6.Q16HDRI.so.2)
out/emacs-snapshot-201609240437-x86_64.AppImage: ./lib/x86_64-linux-gnu/libgomp.so.1: version `GOMP_4.0' not found (required by
/usr/lib/libMagickCore-6.Q16HDRI.so.2)
out/emacs-snapshot-201609240437-x86_64.AppImage: ../lib/x86_64-linux-gnu/libgpg-error.so.0: no version information available (re
quired by /usr/lib/libgcrypt.so.20)
probonopd commented 8 years ago

Your recipe is wrong. Please follow the example in comment 2 more closely. Then the version can be calculated automatically.

zaxebo1 commented 8 years ago

with comment by @probonopd at https://github.com/probonopd/AppImageKit/issues/243#issuecomment-250090127 regarding "whether relocatable-ness of emacs binary is feature of emacs or not?" . I will like to point the relevant url, please see at http://unix.stackexchange.com/a/46864 which says that:


Emacs can be relocated mostly harmlessly, even if you don't take any precautions when compiling. If the hardcoded paths don't work, Emacs looks for directories near the executable.

Emacs tries to determine where the executable that invoked it is located. It stores this information in the variable invocation-directory. Let's say that this is /path/to/bin/emacs; Emacs looks for the data files it needs in the hard-coded directories, and falls back to directories in /path/to.

You need to structure your directories in the same way as the Emacs source, more or less, with toplevel directories bin, etc, leim, lib-src, lisp, site-lisp. In particular, at least with Emacs 23.2, the directory lib-src must exist (even if it's empty).

There are a few directories that Emacs doesn't find this way. Set the environment EMACSDATA=/path/to/etc. You may need to set INFOPATH as well.


probonopd commented 8 years ago

That sounds promising :-)

probonopd commented 8 years ago

Does not work for me:

me@host:~/Desktop/Emacs/Emacs.AppDir$ export EMACSDATA=/home/me/Desktop/Emacs/Emacs.AppDir/etc/ ; ./AppRun 
Warning: arch-dependent data dir (/usr/lib/emacs/23.4/x86_64-linux-gnu/) does not exist.
Warning: Lisp directory `/etc/emacs23' does not exist.
Warning: Lisp directory `/usr/local/share/emacs/23.4/site-lisp' does not exist.
Warning: Lisp directory `/usr/local/share/emacs/site-lisp' does not exist.
Warning: Lisp directory `/usr/share/emacs/23.4/site-lisp' does not exist.
Warning: Lisp directory `/usr/share/emacs/23.4/lisp' does not exist.
Warning: Lisp directory `/usr/share/emacs/23.4/leim' does not exist.
Error: charsets directory (/home/me/Desktop/Emacs/Emacs.AppDir/etc/charsets) does not exist.
Emacs will not function correctly without the character map files.
Please check your installation!
Warning: Could not find simple.el nor simple.elc
Cannot open load file: warnings

LISP?!

probonopd commented 8 years ago

Experimenting a bit on https://github.com/probonopd/AppImages/blob/master/recipes/meta/Emacs.yml - got a bit further but it still doesn't find some of its paths, e.g., to easymenu

probonopd commented 8 years ago

Seems to be working with some binary patching and this custom AppRun script: https://github.com/probonopd/AppImages/blob/master/recipes/meta/Emacs.AppRun

Recipe: https://github.com/probonopd/AppImages/blob/master/recipes/meta/Emacs.yml

AppImage (needs testing and refinement): https://bintray.com/probono/AppImages/Emacs/_latestVersion#files

zaxebo1 commented 8 years ago

I was away from town for sometime and today morning after getting back to home, i got this AppImage of emacs as mentioned above. Thanks for the great effort. as mentioned above, i tested it and giving the feedback below.

I downloaded the AppImage and ran it on ubuntu 16.04 . When ran , it gives the following error message and then crashed :

user1@machine-name1:~$   ./Emacs-2015072515+5e63841f2847b0b07cf15aed98c26fe914e9804a.glibc2.11-x86_64.AppImage 

**ls: cannot access 'usr/lib/emacs': No such file or directory
/bin/bash: /tmp/.mount_y89mws/lib/x86_64-linux-gnu/libtinfo.so.5: no version information available (required by /bin/bash)
/tmp/.mount_y89mws/usr/bin/emacs-snapshot: /tmp/.mount_y89mws/lib/x86_64-linux-gnu/libgpg-error.so.0: no version information available (required by /lib/x86_64-linux-gnu/libgcrypt.so.20)
Warning: arch-independent data dir '/tmp/.mount_y89mws/usr/share/emacs///etc/': No such file or directory
Warning: Lisp directory '/tmp/.mount_y89mws/usr/share/emacs///lisp': No such file or directory
Warning: Lisp directory '/tmp/.mount_y89mws/usr/share/emacs///lisp/emacs-lisp': No such file or directory
Error: charsets directory not found:
/tmp/.mount_y89mws/usr/share/emacs/etc/charsets
Emacs will not function correctly without the character map files.
The EMACSDATA environment variable is set, maybe it has the wrong value?
Please check your installation!**

But, on the same system AppImage of Atom editor and other appimage packages are running fine

probonopd commented 8 years ago

It is not finding the version number from the subdirectory of usr/lib/emacs - I will look into it. Thanks for reporting!

probonopd commented 8 years ago

Please retry now.

fusion809 commented 8 years ago

Although it is worthwhile mentioning, this AppImage is not Emacs 25.1, it's an older snapshot of emacs. Though of course, at this early stage in developing the AppImage, it might be necessary to use an older version of Emacs. I can't try it myself ATM as I've got some network connectivity issues.

probonopd commented 8 years ago

Please find me the most recent Emacs compiled for debian oldstable, Ubuntu trusty, or older.

With the one from http://ppa.launchpad.net/adrozdoff/emacs/ubuntu/pool/main/e/emacs25/ I get:

Broken emacs25:amd64 Depends on emacs25-bin-common [ amd64 ] < none -> 25.1-trusty~ppa2 > ( editors ) (= 25.1-trusty~ppa2)
fusion809 commented 8 years ago

What about the ubuntu-elisp PPA? It has packages for all supported Ubuntu releases, including Precise and Trusty https://launchpad.net/~ubuntu-elisp/+archive/ubuntu/ppa. Its releases are updated daily or so.

zaxebo1 commented 8 years ago

I tested the latest image, in the console mode emacs ( run using: ./Emacs.AppImage -nw ), it works good in the GUI mode emacs too(run using ./Emacs.AppImage ), it works good

But still in both cases, it still prints the following error message on screen:

user1@machine-name1:~$   ./Emacs-2015072515+5e63841f2847b0b07cf15aed98c26fe914e9804a.glibc2.11-x86_64.AppImage

/bin/bash: /tmp/.mount_jG4f9j/lib/x86_64-linux-gnu/libtinfo.so.5: no version information available (required by /bin/bash)
/tmp/.mount_jG4f9j/usr/bin/emacs-snapshot: /tmp/.mount_jG4f9j/lib/x86_64-linux-gnu/libgpg-error.so.0: no version information available (required by /lib/x86_64-linux-gnu/libgcrypt.so.20)
probonopd commented 8 years ago

These messages can safely be ignored as far as I know @zaxebo1 If you are annoyed by these messages you could try deleting these 2 libraries from inside the AppImage.

probonopd commented 8 years ago

To make the perfect AppImage, we might want to compile outselves - in order to reduce the insane amount of dependencies (e.g., ImageMagick which pulls in stuff down to WebKit GTK). Volunteers?

fusion809 commented 8 years ago

OK, you could use the Open Build Service to do this. Although, of course you could just upload the Deb binary to bintray instead.

zaxebo1 commented 8 years ago

To make the perfect AppImage, we might want to compile outselves - in order to reduce the insane amount of dependencies (e.g., WebKit GTK).

It will be great. Rather that it is the main usage. actually right now i am testing on a ubuntu system with ubuntu repository's Emacs already installed. If we tomorrow test on a KDE based distribution like KDE neon or opensuse with no emacs preinstalled, then we can NOT assume that Gtk, Webkit GTK is there on the KDE based distribution

zaxebo1 commented 8 years ago

additionally, If you want to rebuild it with emacs-lisp PPA too, as suggested in the comment by @fusion809 at https://github.com/probonopd/AppImages/issues/94#issuecomment-250960736 , then you may rebuild it too and i will test it

If you upload then Please keep both the versions on bintray (the currently build 25.0) and the emacs daily PPA too

but best is to compile Emacs by ourselves, as suggested above

probonopd commented 8 years ago

The version from ubuntu-elisp/ppa crashes for me right now.

you could use the Open Build Service to do this

Or Travis CI which I am using for everything else.

probonopd commented 8 years ago

Are there really that many new features that people need in the latest version that it would justifiy the effort?

zaxebo1 commented 8 years ago

oh yes. really yes Emacs 25.1 is just really very important, thats why i am dying to get it portably on my usb pen drive using AppImage

fusion809 commented 8 years ago

Yeah, for one it's got support for opening web pages.

zaxebo1 commented 8 years ago

also, people are asking/searching for emacs 25.1 prebuilt binaries since May 2016, due to its features http://emacs.stackexchange.com/questions/12772/prebuilt-ubuntu-emacs-25-1

probonopd commented 8 years ago
git clone git://git.savannah.gnu.org/emacs.git
cd emacs
sudo apt-get build-dep emacs24 # for rpm-based linux: sudo yum-builddep emacs
./configure                    # if there's no configure script: ./autogen.sh
make                           # if that fails: make bootstrap
sudo make install
make clean
fusion809 commented 8 years ago

That won't build a Debian binary though. Plus, it's a pain to uninstall afterwards.

zaxebo1 commented 8 years ago

A)

git clone git://git.savannah.gnu.org/emacs.git cd emacs

@probonopd i think with that above command of git as specified by you, it will give you latest git "in-development" sourcecode

But, For getting the 25.1 branch: 1) either git the relevant branch as specified at https://www.emacswiki.org/emacs/EmacsFromGit

2) or, download the 25.1 source code tarballs from https://ftp.gnu.org/gnu/emacs/ https://github.com/emacs-mirror/emacs/releases

B) also you need to use configure --prefix etc as specified at http://www.linuxfromscratch.org/blfs/view/svn/postlfs/emacs.html

C) But, it is important to have portable emacs AppImage on usb pen drive, which can run on KDE neon linux distribution and Ubuntu 16.04 and Fedora 24. Source compiling everywhere is not an option

probonopd commented 8 years ago

That won't build a Debian binary though. Plus, it's a pain to uninstall afterwards.

Not if you use the build artefacts to put together an AppImage :-)

probonopd commented 8 years ago

Who wants to help me on https://github.com/probonopd/Emacs.AppImage? Have put it there for experimentation for now.

zaxebo1 commented 8 years ago

Who wants to help

I really want to help, but i can't. Due to not having enough skill sets for this.

But i promise I shall return the debt (of effort,time in packing Emacs as AppImage), by packing/maintaining many other apps as AppImage , in Nov 2016; once i acquire those skills.

probonopd commented 8 years ago

Please try https://transfer.sh/15Uv1w/emacs-25.1-glibc2.17-x86-64.appimage

Calinou commented 8 years ago

Please try https://transfer.sh/15Uv1w/emacs-25.1-glibc2.17-x86-64.appimage

Just tested it on a mostly-fresh Antergos system (which is an Arch Linux derivative). The desktop integration pop-up works but I get an error about libselinux.so.1 being missing.

probonopd commented 8 years ago

I need to find a way to prevent libselinux from being compiled in...

probonopd commented 8 years ago

Try the new one: https://transfer.sh/9ESIT/emacs-25.1-glibc2.17-x86-64.appimage Built without selinux support in Emacs, but some of the dependency libs might still pull it in. There is no way around it short of recompiling all of them, too, or bundling libselinux. I don't have the time for that. If someone is interested in taking over, let me know.

Calinou commented 8 years ago

Try the new one: https://transfer.sh/9ESIT/emacs-25.1-glibc2.17-x86-64.appimage

This one works.

zaxebo1 commented 8 years ago

the above binary works fine on ubuntu 16.04 successfully

with respect to my comment at https://github.com/probonopd/AppImages/issues/94#issuecomment-250960776 , now in this new latest binary - error message for libgpg-error.so is NOT coming, now only libtinfo.so.5 related single error is coming. I ignore this error message as you suggested.

zaxebo1 commented 8 years ago

tomorrow i will test on some KDE based distribution and give the feedback

fusion809 commented 8 years ago

For me on Ubuntu 16.04.1 with the Trinity desktop environment R14.0.3 your (@probonopd) latest AppImage failed. It gave the output:

/bin/bash: /tmp/.mount_0ZGRNQ/lib/x86_64-linux-gnu/libtinfo.so.5: no version information available (required by /bin/bash)

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:74:16: 'outline-radius' is not a valid property name

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:95:4: Missing name of pseudo-class

(...)

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:2799:11: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:2809:20: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:2811:22: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:2813:22: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:3135:23: No property named '-gtk-icon-transform'

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:3325:148: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:3329:58: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:3343:180: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:3347:72: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:3349:46: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:3354:86: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:3360:58: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:3407:79: Missing name of pseudo-class

(emacs:23054): Gtk-WARNING **: Theme parsing error: gtk.css:3412:99: Missing name of pseudo-class
Undefined color: "WINDOW_FOREGROUND"

(edited for brevity)

probonopd commented 8 years ago

Undefined color: "WINDOW_FOREGROUND" which prevents this from running seems to be an issue with Emacs on non-GNOME desktops: https://bugzilla.redhat.com/show_bug.cgi?id=1053891 Apparently this needs to be fixed in the desktop environment(s) or in X11: https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-01/msg00836.html

zaxebo1 commented 8 years ago

solution is stated at http://www.spinics.net/lists/trinity-users/msg00160.html @fusion809 can you try it ?

fusion809 commented 8 years ago

Shall do when I go back to my Trinity machine, but for now I'm on Arch Linux and just gave this AppImage a try and well it launches fine and it doesn't seem to have any major defects but it does have a little graphical bug with its GTK+ menubar. screenshot_20161003_221332

My GTK+ 3 theme is Adwaita, so I don't think it's at fault for this bug. Maybe compile Emacs against GTK+ 2 instead? That might make the menubar more reliable.

probonopd commented 8 years ago

Try https://transfer.sh/14u8jA/emacs-25.1-glibc2.17-x86-64.appimage

fusion809 commented 8 years ago

'tis perfect. screenshot_20161004_010955