Quick fix xfig bug

Selection_007Ok, so I am a computer dinosaur. I still use xfig for much of my drawings, although I recon it is a program from the old century…

Unfortunately, after the recent upgrade to Ubuntu 14.04, a nasty bug surfaced in xfig: a crash whenever you try to draw point-dashed lines.

Fortunately, the launchpad user madHamish found the cause of the problem and proposed a patch; after a bit of study I simplified it to a one liner that fix the problem: go to line number 1295 of w_drawprim.c and change the declaration

static unsigned char dash_list[16][2] = {{255, 255}, {255, 255},


static unsigned char dash_list[16][8] = {{255, 255}, {255, 255},

— just change the [2] to [8]. Notice that this error is probably here since the origin of time, and that a new version of the C library simply triggered it.

So, what to do if you rely to xfig? Simple. Download the source; then install the packages needed to compile the program (in Ubuntu this is done by

apt-get build-dep xfig

— in other  distros YMMV).

Extract the source code:

tar xvzf xfig.3.2.5c.full.tar.gz 
cd xfig.3.2.5c

do the change above mentioned and then compile and install:

make install

…and you’re set!

If you have a 64-bit Ubuntu distribution, and you do not want to compile the thing, and you trust internet binaries (you shouldn’t), I am attaching here a binary that you should be able to simply drop in place of /usr/bin/xfig in your machine.

Binary for 64 bit Ubuntu 14.04 (use at your risk)

Title: xfig-patched-bin-ubuntu14.04-64bit.tar (0 click)
Filename: xfig-patched-bin-ubuntu14-04-64bit-tar.gz
Size: 2 MB

13 comments to Quick fix xfig bug

  • Jose Maria

    It worked!!


    (from another dinosaur)

    Is there a decent alternative for vector graphics including LaTeX-labelling and pdf output [combined PS/PDF/LaTeX output 3 files is essential to me]

  • No that I know of. I use a lot xcircuit for electronic circuits, but you have to use manually psfrag for LaTeX labelling. If you ever find something, please comment here…

  • Jose Maria

    I tried IPE but at a first glance it doesn’t fit all my needs.

    TikZ is cute and wonderful but I need some to time get used to it.

    Xfig is by far my favorite. Even today I realized I can play overlays with xfig, ps/pdfLaTeX 3 files and LaTeX beamer. At least for labels.

    But xfig is getting too unstable and it is also driving me mad. I am running two xubuntu 14.04 computers. One of them works almost fine with xfig. The other one is terrible. I cannot edit long labels. As soon as the horizontal scroll bar appers in the Edit panel I can’t edit the label anymore. Also I can’t read the label on the main canvas while writing after pressing the Text-buttom.

    I am now thinking in editing the fig file to handle the labels to write long LaTeX commands (including handling overlays) and then run fig2dev from the command line to simulate the PsPdfLaTeX 3 files export.

    I found here to set specialfonts and LaTeXfonts automatically. But then units turned out to imperial. I assume xfig is not reading the original config-file.

    Also xfig does not exit normally and it always generating bugs reports.

    It is becoming really painful. But still worthing.

  • I have a very similar experience. I am trying to learn Inkscape for the future, because I feel that sooner or later xfig will simply stop working.

    What could be worthwhile could be to dig up some old distro where it worked ok, and try to build a _completely_ static binary. That could help…

  • Andrew D

    This worked perfectly. Thank you.

  • Georges

    I just installed the xfig executable from the tar.gz you give above. It works fine. Thanks a lot !!!!

  • Georges

    Because xfig.3.2.5c (from the Ubuntu Library) did not work on Ubuntu 14.04 I have installed the previous 5b version (from the http://packages.ubuntu.com/precise repository and this worked fine drawing dash-dot lines.

    I have also compiled the source of the 5b version and this crashes when I ask for a dash-dot line. I checked that in the w_drawprim.c files the “static unsigned char dash_list[16][2]” are the same in the 5b and the 5c versions. So it is true that the versions compiled with the 14.04 system do not work correctly while the version compiled with the 12.04 works fine.

    Other remark: when I run your patched 5c version from a terminal it works fine for dot-dash lines but at start time I get the message

    Can’t open compose key file ‘/usr/lib/X11/xfig/CompKeyDB’,
    no multi-key sequences available

    Then I created the /usr/lib/X11/xfig/ directory and I copied the CompKeyDB file
    from /usr/share/xfig/ and now everything is OK.

  • Fazulakis

    You’ve saved my day! Thank you!

    Another dinosaur here, but not out of stubborness: I have not yet found a good replacement for xfig…

    In my case I was getting crashes when moving or deleting points in existing figures, for instance in an arch, etc.

    Now everything is back to normal with your fix.

    Thanks again for sharing this.

  • Georges

    Hy !
    My xfig works fine but its launcher has a very surprising behavior: when I start xfig (either using the launcher, or opening a .fig file, or by a command in a terminal) a new icon appears in the launcher ; this icon is either the usual xfig icon, or a “?”, and I am not able to predict which will appear. When I quit xfig this second icon disappears even I clicked on “keep in the launcher”. Have you an idea to explain this ? Thanks.

  • kati

    I have the same problem – xfig crashes when I try to move a point in an arc.
    But I can’t find a file with the name of w_drawprim.c … where is it supposed to be? Where am I wrong? I’m really use to using xfig…

  • This file is in the xfig sources — from http://xfig.org/art17.html — and then modify and compile it. Notice however that on launchpad somebody proposed a different fix — link here.

  • Leo simon

    Thanks so much for the binary! Was wonderful not have to go thru all the make install stuff.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>