XCircuit Compile and Install

General Information

Beginning with xcircuit version 3.1, the development platform is the Tcl-enabled version of xcircuit, with special compile-time instructions (see below). It is not necessary to compile with Tcl, or Python, as xcircuit will run just fine without any interpreter or other command-line based interface. The command-line interface, and in particular, the Tcl version with its scripted GUI interface, is much more flexible than the original version with its hard-coded GUI. Tcl-based xcircuit will interface neatly with other EDA (electronic design automation) tools such as magic, irsim, and netgen, which are based on the same system.

The python and non-interpreter-based versions of xcircuit will be maintained, but not further developed.

Compilation uses GNU automake/autoconf. The original "Imake" method has been removed in version 3.2.

Compilation from source is always preferred to installation of a precompiled executable (such as an RPM file). Compilation from source allows GNU autoconf to tailor xcircuit to the abilities of your system.

Prerequisites/Requirements

Because the Tcl/Tk version of xcircuit is the recommended one, it is necessary to satisfy certain package requirements if you wish to compile to it. If these package prerequisites are not met, then the "configure" step of the install will report "Tcl/Tk not found, reverting to non-Tcl compile". The package prerequisites for Fedora Core are listed below. Other systems will have similar package names. This is not a complete list, but assumes that the package manager will find and install all dependencies of the packages listed below.

The first package listed below (libX11) is required for all versions of Xcircuit.

  1. Development files for libX11
  2. Tcl scripting language development environment
  3. Tk graphical toolkit development files
A compile on Ubuntu or other system using apt-get can use the following command to install prerequisites:
sudo apt-get install build-essential tcl-dev tk-dev libX11-dev

KDE Install

While installation for KDE generally follows the standard compile and install instructions below, Graham Sheward has kindly provided a PDF file of instructions specifically for KDE. The instructions specifically target SuSE Linux, but should be applicable to any system running KDE as a desktop environment.
  1. KDE Install Instructions (PDF file).
  2. XCircuit icon for KDE (XPM format icon graphic).

Installation preparation

  1. Download xcircuit from the xcircuit download page. XCircuit source comes in either gzip (.tgz or tar.gz) or bzip2 tar.bz2 formats.
  2. Uncompress with, as appropriate,
    	gunzip xcircuit-version.tar.gz    or
    	gunzip xcircuit-version.tgz    or
    	bunzip2 xcircuit-version.tar.bz2
    	
  3. Untar the archive file with
    	tar xf xcircuit-version.tar
    	
  4. The result of the above steps is a directory named xcircuit-version containing the source.
    	cd xcircuit-version
    	
  5. Follow the GNU automake instructions, below.

GNU Compile and Install

GNU automake is intended to greatly simplify the process of program installation by querying the OS for detailed information on its capabilities. In most cases, the following should work without a hitch:
  ./configure [options]
  make
  make install
Older versions of xcircuit (3.2) require "./configure --with-tcl", as Tcl was disabled by default in the early versions supporting it. and even older version require "make tcl" and "make install-tcl" to compile and install the Tcl interpreter-based version. These options remain valid in the newer versions, in addition to the simpler "make" and "make install". Versions newer than 3.2.15 will attempt to compile the Tcl-based version by default, so the "--with-tcl" is not needed unless giving the script a hint about where to find the Tcl header files (see below).

For default configuration, the xcircuit install process must be run as root user, so the process can access the /usr/local/ directory tree for installation. GNU install puts the xcircuit executable into /usr/local/bin/ and files it needs on startup in /usr/local/lib/xcircuit-version/. To compile and install without root privileges, use the "--prefix=" option (see below).

Pre-install testing

To test the program prior to installation (that is, between "make" and "make install", do the following. For the non-Tcl/Tk version of Xcircuit, cd to the top level of the source, and do:
setenv XCIRCUIT_LIB_DIR ./lib
./xcircuit
For bash/sh instead of tcsh, use:
export XCIRCUIT_LIB_DIR=./lib
./xcircuit
For the Tcl/Tk version of XCircuit, use:
setenv XCIRCUIT_LIB_DIR ./lib
setenv XCIRCUIT_SRC_DIR ./lib/tcl
./lib/tcl/xcircuit.sh
And finally, for the Tcl/Tk version of XCircuit, using bash or sh instead of tcsh, use:
export XCIRCUIT_LIB_DIR=./lib
export XCIRCUIT_SRC_DIR=./lib/tcl
./lib/tcl/xcircuit.sh

GNU Configure Options

All compile-time features are set during the ./configure process. Run

   ./configure --help
for a list of configure options. For most users, the relevant options are the following:
--prefix=PREFIX
Location to install xcircuit. Defaults to /usr/local/. The executable goes to /usr/local/bin/, man pages to /usr/local/man/man1/, and everything else to /usr/local/lib/xcircuit-VERSION/. Defaults can be separated by explicitly declaring --exec-prefix=DIR, --mandir=DIR, and --libdir=DIR. This option is especially useful to install xcircuit in a local directory (i.e., install without root privilege).
--with-cairo
This is the development option new to xcircuit version 3.9, making use of the Cairo graphics library for antialiased line rendering and font rendering from outline fonts. Developed by Erik van der Wal. For the early stages of development (from May 2014), this option is disabled by default, and must be specifically enabled using this option to configure.
--without-tcl
This option applies only to versions after 3.2.15. These versions will enable the Tcl-based compilation by default, and this switch needs to be declared to prevent compiling the Tcl-based version. It is equivalent to specifying the option --with-tcl=no.
--with-tcl
This option applies only to versions prior to and including 3.2.15. This configures xcircuit to use Tcl as its command-line interpreter. This option is mutually exclusive with the python option. Only one interpreter can be used. Tcl is the current development platform. Note that prior to Xcircuit version 3.1.7, this option was "--enable-tcl". Also, prior to XCircuit version 3.2.13, "make tcl" and "make install-tcl" were required to compile and install with the Tcl interpreter. "--with-tcl=DIR" may specify DIR as the location for Tcl files (specifically, the location of the "tclConfig.sh" file), for systems which have Tcl in a non-standard location and which have difficulty finding it with the simple --with-tcl option.
Find Tcl at www.tcl.tk
--enable-asg
This option is available with xcircuit versions 3.2 and newer, and enables the automatic schematic generation (ASG) package. At the moment (around 3.2 revision 13), this package is under development, so the option is disabled by default.
--with-python
Compile XCircuit with the embedded Python interpreter. This option is mutually exclusive with --with-tcl. If the configure step cannot find a Python interpreter, its location can be explicitly referenced using --with-python=DIR. Requires the Python library (libpythonVERSION.a or libpythonVERSION.so) and the python include file Python.h. The Python option uses the Python language as an embedded interpreter for xcircuit. Python is no longer the current development platform (see Tcl, above) but is supported. Python compile is normally disabled (beginning xcircuit-3.1.7).
Find Python at www.python.org
--with-xpm=DIR
If the configure step cannot find the XPM package, it can be explicitly referenced. The XPM package enables the toolbar and an icon when xcircuit is iconified. XPM can be completely disabled by using --without-xpm
Find XPM at ftp.x.org
--with-gs=DIR
If the configure step cannot find ghostscript, it can be explicitly referenced. The Ghostscript option allows any PostScript file to be rendered on the xcircuit background and saved with the xcircuit file. The Ghostscript background PostScript handling can be completely disabled by using --without-gs
--disable-lgf
Save space by not compiling the compatibility with "analog" and "diglog" .lgf-format files.
--disable-schema
Don't compile the schematic capture system. This is a major feature of xcircuit, so disabling it is not recommended. However, you may do so if you anticipate having no need for circuit netlists. This option is not available in versions 3.2 and newer; the schematic capture system cannot be removed, although it can be turned off from the GUI.
--disable-double-buffer
This option is almost wholly deprecated due to the speed of modern processors. However, if you have problems with slow rendering, you might find it useful.
--disable-focus-fix
Don't attempt to work around broken window managers. Normally this option should not be tampered with, but odd behavior regarding capture of key events in the xcircuit window may require it.
--x-include=DIR --x-libraries=DIR
On some systems it may be necessary to explicitly supply paths to find the X11 include and library files. Don't mess with this unless "configure" complains that it can't find various things related to X.
However, AMD Opteron (64-bit platform) users should note: At least on the RedHat GinGin64 distribution, X11 libraries for the 64-bit compile are in a different location from the 32-bit libraries, and require the configure switch
--x-libraries=/usr/X11R6/lib64
to get a proper compile.
Note for HP users: The original HP "m4" processor cannot handle the man page translation. If available, use GNU m4. GNU m4 is chosen by default if the configure script can find it. If it exists but its location is not so obvious, set it as an environment variable when you invoke the configure script, as follows:
M4=path-to-GNU-m4 ./configure [options]

Automake/Autoconf

In cases where the configure step complains about automake or autoconf version, a bad "aclocal" file, etc., these can be run again. The full preparation procedure is as follows:
aclocal
automake
autoconf
These steps generate the "aclocal.m4" file, "Makefile.in" file, and "configure" script, respectively. Normally, it should not be necessary to do this.

Running the Tcl version under the debugger

The GNU "configure" script generates default compile flags that enable compiler optimization (gcc -O2). Generally speaking, this is fine, except if anything goes wrong, trying to figure out what's going on in the debugger when you have an optimized executable can be very confusing. To make sure you compile a version that can be more easily debugged, remove the "-O2" from the CFLAGS line in Makefile after doing "configure" but before doing "make", or else do:
(export CFLAGS="-g"; ./configure)
make
which will also do the trick.

In case of trouble such as program crashes, it is important to understand that the Tcl version of xcircuit makes the "xcircuit" executable a shell script. This prevents a debugger from running the program directly. To enable the debugger, it is necessary to do the following: Start xcircuit as normal. Then, in a separate terminal (it is okay to background xcircuit and run the debugger in the same terminal), do:

ps -C wish
This command returns the process ID pid of the "wish" program, which is the actual executable. For systems that do not have the "-C" option for the "ps" command, any invocation of "ps" that will return the process ID of the "wish" program will do. After obtaining the process ID, do:
gdb wish
attach pid
continue
where pid is the process ID returned by the "ps" commmand.

The debugger prompt can be accessed at any time by typing Ctrl-C in the terminal where the debugger was started. When reporting XCircuit crashes, please do the above steps first. After XCircuit crashes and drops back into the debugger, type "where" to get the subroutine call stack. Send all this output along with the bug report. Alternately, there is a standalone executable called xcircexec that resides in the install directory, nominally /usr/local/lib/xcircuit-version/xcircexec. Using this executable bypasses the Tk console, but otherwise works exactly the same (console input is taken from the terminal instead of the console window). Debugging with this executable can be done with the following sequence of commands:

gdb /usr/local/lib/xcircuit-version/xcircexec
run
Note that one important difference between the two debugging methods is that the first one brings up xcircuit first, then starts the debugger, and the second one starts the debugger first, then starts xcircuit. If the error being tracked happens during startup, then the second method is necessary. If the error happens during read-in of a file, then the first method is probably preferred, as it ensures that xcircuit has passed through all the startup routines and library reads first.

Extended TCL Interpreter

Running XCircuit as an extension of the TCL interpreter is the preferred mode of operation. As of version 3.2 Revision 17, the GNU "configure" script will attempt to compile the TCL-based version by default, unless it has trouble finding the header and library files. Note that not all systems come with the proper headers, even when the libraries are present. If this happens, the GNU "configure" script will announce that Tcl and/or Tk could not be found, and that the compilation will revert to the non-Tcl based version. If this happens, you can either 1) try explicitly giving the configure script the option "--with-tcl=DIR", where DIR is the directory where the file tclConfig.sh can be found, or 2) try downloading and installing Tcl/Tk as a package, or downloading and compiling from source (see below). Compiling from source works well if you feel the need to avoid writing over any existing version on your system that may be relied upon by other programs. Usually precompiled versions end up installed directly under /usr, whereas the default configuration of the source sets the install directory to /usr/local.

In particular, if compiling from source, note that the default executable for wish, which xcircuit depends on, is called wish-8.4 (or whatever is the current version number). It is probably done this way to avoid conflicting with an existing version of "wish". To make sure that XCircuit can find the executable, though, it is necessary to either rename wish-8.4 back to wish, or else create a symbolic link called wish pointing to wish-8.4.

The Tcl-based version of XCircuit is entirely command-line driven, and the GUI interface is a TCL script which drives the command-line interpreter in response to button clicks and such. The command-line interpreter is set up in a "drop-through" mode, in which the interpreter sources the script "wrapper.tcl" to set up the GUI, then drops back into the interpreter. The command-line is always available for entering commands. It is displayed in a separate window that is popped down after startup. In XCircuit, the menu selection "File->Tcl Console" will cause the command-line console to appear, as will the "%" key in the XCircuit window. All commands and their options are documented on the XCircuit Tcl Reference web page.

Obtaining TCL/TK

Tcl/Tk source can be downloaded from the Tcl Developer Xchange. Current version (as of early 2004) is 8.4. XCircuit makes some subroutine calls that are incompatible with versions earlier than 8.1.

Embedded Python Interpreter

XCircuit compilation, if using Python, requires Python source, not the executable. If you need/want to install or update Python on your system, be sure to download the source, not, for instance, an RPM package with executable only. Some systems provide a static or shared library which can be linked to at runtime, plus the necessary include files. Recent versions of Linux, for instance, are likely to be set up this way, which is sufficient. When compiling from source on UNIX systems, generate the shared library by running the configuration script with:
./configure --enable-shared

Obtaining Python

Python source can be obtained from the Python.org official website. The actual download is on the ftp site Python 2.3 FTP directory. Current download (February 2003) is Python-2.3a1.tgz.


Back to the xcircuit home page. . .

email:

Last updated: August 5, 2016 at 6:41pm