I just wanted to document this: I wanted to generate PDFs of schematics and boards from the command line; as far as I could gather from Command line to plot pdf - KiCad itself does not have this facility, and apparently eeplot
from eeshow
does have it.
So, I tried to build eeshow
from source, and it turns out, on Ubuntu 14.04 with its default libraries, there are errors that appear, like these:
file/git-util.c: In function ‘git_repo_is_dirty’:
file/git-util.c:56:2: error: unknown type name ‘git_checkout_options’
...
file/git-util.c:64:35: error: ‘GIT_CHECKOUT_OPTIONS_VERSION’ undeclared (first use in this function)
...
file/git-file.c: In function ‘get_data’:
file/git-file.c:327:3: error: unknown type name ‘git_buf’
file/git-file.c:329:3: warning: implicit declaration of function ‘git_object_short_id’
file/git-file.c:332:3: warning: implicit declaration of function ‘git_buf_free’
...
It turns out, this is because the default libgit2-dev
on Ubuntu 14.04 is version 0.19.0-2
; and in that version, indeed there are no structs like git_buf
etc. So, we’d need a newer version of the libgit2
- thankfully, it is possible to use the version from Ubuntu 16.04 (which is libgit2-dev
version 0.24.1-2
) just for this build - and this is what I did:
git clone http://neo900.org/git/eeshow eeshow_git
cd eeshow_git
sudo apt-get install libgtk-3-dev libcairo2-dev transfig imagemagick # all dependencies, except for libgit2-dev
wget http://dk.archive.ubuntu.com/ubuntu/pool/universe/libg/libgit2/libgit2-dev_0.24.1-2_i386.deb
wget http://dk.archive.ubuntu.com/ubuntu/pool/universe/libg/libgit2/libgit2-24_0.24.1-2_i386.deb
wget http://dk.archive.ubuntu.com/ubuntu/pool/universe/h/http-parser/libhttp-parser2.1_2.1-2_i386.deb
mkdir libgit2-dev_0.24.1-2
cd libgit2-dev_0.24.1-2
for ix in ../*.deb; do echo $ix; dpkg -x $ix .; done # unpack the debs here
cd ..
## Here, do the changes in the Makefile as in the below patch; and then:
make
Here are the changes done in the Makefile:
diff --git a/Makefile b/Makefile
index fb1ec41..a5f6e57 100644
--- a/Makefile
+++ b/Makefile
@@ -60,15 +60,22 @@ OBJS = $(EESHOW_OBJS) $(EEPLOT_OBJS) $(EEDIFF_OBJS) $(EETEST_OBJS)
ICONS = delta diff
+# pkg-config --cflags libgit2 ; pkg-config --libs libgit2 - replaced
+# SO:18136918
+mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
+#mkfile_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
+mkfile_dir := $(dir $(mkfile_path))
+$(info $$mkfile_path is [${mkfile_path}])
+$(info $$mkfile_dir is [${mkfile_dir}])
CFLAGS = -g -Wall -Wextra -Wno-unused-parameter -Wshadow \
-Wmissing-prototypes -Wmissing-declarations \
-I. \
`pkg-config --cflags cairo` \
- `pkg-config --cflags libgit2` \
+ -I./libgit2-dev_0.24.1-2/usr/include/ \
`pkg-config --cflags gtk+-3.0`
LDLIBS = -lm \
`pkg-config --libs cairo` \
- `pkg-config --libs libgit2` \
+ -L./libgit2-dev_0.24.1-2/usr/lib/i386-linux-gnu -Wl,-rpath,$(mkfile_dir)/libgit2-dev_0.24.1-2/usr/lib/i386-linux-gnu -lgit2 -lz -lcrypto \
`pkg-config --libs gtk+-3.0`
GIT_VERSION = $(shell git log -1 --format='%h' -s .)
With this, eeshow
, eeplot
etc will compile, and they will run initially.
However, note that if you run the example recommended in https://neo900.org/stuff/eeshow/#walk-through :
git clone http://neo900.org/git/ee
cd ee/hw
eeshow neo900.pro
… the project will fail to load with a Segmentation fault:
$ /path/to/eeshow neo900.pro
/usr/local/kicad/library/kicad-libs/components/powered.lib: No such file or directory
/usr/local/kicad/library/kicad-libs/components/powered.lib: No such file or directory
...
Segmentation fault (core dumped)
… and that is likely because I use my KiCad from the build directory (as in, “portable”), I do not have it installed in system locations. Still, at least the eeshow
project executables build fine, so hopefully eventually I figure out how to use them…