Skip to content

Rough Book

random musings

Menu
  • About Me
  • Contact
  • Projects
    • bAdkOde
    • CherryBlossom
    • FXCalendar
    • Sulekha
Menu

An update to running aterm (or any other X app) rootless, without a DOS console on Cygwin

Posted on March 29, 2009November 20, 2009 by vivin

A while ago, I wrote up a quick guide about running X/Windows applications (specifically, aterm) without root windows on Windows, using Cygwin. Recently I tried to set it up again and I realized that some of the information is slightly out of date. I'm also endeavoring to write a better guide. I'm assuming that you have, at the very least, a decent understanding of building things from source. The process under Cygwin is pretty much the same as under any other *nix, but there are a few quirks. On the whole, it's a whole lot easier than it used to be. This guide is primarily geared towards running aterm with a transparent background on a windows machine so that you can have a decent client for the Cygwin commandline, instead of the crappy Windows one.

I'm assuming that you already have Cygwin installed. If you don't, you can get it from here. In addition to whatever other packages you have selected to customize your install, you also need development packages (gcc and friends), Xorg packages (headers, includes, and libraries), and a few graphics libraries (for aterm):

  • Devel
    • gcc-core
    • gcc-g++
    • libXaw3d-devel (for xv)
    • libjpeg-devel (for aterm)
    • libpng12-devel (for aterm)
  • Libs
    • jpeg (for aterm)
    • libXaw3d-devel
    • libXaw3d-7
    • libfreetype6
    • libjpeg-devel
    • libjpeg62 (for aterm)
    • libjpeg6b (for aterm)
    • libpng12 (for aterm)
    • libpng12-devel (for aterm)
    • libtiff5 (for aterm, xv)
    • zlib-devel (for aterm)
    • zlib0 (for aterm)
  • Utils
    • bzip2 (to handle .bz2 files)
  • X11
    • libX11-devel
    • xinit
    • xsetroot (if xv doesn't work for you)

After Cygwin finishes installing those packages, grab the sources for libAfterImage, aterm, and xv. Unpack the sources perform the requisite steps to build and install from source (./configure, make, and make install should work if all goes well).

libAfterImage:

If you get "parse error before XErrorEvent" errors while building libAfterImage, make sure that you didn't forget to select the X11 development package.

aterm:

gcc on Cygwin expects --rdynamic and not -rdynamic. If you're seeing these errors, edit the Makefiles under src and src/graphics within the aterm source directory. Change the "-rdynamic" to "--rdynamic". The changes should be on line 54 for both files.

xv:

Under the tiff directory within the xv sources, there is a file called RANLIB.csh. Edit this file and make sure that you ONLY have the following line in there:

[sourcecode]
ranlib $1 >& /dev/null
[/sourcecode]

Otherwise the build process will fail. Additionally, you need to edit xv.h. This file lives right at the root of your xv source directory. If you do not perform the following change, you'll get errors from gcc complaining that "sys_errlist has previously been defined". Change line 119 of xv.h to:

[sourcecode]
/*extern char *sys_errlist[]; */ /* this too... */
[/sourcecode]

What you're doing is commenting out the definition for sys_errlist so that it doesn't conflict with what has already been defined in the Cygwin header files. These changes should be the only ones you need to get xv compiling and running.

Now you need to set up two batch files. One to start up X rootlessly, and another to start up aterm. Before you do that, make sure you add C:\cygwin\usr\bin and C:\cygwin\X11R6\usr\bin to your PATH variable. You can do this by going to My Computer > Properties > Advanced > Environment Variables. If you don't do this, you'll get "cygwin1.dll not found" errors while trying to run these batch files. The X windows binaries used to live in C:\cygwin\usr\X11R6\bin, but have since been moved to C:\cygwin\usr\bin. Therefore, the start-up batch-file now looks like this:

xwin.bat:
[sourcecode]
C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\usr\bin\xwin.exe -multiwindow -clipboard -silent-dup-error
C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\usr\local\bin\xv.exe -display :0 -root -quit -be -max /cygdrive/c/Documents\ and\ Settings/vivin/My\ Documents/My\ Pictures/Wallpapers/01707_spectrumofthesky_1920x1200.jpg
[/sourcecode]

The first line starts up the X windowing system. The second line sets the wallpaper using aterm. You now need another batch file to run aterm, and that looks like this:

aterm.bat
[sourcecode]
C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\bin\bash.exe --login -i -c "aterm -sh 80 -tr -trsb -fade 20 -tint gray -sb -st -sr -sl 1000 -tn xterm"
[/sourcecode]

This file starts aterm with the background image at 50% brightness, transparent background, transparent scrollbar, 20% fading on losing focus, gray tint, scrollbar, trough-less scrollbar, scrollbar on the right, 1000 scrollback lines, and with xterm terminal emulation. Like I mentioned in my original guide. xv will sometimes fail to start with xwin. If that is the case, you can modify aterm.bat to look like this:

aterm.bat:
[sourcecode]
C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\bin\bash.exe --login -i -c "xv -display :0 -root -quit -be -max /cygdrive/c/Documents\ and\ Settings/vivin/My\ Documents/My\ Pictures/Wallpapers/01707_spectrumofthesky_1920x1200.jpg && aterm -sh 80 -tr -trsb -fade 20 -tint gray -sb -st -sr -sl 1000 -tn xterm"
[/sourcecode]

Slightly inefficient, but it works. Now if you have a dual-monitor display, you'll notice that the background image is stretched across both screens when you run aterm. This is probably not what you want. To fix this problem you need to change a few invocation options for xv. For this to work properly (meaning, not look crappy) both screens should be running at the same resolution:

[sourcecode]
xv -display :0 -root -quit -be -maxpect -rmode 1 /cygdrive/c/Documents\ and\ Settings/vivin/My\ Documents/My\ Pictures/Wallpapers/01707_spectrumofthesky_1920x1200.jpg
[/sourcecode]

Notice the -maxpect and -rmode 1 options. -maxpect expands the image to fill the screen while maintaining the aspect ratio, while -rmode 1 sets the display mode on xv to tiled. So you should now have your wallpaper displaying on both screens now (under X) without being distorted.

Here's what it looks like on my machine:

aterm running on XP under X with a dual-monitor setup

This is on a dual-monitor setup with both screens running at 1920x1200 resolution. I've set X's background to be the same as my windows Wallpaper so that it looks cooler. Notice how the background image (inside aterm) is not stretched, but tiled across the two screens. That's all there is to it. Seems like a bit of work, but I think it's worth it. My main reason for going through all this trouble was to get a decent terminal running in windows. I guess I could have just used xterm, but aterm looks so much nicer, doesn't it?

19 thoughts on “An update to running aterm (or any other X app) rootless, without a DOS console on Cygwin”

  1. Phil says:
    April 7, 2009 at 3:19 am

    Hello. This could well be a stupid question, but I get the following when running ./configure for libAfterImage.

    $ ./configure
    checking for gcc… gcc
    checking for C compiler default output file name… a.exe
    checking whether the C compiler works… yes
    checking whether we are cross compiling… no
    checking for suffix of executables… .exe
    checking for suffix of object files… o
    checking whether we are using the GNU C compiler… yes
    checking whether gcc accepts -g… yes
    checking for gcc option to accept ANSI C… none needed
    checking whether ln -s works… yes
    configure: error: cannot run /bin/sh ./config.sub

    Any ideas?

    Thanks,
    Phil

    Reply
  2. vivin says:
    April 7, 2009 at 9:24 am

    Hello Phil,

    Not a stupid question at all 🙂 I was able to find three possible solutions:

    On Linux, ./config.sub is usually a symlink to something. Try doing an ls -l on that directory to see what it’s trying to point to. From some research, the most common problem seems to be a missing libtool, so you may need to install that through Cygwin’s setup. But since this is a Linux-specific issue, it may not apply to Cygwin.

    You can also try setting CONFIG_SHELL to /bin/sh.exe and then running make again. (export CONFIG_SHELL=/bin/sh.exe)

    Another problem might be related to the way you’re unpacking the archive file. If it was a zip, don’t use Windows to unzip the file since it clobbers the line-endings. Use Cygwin’s unzip utility instead.

    Hope this helps!

    Reply
  3. Phil says:
    April 8, 2009 at 6:55 am

    Thanks, that did help. The problem was the unpacking of the archive file. I used the .tar.bz2 file which winzip screwed up. Uncompressing and untaring the file made it work.

    Then I had to install few more cygwin libraries to get the configure to complete, so that bit now works (with the exception of this bit, which I’m assuming I can ignore:

    …
    checking pkg-config is at least version 0.9.0… yes
    checking for SVG… checking headers required by TTF support… ./configure: line 8194: freetype-config: command not found
    none found
    You have to install FreeType libary in order to be able to use TTF fonts.
    checking libAfterBase… disabled
    checking for dirent.h that defines DIR… yes
    …

    Then it makes the Makefile but I can’t get this to run successfully. It comes up with this:

    $ make
    make: makefile: line 130: Warning — Duplicate entry [libAfterImage.a] in prerequisite list
    gcc -O3 -DNO_DEBUG_OUTPUT -Wall -mmmx -Winline –param inline-unit-growth=10000 –param large-function-growth=10000 -c libungif/dgif_lib.c -o libungif/dgif_lib.o
    make: Error — gcc: The system cannot find the file specified.
    make: Error code -1

    Looking in the libungif directory dgif_lib.c exists.
    gcc is on the path and the ./configure script finds it ok.

    Do you have any idea what might be causing this?
    I will continue to look but am doing this alongside work related stuff.

    Cheers,
    Phil

    Reply
  4. vivin says:
    April 8, 2009 at 11:40 am

    Hmmm… that’s a strange one. I don’t recall whether Freetype is required or not. Maybe you can try installing it? I believe it’s there in Cygwin setup. What other libraries did you have to install?

    The problem with these kinds of errors is that it’s not immediately obvious what is wrong. I’d try installing the Freetype library (I think it’s libttf or libfreetype) and see if that helps. Hopefully it’ll get a little further in the build process.

    Reply
  5. joseph says:
    April 8, 2009 at 6:46 pm

    Thank you for this writeup!!!

    Reply
  6. curious person says:
    April 27, 2009 at 5:14 pm

    Nice article; thanks for the info. A sort of related but now aging project is the XliveCD: http://xlivecd.indiana.edu/.

    My question: do you have a link to your wallpaper anywhere?

    Reply
  7. vivin says:
    April 27, 2009 at 6:18 pm

    Hi,

    Thanks for that link! That’s pretty useful actually, especially when I’m on a system that doesn’t have Cygwin installed!

    I got my wallpaper from interfacelift.com, but you can just download it off my server.

    Reply
  8. Cihan says:
    July 30, 2009 at 1:40 pm

    Hi Vivin,

    Thanks for preparing this help. However, I had some problems compiling the libAfterImage library. I keep getting the following error. Any ideas?

    Thanks a lot.
    Cihan

    gcc -O3 -DNO_DEBUG_OUTPUT -Wall -I.. -c ascompose.c
    In file included from /usr/include/X11/extensions/shape.h:62,
    from ascompose.c:47:
    /usr/local/include/X11/Xutil.h:93: error: parse error before "Bool"
    /usr/local/include/X11/Xutil.h:96: error: parse error before "icon_pixmap"
    /usr/local/include/X11/Xutil.h:97: error: parse error before "icon_window"
    /usr/local/include/X11/Xutil.h:99: error: parse error before "icon_mask"
    /usr/local/include/X11/Xutil.h:100: error: parse error before "window_group"
    /usr/local/include/X11/Xutil.h:136: error: parse error before "Atom"
    /usr/local/include/X11/Xutil.h:139: error: parse error before ‘}’ token
    /usr/local/include/X11/Xutil.h:182: error: parse error before "XPointer"
    /usr/local/include/X11/Xutil.h:184: error: parse error before ‘}’ token
    /usr/local/include/X11/Xutil.h:226: error: parse error before "Visual"
    /usr/local/include/X11/Xutil.h:240: error: parse error before ‘}’ token
    /usr/local/include/X11/Xutil.h:259: error: parse error before "Colormap"
    /usr/local/include/X11/Xutil.h:267: error: parse error before "visualid"
    /usr/local/include/X11/Xutil.h:268: error: parse error before "killid"
    /usr/local/include/X11/Xutil.h:322: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:328: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:337: error: parse error before "XRectangle"
    /usr/local/include/X11/Xutil.h:355: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:382: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:389: error: parse error before "XGetClassHint"
    /usr/local/include/X11/Xutil.h:391: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:397: error: parse error before "XGetIconSizes"
    /usr/local/include/X11/Xutil.h:399: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:406: error: parse error before "XGetNormalHints"
    /usr/local/include/X11/Xutil.h:408: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:414: error: parse error before "XGetRGBColormaps"
    /usr/local/include/X11/Xutil.h:416: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:424: error: parse error before "XGetSizeHints"
    /usr/local/include/X11/Xutil.h:426: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:433: error: parse error before "XGetStandardColormap"
    /usr/local/include/X11/Xutil.h:435: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:442: error: parse error before "XGetTextProperty"
    /usr/local/include/X11/Xutil.h:444: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:452: error: parse error before "XGetWMClientMachine"
    /usr/local/include/X11/Xutil.h:454: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:460: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:462: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:467: error: parse error before "XGetWMIconName"
    /usr/local/include/X11/Xutil.h:469: error: parse error before ‘*’ token
    /usr/local/include/X11/Xutil.h:475: error: parse error before "XGetWMName"

    Reply
  9. vivin says:
    July 30, 2009 at 1:51 pm

    Hey Cihan,

    Did you install libX11-devel?

    Reply
  10. Cihan says:
    July 30, 2009 at 1:52 pm

    Hi Vivin,

    Thanks for this helpful article. I get the following error when compiling libAfterImage. Any ideas?

    Thanks.
    Cihan

    gcc -O3 -DNO_DEBUG_OUTPUT -Wall -I.. -c ascompose.c
    In file included from /usr/include/X11/extensions/shape.h:62,
    from ascompose.c:47:
    /usr/local/include/X11/Xutil.h:93: error: parse error before "Bool"
    /usr/local/include/X11/Xutil.h:96: error: parse error before "icon_pixmap"

    Reply
  11. vivin says:
    July 30, 2009 at 1:56 pm

    Hey Cihan,

    I think it might be related to libX11-devel. Did you install that package from Cygwin setup?

    Reply
  12. Cihan says:
    July 30, 2009 at 1:57 pm

    Hi Vivin,

    Wow, thanks for the quick response. 🙂

    Yes, I did install libX11-devel. Is it possible that I am missing another library that you did not list above?

    Thanks a lot.

    Cihan

    Reply
  13. vivin says:
    July 30, 2009 at 2:02 pm

    No problem 🙂

    I think I may have forgotten to list xorg-x11-devel. Let me know if installing that package works. I’m pretty sure it has to do with an X development library since it looks like gcc isn’t able to figure out what those symbols mean.

    Reply
  14. Cihan says:
    July 30, 2009 at 2:12 pm

    According to the cygwin package list http://www.cygwin.com/packages/ xorg-x11-devel seems to be obsolete. It is not listed in the cygwin setup list anymore also.

    Reply
  15. vivin says:
    July 30, 2009 at 2:19 pm

    Hmmm…

    What other development packages are there under x11? I’m on a Linux box right now so I can’t check. Those symbols seem to be part of Xlib. Did you install xinit?

    Reply
  16. BMatt says:
    December 7, 2009 at 6:12 pm

    I have a few questions about this:
    1) Once I compiled all of these, where are the binaries? I put the tar.gz/tar.bz2’s in the /home/smith directory, and compiled everything there.

    2) I don’t know if I have all the X things installed… a different tutorial somewhere said there were more packages to install with X, but they weren’t there.

    3) What do I do with the .bat files once I’ve made them?

    Thanks!
    -BMatt

    Reply
  17. vivin says:
    December 8, 2009 at 10:04 am

    @BMatt

    1) When you do a make install it should put the binaries in /usr/bin.
    2) If you were able to build everything successfully then all your X development stuff probably has been installed.
    3) Try running them – just double click on them. You can also make a link to them on your desktop so you can launch your terminal just with a click. You probably want to put the xwin.bat as part of your startup so that X starts when you log into Windows. Then all you need to do is launch the aterm.bat file to open your terminal.

    Reply
  18. BMatt says:
    December 9, 2009 at 3:54 pm

    Thanks, I have a couple more questions. I can navigate to /usr/bin within Cygwin, but not in Explorer. I want to get there in Explorer so I can look through the files easier (is it just in C:\cygwin\bin\ ?). When I try using the command aterm, it gives me a command not found error. Is this not the command to run it? Thanks again!

    Reply
  19. vivin says:
    December 10, 2009 at 10:35 am

    @BMatt
    I believe it’s C:\cygwin\bin or C:\cygwin\usr\bin

    Where are you running aterm from? Are you trying it from the batch file? Also, did you have any errors in the build process, or did everything install properly? You need to make sure that after configure, you run make and then make install.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Archives

  • February 2023
  • April 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • June 2017
  • March 2017
  • November 2016
  • August 2016
  • July 2016
  • June 2016
  • February 2016
  • August 2015
  • July 2014
  • June 2014
  • March 2014
  • December 2013
  • November 2013
  • September 2013
  • July 2013
  • June 2013
  • March 2013
  • February 2013
  • January 2013
  • October 2012
  • July 2012
  • June 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • July 2011
  • June 2011
  • May 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • August 2008
  • March 2008
  • February 2008
  • November 2007
  • July 2007
  • June 2007
  • May 2007
  • March 2007
  • December 2006
  • October 2006
  • September 2006
  • August 2006
  • June 2006
  • April 2006
  • March 2006
  • January 2006
  • December 2005
  • November 2005
  • October 2005
  • September 2005
  • August 2005
  • July 2005
  • June 2005
  • May 2005
  • April 2005
  • February 2005
  • October 2004
  • September 2004
  • August 2004
  • July 2004
  • June 2004
  • May 2004
  • April 2004
  • March 2004
  • February 2004
  • January 2004
  • December 2003
  • November 2003
  • October 2003
  • September 2003
  • July 2003
  • June 2003
  • May 2003
  • March 2003
  • February 2003
  • January 2003
  • December 2002
  • November 2002
  • October 2002
  • September 2002
  • August 2002
  • July 2002
  • June 2002
  • May 2002
  • April 2002
  • February 2002
  • September 2001
  • August 2001
  • April 2001
  • March 2001
  • February 2001
  • January 2001
  • December 2000
  • November 2000
  • October 2000
  • August 2000
  • July 2000
  • June 2000
  • May 2000
  • March 2000
  • January 2000
  • December 1999
  • November 1999
  • October 1999
  • September 1999
©2023 Rough Book | Built using WordPress and Responsive Blogily theme by Superb
All original content on these pages is fingerprinted and certified by Digiprove