Friday, June 7, 2013

Install emacs on Solari (SunOS) without root

Finally... done installing emacs on Solari without root -- really a painful process, so I decide to write this down and hopefully it can be helpful for people in same needs.


Normally, on a Unbuntu machine, install emacs without root would be easy. Suppose we want to install it in /home/xxx/emacs folder

1. Download the emacs source from http://www.gnu.org/software/emacs/ and untar the source to a folder

2. Go to the emacs source folder, run

    ./configure --prefix=/home/xxx/emacs
  make all
  make install

    in which --prefix=/home/xxx/emacs in configure command tells emacs to install everything to that folder.

3. Finally, add /home/xxx/emacs/bin to your PATH, done.

Simple and easy, right?


However, on Solari, everything got complicated (at least for me, a guy who first time use Solari), let me list the problems I encountered during the each step numbered above

1. First problem I find is that, "tar xzvf" is not working on Solari...
    Solution: use "gtar xzvf" instead

2. In the second step, first small problem is ./configure fails and says please add "--with-gif=no" option, that's  easy, just do it.

    The true problem comes when I find that typing gcc or make in terminal would result in "command not found"
    Solution: gcc is in /usr/sfw/bin or /usr/local/bin, make is in /usr/ccs/bin, add those three directory to PATH.
    Or, you can go to /usr and run
     find . -name gcc
  find . -name make
    to figure out where are those binaries then add it to PATH

    With PATH set properly, I try to make and install emacs 24.3, everything goes well. But after installing, when I try to run emacs, it won't boot and pop out an error message:
     Fatal error 6
     It turns out that the newest emacs 24 has some problem when running on older system (I don't remember the exact reason, something like emacs 24 does not support old version lisp)
     Solution: download emacs 23 instead, for me I used emacs 23.4

     Then repeat the same process. This time during make install, an error occurs:

chmod -R a+r /home/ding34/emacs/share/emacs/23.4/leim
for installuser in ${LOGNAME} ${USERNAME} ${USER} \
  `id -un 2> /dev/null`; do \
  [ -n "${installuser}" ] && break ; \
done ; \
find /home/ding34/emacs/share/emacs/23.4/leim -exec chown ${installuser} '{}' ';'
*** Error code 2
make: Fatal error: Command failed for target `install'
Current working directory /l/mobilityhome/ding34/emacs/tar/emacs-23.4/leim
*** Error code 1

     It turned out that the error is from the line
for installuser in ${LOGNAME} ${USERNAME} ${USER} \
  `id -un 2> /dev/null`; do \
     in leim/Makefile.
     The reason is the "id" command has different syntax on Solari compared to on Unbuntu, run "id -un 2" and it will tell you "id: illegal option -- u". Since the id command fails, the make will consider it as an error, report it, and exit.
     Solution: delete `id -un 2> /dev/null` part in the leim/Makefile, and re-run make install

     With one afternoon and one morning's effort, finally I got our lovely emacs working.

     Oh, one more thing, don't forget to put the emacs binary directory (which is /home/xxx/emacs/bin) into PATH!


     -----------------------
     Set up PATH:
     Edit ~/.bash_profile file (create it if it does not exist), and put all the export statement in it. It will take effect when you launch terminal next time. (So for the current terminal, you may still need to manually run export to set up PATH)

2 comments: