Wednesday, December 25, 2013

Install XV Image viewer on Ubuntu linux

'sudo apt-get install xv' doesn't install xv on Ubuntu, you would need to build it.

Follow the steps as in here to build, you might need to do few more changes for tiff make errors which I encountered.

sudo bash
cd /tmp
wget ftp://ftp.trilon.com/pub/xv/xv-3.10a.tar.gz
wget http://www.ulich.org/hints/resources/xv-3.10a-jumbo20050501-1.diff.gz
wget http://www.ulich.org/hints/resources/xv-3.10a-jumbo-patches-20050501.tar.gz
tar xvzf xv-3.10a.tar.gz
tar xvzf xv-3.10a-jumbo-patches-20050501.tar.gz
gzip -d xv-3.10a-jumbo20050501-1.diff.gz
cd xv-3.10a
patch -p1 < ../xv-3.10a-jumbo-fix-patch-20050410.txt
patch -p1 < ../xv-3.10a-jumbo-enh-patch-20050501.txt
patch -p1 < ../xv-3.10a-jumbo20050501-1.diff

for i in libxt-dev libc6-dev xlibs-dev libjpeg62-dev libtiff4-dev libpng12-dev libxt-dev; do apt-get install $i; done

make

cp xv /usr/local/bin/

For Make errors like:
xvtiff.c:15:79: fatal error: tiffio.h: No such file or directory
compilation terminated.

and

/usr/bin/ld: cannot find -ltiff
collect2: ld returned 1 exit status

Add the xv extracted path to TIFFINC and TIFFLIB in Makefile: ( I had extracted to /tmp/xv-3.10a )
TIFFINC = -I$(TIFFDIR)/include -I/tmp/xv-3.10a/tiff
TIFFLIB = -L$(TIFFDIR)/lib -L/tmp/xv-3.10a/tiff -ltiff

PS:
Official Site of XV is http://www.trilon.com/xv/

18 comments:

  1. Thanks! I followed your instructions and had no problems!

    ReplyDelete
  2. I cannot change permission of makefile, so I cannot edit it. I have an error:
    xvtiff.c:15:79: fatal error: tiffio.h: No such file or directory

    What can I do?
    Thanks a lot in advance.

    P.S. I used chmod 775 and root password

    ReplyDelete
  3. It worked perfectly. Thanks & Merci!

    ReplyDelete
  4. Great work! I'm still hooked to xv and just not ready to let it go so thank you for extending its life. I ran into some problems on Ubuntu 15.04 and 15.10, which I finally solved. Following the instructions here results in a missing libtiff shared object file. If you apt-get libtiff5-dev, which provides the required file, libjpeg62 gets removed. As a result, the program compiles but it's unable to open any jpeg files, complaining of incorrect jpeg library version. I was able to make it work by reinstalling libjpeg62 and rebuilding.

    ReplyDelete
  5. Hi. I got it to work up to the last step, then I get the fatal error "xvtiff.c:15:79: fatal error". I put those two lines in Makefile but they didn't do anything (I also tried Makefile.std - don't know what the difference is). Help :-(

    ReplyDelete
  6. Great! It works for me in Ubuntu 15.10. Thank you very much. I've used xv since 90's and was really missing it in Linux.

    ReplyDelete
  7. This is brilliant -thanks! Still a really good program. I changed the script a bit to heve less screen output:

    wget --no-clobber ftp://ftp.trilon.com/pub/xv/xv-3.10a.tar.gz
    wget --no-clobber http://www.ulich.org/hints/resources/xv-3.10a-jumbo20050501-1.diff.gz
    wget --no-clobber http://www.ulich.org/hints/resources/xv-3.10a-jumbo-patches-20050501.tar.gz
    rm -rf xv-3.10a
    tar xvzf xv-3.10a.tar.gz
    tar xvzf xv-3.10a-jumbo-patches-20050501.tar.gz
    gzip -fd xv-3.10a-jumbo20050501-1.diff.gz
    cd xv-3.10a
    patch -p1 < ../xv-3.10a-jumbo-fix-patch-20050410.txt
    patch -p1 < ../xv-3.10a-jumbo-enh-patch-20050501.txt
    patch -p1 < ../xv-3.10a-jumbo20050501-1.diff
    for i in libxt-dev libc6-dev xlibs-dev libjpeg62-dev libtiff4-dev libpng12-dev libxt-dev; do apt-get install $i; done
    make CFLAGS+=-Wno-unused-variables
    cp ./xv /usr/local/bin
    cd ..

    ReplyDelete
  8. Thanks, at the end I had to
    sudo apt-get install libtiff5-dev
    in order to get the -ltiff to work

    ReplyDelete
  9. If you are attempting to compile this under Mint 18, go to the tiff subfolder, and change "RANLIB=./RANLIB.sh" to "RANLIB=ranlib" in the Makefile, and run make. Return to the parent xv directory, and run make. Done.

    ReplyDelete
  10. Using xv under Raspberry PI. I loved using xv in undergrad I had to say thanks for this page. Compiled and setup xv a priceless tool.

    ReplyDelete
  11. In Ubuntu 16.04 LTS some packages have different names. You should use these lines instead:
    for i in libxt-dev libc6-dev libsx-dev libjpeg62-dev libtiff5-dev libpng12-dev libxt-dev; do apt-get install $i; done

    ReplyDelete
  12. I was also looking for the XV picture viewer under Ubuntu 18.04. The above did not work as I got some error messages:
    Makefile:319: recipe for target 'xvpng.o' failed
    and some other compile errors.

    So I tried alien as described here:
    https://www.rosehosting.com/blog/how-to-install-rpm-packages-on-ubuntu/
    using the xv rpm from SuSE Leap 15 here:
    https://software.opensuse.org/package/xv
    This results in a xv_3.10a-1_amd64.deb
    which I then installed with
    sudo dpkg -i xv_3.10a-1_amd64.deb
    Now I have xv on Ubuntu 18.04 without any hassle.

    ReplyDelete

  13. Do you have any more recent instructions? Trying to install xv on Linux Mint 20. Got various errors, some things would
    not apt-get and then compiler errors..

    ReplyDelete
  14. gcc -O3 -Wall -DDOPNG -I/usr/include -I/usr/include -DDOJPEG -I/usr/include -DDOTIFF -DUSE_TILED_TIFF_BOTLEFT_FIX -I/usr/include -I/tmp/xv-3.10a/tiff -DDOPDS -DUSLEEP -DLINUX -L/usr/X11R6/lib -DMGCSFXDIR=\"/usr/X11R6//lib/\" -DSYSCONFDIR=\"/etc\" -DXVEXECPATH=\"/usr/X11R6//lib/\" -c xvpng.c
    xvpng.c: In function ‘CreatePNGW’:
    xvpng.c:97:56: error: ‘Z_NO_COMPRESSION’ undeclared (first use in this function); did you mean ‘COMPRESSION’?
    97 | DCreate(&cDial, pngW, 12, 25, DWIDE, DHIGH, (double)Z_NO_COMPRESSION,
    | ^~~~~~~~~~~~~~~~
    | COMPRESSION
    xvpng.c:97:56: note: each undeclared identifier is reported only once for each function it appears in
    xvpng.c:98:19: error: ‘Z_BEST_COMPRESSION’ undeclared (first use in this function)
    98 | (double)Z_BEST_COMPRESSION, COMPRESSION, 1.0, 3.0,
    | ^~~~~~~~~~~~~~~~~~
    In file included from /usr/include/pngconf.h:51,
    from /usr/include/png.h:339,
    from xvpng.c:31:
    xvpng.c: In function ‘WritePNG’:
    xvpng.c:427:21: error: dereferencing pointer to incomplete type ‘png_struct’ {aka ‘struct png_struct_def’}
    427 | if (setjmp(png_ptr->jmpbuf)) {
    | ^~
    xvpng.c:453:11: error: dereferencing pointer to incomplete type ‘png_info’ {aka ‘struct png_info_def’}
    453 | info_ptr->width = w;
    | ^~
    xvpng.c: In function ‘png_xv_error’:
    xvpng.c:1054:18: error: dereferencing pointer to incomplete type ‘png_struct’ {aka ‘struct png_struct_def’}
    1054 | longjmp(png_ptr->jmpbuf, 1);
    | ^~
    xvpng.c: In function ‘VersionInfoPNG’:
    xvpng.c:1078:5: error: ‘ZLIB_VERSION’ undeclared (first use in this function)
    1078 | ZLIB_VERSION, zlib_version);
    | ^~~~~~~~~~~~
    xvpng.c:1078:19: error: ‘zlib_version’ undeclared (first use in this function)
    1078 | ZLIB_VERSION, zlib_version);
    | ^~~~~~~~~~~~
    make: *** [Makefile:319: xvpng.o] Error 1

    ReplyDelete