Installation Instructions for Electric

Electric compiles on most UNIX variants, including SunOS, Solaris, BSD, HPUX, AIX, and (of course) GNU/Linux. Macintosh users must run System 7 or later. Electric compiles best under Metrowerks, although it has been built with MPW and THINK_C. Electric compiles under Windows 95/98/ME, NT 4.0, 2000, or XP with Visual C++ 5.0 or later.

The Electric manual has detailed installation instructions.

Contents:

Building under Unix

To configure for your system, go into the top-level directory and type:
   ./configure
This will examine the system and create a file called "Makefile".

To build Electric you now only need to type:
   make
This compiles Electric and creates the executable file "electric" in the top level directory.

Type "./electric" to run the system.

On Solaris, when using the Forte C compiler, uncomment the line that starts with "FORTECFLAGS" in "Makefile".

Electric has the option of using TrueType fonts. If you want this, follow these instructions:

  1. If your system has Rainer Menzner's "T1Lib" installed, skip to step 4. Otherwise obtain Rainer Menzner's "T1Lib" (for example, from http://sunsite.unc.edu/pub/Linux/libs/graphics)
    Once you have it, unpack it (it will create a directory called "T1-1.1.0"), go into that directory, type "./configure" and then type "make". You can then install with "make install".
  2. Now go to the Electric directory and edit the "Makefile". Near the top are comments labeled "T1LIB TRUETYPE". Uncomment the two lines (remove the "#" from the beginning of the lines) and change the lines so that they point into the T1Lib folder that you have just installed. For example, if the T1Lib libraries installed into "/usr/local/lib" and the T1Lib headers installed into "/usr/local/include", then you want these lines to read:
       TRUETYPE_LIBS = /usr/local/lib/libt1.a
       TRUETYPECFLAGS = -DTRUETYPE=1 -I/usr/local/include
  3. Next (this is the most painful part), you have to set the environment variable T1LIB_CONFIG to point to the file "t1lib.config". This file may be installed in "/usr/local/share/t1lib". There will certainly be a copy in the "examples" folder of the distribution. The catch here is that this file has relative path names in it which must be converted to absolute. So, if you have extracted the T1Lib distribution into the folder "/home/strubin/T1-1.1.0", then the file should look like this:
       FONTDATABASE=/home/strubin/T1-1.1.0/examples/FontDataBase
       ENCODING=/home/strubin/T1-1.1.0/Fonts/enc:.
       AFM=/home/strubin/T1-1.1.0/Fonts/afm:.
       TYPE1=/home/strubin/T1-1.1.0/Fonts/type1:.
  4. Finally, rebuild Electric with the TrueType library. When you run it, you will get a warning if any of the TrueType initialization fails (in which case it will revert to the non-TrueType code). Otherwise, you have it.
  5. Note that Electric uses the first font in the database by default. To change the font that Electric uses, set the environment variable ELECTRIC_TRUETYPE_FONT to the desired font name. You can see a list of available fonts by setting this environment variable to an unknown name, in which case Electric will show all fonts in its error message.

To add Java, follow these instructions:

  1. Download the Java Development Kit (JDK) from http://java.sun.com. Install it. For the purposes of these instructions, assume that it is installed into /usr/java/jdk. If you install it elsewhere, adjust these instructions accordingly.
  2. After configuration, but before making Electric, edit the "Makefile" and uncomment the lines near the top that enable Java. Change the definition of LANGJAVA_DIR to point to the installed JDK location.
  3. On Solaris, add this string to the environment variable LD_LIBRARY_PATH:
        :/usr/java/jdk/jre/lib/sparc:/usr/java/jdk/jre/lib/sparc/classic:/usr/java/jdk/jre/lib/sparc/native_threads
    On GNU/Linux, add this string to the environment variable LD_LIBRARY_PATH:
       :/usr/java/jdk/jre/lib/i386:/usr/java/jdk/jre/lib/i386/classic:/usr/java/jdk/jre/lib/i386/native_threads
  4. Be sure to export "LD_LIBRARY_PATH" if your shell requires it.

To add the TCL interpreter, download ActiveTcl from http://www.tcl.tk and install it. Then edit "Makefile" and you will find the instructions necessary to enable the interpreter.

Building under Macintosh

For System 7, 8, and 9, there is a Metrowerks project (called "Electric.xml"). Run Metrowerks, import this file, and save it in the top level, alongside the "src" directory. Due to the size of the code that is being built, you may have to increase the size of the Metrowerks partition.

For System 10, there are two ways to go: Qt or ProjectBuilder. Qt is the only fully-working solution, but unfortunately it is not free on the Macintosh (it is actually quite expensive). Also, you need Qt release 3.1.0 or later.

To build with "Qt", use a terminal window and type "./configure" to generate a "Makefile". Edit the "Makefile" and switch to Qt widgets (uncomment the Qt part, comment the Motif part, and in the Qt section, change comments to switch to "Qt on Macintosh").

The alternative to Qt is ProjectBuilder (the files "Electric.pbproj" and "English.lproj" are included). Note that the ProjectBuilder solution is not fully debugged, so use with care.

After compilation, you will have the application "Electric". Double-click it to run the system.

To add the TCL interpreter, follow these instructions:

  1. Download ActiveTcl from "http://www.tcl.tk" and install it.
  2. If using Qt/System 10, edit "Makefile" and add TCL. Otherwise:
  3. In the compiler, add an include path to the installed TCL "include" directory.
  4. Also in the compiler, add the appropriate TCL library to the project.
  5. Edit the appropriate "mac" include file in "src/include" (for example, "macsfsheaders.h") and uncomment the definition of "FORCETCL".

To add a Java interpreter (System 10 only) follow these instructions:

  1. Download Java from "http://java.sun.com" and install it.
  2. If using Qt, edit "Makefile" and add Java. Otherwise:
  3. In the compiler, add an include path to the installed Java "include" directory.
  4. Also in the compiler, add the appropriate Java library to the project.
  5. Edit the appropriate "mac" include file in "src/include" (for example, "macsfsheaders.h") and uncomment the definition of "FORCEJAVA".

Building under Windows

Note: Electric should be run with the Display Settings set to "65536 Colors" or "True Color". Anything less will cause the colors to appear wrong.

Special note for VC++ 6.0 (or later)
You may have trouble linking and receive this error:

    LINK : fatal error LNK1181: cannot open input file "nafxcwd.lib"

If so, try the following:

  1. Open the project settings. Select the "Win32 Debug" configuration.
  2. Select the "General" tab. Make sure the "Microsoft Foundation Classes" option is set to "Use MFC in a Shared DLL".
  3. Select the "Link" tab. Check the "Object/Library module" option of the "General" category. If it contains the text "nafxcwd.lib" then remove that text (but leave anything else).

To add the Java interpreter, follow these instructions:

  1. Download the Java Development Kit (JDK) from http://java.sun.com. Install it.
    The standard location is "C:\Program Files\JavaSDK" (or whatever the version is), and this path will be used here. If you install it elsewhere, adjust these instructions accordingly.
  2. Edit the environment variables in the "System" Control Panel. On some systems, you click on the "Environment" tab; on others, click on the "Advanced" tab and then click the "Environment Variables" button. Under "System variables", select "Path" and in the "Value:" area, add this string to the end:
        ;C:\Program Files\JavaSDK\jre\bin\classic;C:\Program Files\JavaSDK\bin
    On some newer versions of the Java Development Kit, you may also have to include this path:
        ;<CODE>;C:\Program Files\JavaSDK\bin\client
    On Windows 95 and Windows 98 systems, you may have to edit C:\AUTOEXE.BAT and append this to the PATH variable. You must restart your computer after making this change.
  3. In Visual C++ 5.0 or 6.0, use the "Settings" command of the "Project" menu. Select the "C/C++" tab and the "Preprocessor" category. In the "Preprocessor definitions" area, add this to the end:
       ,FORCEJAVA=1
    In the "Additional include directories" area add this to the end:
       ,C:\Program Files\JavaSDK\include,C:\Program Files\JavaSDK\include\win32
    Select the "Link" tab and the "General" category. In the "Object/library modules" area, enter this:
       jvm.lib
    Select the "Link" tab and the "Input" category. In the "Additional library path" area, enter this:
       C:\Program Files\JavaSDK\lib
  4. In Visual Studio .NET, right-click on the "Electric" solution and choose "Properties". Select "C/C++" on the left and choose the "General" category under it. In the "Additional Include Directories" area, add this to the end:
       ;C:\Program Files\JavaSDK\include,C:\Program Files\JavaSDK\include\win32
    Next choose the "Preprocessor" category of "C/C++" and in the "Preprocessor Definitions" area add this to the end:
       ;FORCEJAVA=1
    Select "Linker" on the left and choose the "General" category under it. In the "Additional Library Directories" area, enter this:
       ;C:\Program Files\JavaSDK\lib
    Next choose the "Input" category of "Linker" and in the "Additional Dependencies" area enter this:
       jvm.lib
  5. Once Java is installed, you must compile the ROM generator. In a command window, change directories to the "lib\java" directory and run the command:
       javac romgen.java

To add the TCL interpreter, follow these instructions:

  1. Download ActiveTcl from http://www.tcl.tk and install it.
  2. In the compiler, edit the Project Settings and find the field "Additional include directories" (under "C/C++"). Add a new path to the installed TCL Includes (typically "C:\Program Files\Tcl\include").
  3. Also in the compiler, edit the Project Settings and find the field "Additional library path" (under "Linker"). Add a new path to the installed TCL Libraries (typically "C:\Program Files\Tcl\lib").
  4. Edit the file "src/include/config.h" and make sure that the constant "TCLLIBDIR" points to the proper location of the initialization files ("init.tcl" and others). This is typically "C:\Program Files\Tcl\lib\tcl8.3". Note that each backslash is doubled in this file, and you should follow this convention.

Installing

Once compiled, Electric will run properly from the directory where it was built. However, if you wish to install the system, you must move files carefully. This is because Electric makes use of a collection of "support files". The main support file is called "cadrc" (on UNIX, it has a dot in front: ".cadrc"). In addition, Electric needs to find the "lib" and "html" directories. If these support files cannot be found, Electric will not be able to initialize its graphical user interface. Just type "-quit" to exit the program if this happens.

On Windows and the Macintosh, it is sufficient to move the support files, along with the executable, to a public location. Then make an alias (shortcut) to the executable and place that anywhere you like. When the alias is run, the directory with the executable will become the current directory, and all of the needed support files will be found.

On UNIX, the "make install" command will place the executable and the support files in a public location, but they may not be together. For example, it is not uncommon for the executable to be placed in "/usr/local/bin", but the support files in "/usr/local/lib/electric". When this happens, the executable needs to know where the support files are located. There are three ways to do this:

  1. You can set the ELECTRIC_LIBDIR environment variable to point to the location of the support files.
  2. You can change the #define of "LIBDIR" in "src/include/config.h" to point to the location of the support files.
  3. You can keep a local copy of ".cadrc" file (this file can be in your home directory or in the current directory). Inside of the ".cadrc" file, change the "electric library default-path" command to point to the remaining support files (the "lib" and "html" directories).

UNIX systems also offer "make install.html", which installs the online manual into a public place (typically "/usr/local/share/doc/electric/html"). Be sure that the #define of "DOCDIR" in "src/include/config.h" agrees with this path, or else the "See Manual" command will not work.

Additional Details for Unix

Electric uses "widget libraries" to control the windows on the display. The default widget library is Motif (see http://www.opengroup.org/openmotif). You can use LessTif (see http://www.lesstif.org), but it has some bugs. You will have to remove the "XtDestroyWidget()" call in "DiaDoneDialog()". You can also use Qt (see http://www.trolltech.com) by editing the "Makefile" after running "configure". Comments near the top explain what to do.

When installing these packages on your system, be sure to get both the libraries and the "devel" package that contains the compiler header files. Also note that many systems use shared libraries for these widget packages, and this may require some additional steps when installing. This is because the libraries get installed in a place that the shared library system doesn't know about. If you have super-user access, you can use "ldconfig" to tell the system where to find the libraries. Otherwise, you can use the LD_LIBRARY_PATH environment variable (on AIX use LIBPATH and on HP-UP use SHLIB_PATH). This variable is a colon-separated list of paths to be searched for shared libraries. For example, this setting will work on many systems:
   LD_LIBRARY_PATH = /usr/X11R6/lib/
   export LD_LIBRARY_PATH

Electric has two ways to control the display. By default, the system runs on any depth monitor, but is slow on older machines and must be run locally (that is, the client and the server must be on the same computer). The alternate method of display is faster and can run over the network, but it can only support displays that are set to 8bpp (8 bits per pixel). In addition, this alternate method will suffer from "colormap flashing" when the cursor enters and leaves the Electric windows. To switch to this alternate method, edit the "Makefile" after running "configure". Comments near the top explain what to do. Note also that Motif and Lesstif do not work well with this alternate display method, so you will also have to switch to using the Athena widgets.

Electric makes use of external programs for simulation. The location of these programs can be found in the various #defines in the file "src/include/config.h", which can be overridden with the following variables in your ".cshrc" file:
   setenv ELECTRIC_SPICELOC /usr/local/bin/spice
   setenv ELECTRIC_ESIMLOC /usr/local/bin/esim
   setenv ELECTRIC_RSIMLOC /usr/local/bin/rsim
   setenv ELECTRIC_PRESIMLOC /usr/local/bin/presim
   setenv ELECTRIC_RNLLOC /usr/local/bin/rnl

There are two command-line arguments that can be given to control the X-Windows display. If you use the "-f" option, Electric will start with a full-screen graphics window. If you use the "-geom WxH+X+Y", it will set the graphics window to be "W" wide, "H" high, and with its corner at (X, Y). Additional X-Windows options can be typed into the file ".Xdefaults". The resources "Electric.font0" through "Electric.font8" set the font to use for point sizes 4, 6, 8, 10, 12, 14, 16, 18, and 20. The resource "Electric.fontmenu" controls the text used in the component menu, and the resource "Electric.fontedit" controls the text used in the text editor. Here is a sample line from the file:
   Electric.font5: -misc-fixed-medium-r-normal-*-*-140-*-*-*-*-*-*
To see what all of these fonts look like, load the library "samples.txt" (with the "Readable Dump" subcommand of the "Import" command of the "File" menu) and edit the facet "tech-Artwork". The top part of the facet shows text in sizes 4 through 20.