Skip to content

Commit f9ac4d2

Browse files
committed
Instructions for a static build of super-zaje
1 parent 66db7dd commit f9ac4d2

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

cmd/super-zaje/static_build.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#### Static compilation on Debian/Ubuntu
2+
3+
The below will produce a rather chubby binary (29M on my Debian box) but it should run correctly on all modern Linux distros.
4+
If you don't need a static binary, simply follow the relevant install procedure [here](./README.md)
5+
6+
- Install deps:
7+
```sh
8+
# apt-get install libdeflate-dev libtiff-dev libsharpyuv-dev libwebp-dev liblerc-dev liblzma-dev libjbig-dev libpng-dev libzstd-dev libjpeg-dev
9+
```
10+
11+
Note: Debian/Ubuntu do provide static archives for both `libleptonica` and `libtesseract` but these are compiled with additional options that `super-zaje` does not need and statically linking against these archives would require the installation of several more `dev` packages.
12+
13+
- Build a statically linked version of libleptonica:
14+
15+
```sh
16+
$ git clone --depth 1 https://github.com/DanBloomberg/leptonica.git
17+
$ ./autogen.sh
18+
$ ./configure --with-pic --disable-shared 'CFLAGS=-D DEFAULT_SEVERITY=L_SEVERITY_ERROR -g0 -O3'
19+
$ make
20+
# make install
21+
```
22+
23+
- Build a statically linked version of libtesseract:
24+
```sh
25+
$ git clone --depth 1 https://github.com/tesseract-ocr/tesseract.git
26+
$ ./autogen.sh
27+
$ ./configure --with-pic --disable-shared --disable-legacy --disable-graphics --disable-openmp --without-curl --without-archive --disable-doc 'CXXFLAGS=-DTESS_EXPORTS -g0 -O3 -ffast-math'
28+
$ make
29+
# make install
30+
```
31+
32+
- Build super-zaje:
33+
```sh
34+
git clone https://github.com/jessp01/zaje.git
35+
cd zaje/cmd/super-zaje
36+
CGO_ENABLED=1 GOOS=linux go build -a -tags netgo -ldflags '-extldflags "-static -ldeflate -ltiff -L/usr/local/lib -ldeflate -lsharpyuv -lwebp -lLerc -llzma -ljbig -ltesseract -lleptonica -lpng -lzstd -ljpeg -lz -lgif -lsharpyuv -lwebp"' super-zaje.go
37+

0 commit comments

Comments
 (0)