Table of Contents

Compiling gschem, pcb, gerbv on 11.3

I have recently played a little bit with L80 Quectel GPS module and after a while decided to design PCB for the final version to be installed in my car. As usual, created schema in gschem, then tried to “Import Schematics” in pcb, but that failed. I tried with gsch2pcb as well and it didn't work either - gsch2pcb complained with “No elements found, so nothing to do.” It seems I hit bug 700311 - gnetlist is confused if gschem and pcb are installed to the different locations - exactly my case after I recompiled last time. So I had to recompile to install into standard /usr/local location. For gschem and gerbv, I followed the procedure I had used before, but went with slightly different set of requirements for pcb:

Prerequisites

Since I wanted to build pcb with documentation which requires LaTeX, I had to deploy LaTeX first. It was in fact straightforward, went with TeX Live which is an easy way to deploy TeX/LaTeX on Unix systems. And since I wanted to build with Oracle Solaris Studio, I had to install that as well. Went with 12.4 release installed from Oracle package repository.

Deploy from git

$ git clone git://git.geda-project.org/pcb.git pcb-git
$ cd pcb-git
$ export PATH=/usr/local/texlive/2015/bin/i386-solaris:/usr/gnu/bin:$PATH
$ ./autogen.sh
$ CC=/opt/SUNWspro/bin/cc CXX=/opt/SUNWspro/bin/CC CFLAGS="-m64" LDFLAGS="-L/usr/lib/amd64" ./configure --disable-gl --disable-toporouter
$ make
$ sudo make install

Deploy from tarball, version 4.0.0

$ wget https://sourceforge.net/projects/pcb/files/pcb/pcb-4.0.0/pcb-4.0.0.tar.gz
$ tar xvpf pcb-4.0.0.tar.gz
$ diff -u pcb-4.0.0-orig/src/global.h pcb-4.0.0/src/global.h 
--- pcb-4.0.0-orig/src/global.h Sun Jan 15 19:40:45 2017
+++ pcb-4.0.0/src/global.h      Sat Feb 18 10:33:55 2017
@@ -177,7 +177,7 @@
 #define ANYOBJECTFIELDS                        \
        BoxType         BoundingBox;    \
        long int        ID;             \
-       FlagType        Flags;          \
+       FlagType        Flags
        //      struct LibraryEntryType *net
 
 /* Lines, pads, and rats all use this so they can be cross-cast.  */

$ diff -u pcb-4.0.0-orig/src/layerflags.h pcb-4.0.0/src/layerflags.h
--- pcb-4.0.0-orig/src/layerflags.h     Mon Oct 31 07:44:21 2016
+++ pcb-4.0.0/src/layerflags.h  Sat Feb 18 10:34:12 2017
@@ -31,10 +31,10 @@
 #ifndef PCB_LAYERFLAGS_H
 #define PCB_LAYERFLAGS_H
 
-unsigned int string_to_layertype (const char *typestring,
+LayertypeType string_to_layertype (const char *typestring,
                                   int (*error) (const char *msg));
-const char *layertype_to_string (unsigned int type);
-unsigned int guess_layertype (const char *name,
+const char *layertype_to_string (LayertypeType type);
+LayertypeType guess_layertype (const char *name,
                               int layer_number,
                               DataType *data);
$ cd pcb-4.0.0
$ export PATH=/usr/local/texlive/2015/bin/i386-solaris:/usr/gnu/bin:$PATH
$ CC=/opt/SUNWspro/bin/cc CXX=/opt/SUNWspro/bin/CC CFLAGS="-m64" LDFLAGS="-L/usr/lib/amd64" GDLIB_CFLAGS="-I/usr/include/gd2" GDLIB_LIBS="-lXpm -lX11 -ljpeg -lfontconfig -lfreetype -lpng -lz -lm -lgd" ./configure --disable-gl --disable-toporouter
$ make
$ sudo make install

Gotchas

Missing locale.h header file (fixed in pcb 4.0.0)

Compilation fails, since following files are missing <locale.h> header file:

$ git status -s
M  src/main.c
M  src/print.c
M  src/gettext.h

Adding following line to those files fixes the problem:

#include <locale.h>

I filed bug 1529233 to track this problem.

Broken texi2dvi(1) utility

texi2dvi(1) utility is used to convert document from Texinfo to PDF or TeX DVI format. However, it fails on Oracle Solaris:

/usr/bin/texi2dvi --pdf --batch pcb.texi
/usr/bin/texi2dvi[129]: local: not found [No such file or directory]
/usr/bin/texi2dvi[224]: local: not found [No such file or directory]
/usr/bin/texi2dvi[224]: local: not found [No such file or directory]
/usr/bin/texi2dvi[224]: local: not found [No such file or directory]
/usr/bin/texi2dvi[174]: local: not found [No such file or directory]
make[3]: *** [pcb.pdf] Error 127

Reason being that it uses /bin/sh as a shell interpreter which on Linux maps to bash(1), but on Oracle Solaris /bin/sh points to ksh93(1). And ksh93(1) lacks support for local built-in command. The script contains a check for that and tries to cope with that by defining local as a function, but I found out the check itself is broken. So to workaround the problem, I modified the script to explicitly use /usr/bin/bash interpreter instead of /bin/sh.

Install gschem on S11FCS

$ sudo pkg install gcc-45 guile
$ tar xvpf /data/Downloads/geda/geda-gaf-1.6.2.tar.gz
$ cd geda-gaf-1.6.2
$ export PATH=/usr/gnu/bin:$PATH
$ ./configure
$ make
$ sudo make install
$ /usr/local/bin/gschem
$ cat /usr/lib/pkgconfig/guile-1.8.pc 
prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib/guile
includedir=${prefix}/include

Name: Guile
Description: Guile
Version: 1.8.6
Libs: -L${libdir} -lguile
Cflags: -I${includedir}/guile -I${includedir}/gmp
$ ./configure --prefix /apps/geda-1.8.2
$ /apps/geda-1.8.2/bin/gschem

Install pcb on S11FCS

$ sudo pkg install library/gd developer/macro/gnu-m4 text/gnu-gettext
$ tar xvpf pcb-20110918.tar.gz
$ git clone git://git.geda-project.org/pcb.git pcb-git
$ sudo pkg install developer/build/automake-111 developer/build/autoconf developer/parser/bison developer/lexer/flex
$ cd pcb-git
$ ./autogen.sh
$ diff -u /tmp/pcb-20110918/src/main.c /data/Downloads/geda/pcb-20110918/src/main.c
--- /tmp/pcb-20110918/src/main.c	Sat Sep 17 23:29:29 2011
+++ /data/Downloads/geda/pcb-20110918/src/main.c	Mon Apr 16 22:46:16 2012
@@ -37,6 +37,7 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
+#include <locale.h>
 #include <signal.h>
 #include <unistd.h>
 #include <sys/stat.h>
$ cd pcb-20110918/
$ export PATH=/usr/gnu/bin:$PATH
$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --disable-gl --disable-doc --disable-toporouter --prefix=/apps/pcb-20110918
$ make
$ sudo make install
$ /usr/local/bin/pcb
$ tar xvpf ./gtkglext-1.2.0.tar.gz
$ export PATH=/usr/gnu/bin:$PATH
$ ./configure
$ make
$ sudo make install

Install gerbv on S11FCS

$ tar xvpf gerbv-2.6.0.tar.gz
$ diff -u /tmp/gerbv-2.6.0/src/gerbv.c ~/Downloads/geda/gerbv-2.6.0/src/gerbv.c
--- /tmp/gerbv-2.6.0/src/gerbv.c	Sat Nov 19 01:04:14 2011
+++ /home/dambi/Downloads/geda/gerbv-2.6.0/src/gerbv.c	Fri Jul 27 19:45:40 2012
@@ -79,6 +79,9 @@
 
 static int defaultColorIndex = 0;
 
+#undef	isnormal
+#define	isnormal(x)	__builtin_isnormal(x)
+
 /* ------------------------------------------------------------------ */
 static gerbv_layer_color defaultColors[NUMBER_OF_DEFAULT_COLORS] = {
 	{115,115,222,177},
$ cd gerbv-2.6.0/
$ export PATH=/usr/gnu/bin:$PATH
$ ./configure --prefix=/apps/gerbv-2.6.0
$ make
$ sudo make install
$ /usr/local/bin/gerbv