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:

  • go with the latest bits from Git repository
  • pcb web page mentions that pcb is known to build with the Oracle Studio compiler, so decided to give it a try
  • try to build 64-bit binary

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

  • obtain the latest bits from Git repository
$ git clone git://git.geda-project.org/pcb.git pcb-git
  • build and install
$ 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

  • download the tarball
$ 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
  • minor tweaks required to build with Oracle Solaris Studio (version 12.4)
$ 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);
  • build and install (built 64-bit on s11u3sru16 with Oracle Solaris Studio 12.4)
$ 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

  • Download latest stable version of gschem from here.
  • Install necessary packages.
$ sudo pkg install gcc-45 guile
  • unpack sources into working directory
$ tar xvpf /data/Downloads/geda/geda-gaf-1.6.2.tar.gz
  • compile and install
$ cd geda-gaf-1.6.2
$ export PATH=/usr/gnu/bin:$PATH
$ ./configure
$ make
$ sudo make install
  • launch and enjoy
$ /usr/local/bin/gschem
  • trying to compile the latest stable version 1.8.2 on 11.1sru11, I had to create following pkg-config(1) file for guile(1):
$ 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
  • configured to install in alternate directory, so that I can test 1.8.2 version while using 1.6.2 one for “production”:
$ ./configure --prefix /apps/geda-1.8.2
  • then invoking in following way:
$ /apps/geda-1.8.2/bin/gschem

Install pcb on S11FCS

  • Download latest stable version of pcb from here.
  • Install necessary packages.
$ sudo pkg install library/gd developer/macro/gnu-m4 text/gnu-gettext
  • unpack sources into working directory
$ tar xvpf pcb-20110918.tar.gz
  • Alternatively (if the goal is to compile from the latest sources available), pull directly from development git repository, install couple of additional packages and run ./autogen.sh.
$ 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
  • patch src/main.c. Add missing locale.h header file, as setlocale(3C) is consumed. Fixed by Dan McMahill in chset 8cbc19e5aa9572196f27d4e64db8337d80945803.
$ 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>
  • compile and install
$ 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
  • launch and enjoy
$ /usr/local/bin/pcb
  • '–enable-gl' requires GtkGLExt (OpenGL extension to GTK+). Version 1.2.0 can be downloaded from here.
  • unpack
$ tar xvpf ./gtkglext-1.2.0.tar.gz
  • compile and install (ends up in /usr/local/lib by default)
$ export PATH=/usr/gnu/bin:$PATH
$ ./configure
$ make
$ sudo make install

Install gerbv on S11FCS

  • Download latest stable version of gerbv from here.
  • unpack sources into working directory
$ tar xvpf gerbv-2.6.0.tar.gz
  • apply necessary patch, so that gcc does not explode
$ 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},
  • compile and install
$ cd gerbv-2.6.0/
$ export PATH=/usr/gnu/bin:$PATH
$ ./configure --prefix=/apps/gerbv-2.6.0
$ make
$ sudo make install
  • launch and enjoy
$ /usr/local/bin/gerbv
howtos/install_gschem_on_s11.txt · Last modified: 2017/02/18 10:40 by admin
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0