This blog post explains how to compile Lepton, the recently released JPEG lossless recompressor by Dropbox without autotools on Linux.
You'll need a fairly recent C++ compiler with the development libraries installed. g++-4.4 is too old, g++-4.8 is good enough.
Compile with the following command (without the leading $
):
$ git clone https://github.com/dropbox/lepton $ cd lepton $ # Optional: git reset --hard e3f6c46502d958aaba17fbe7c218f8ce2b8b3f48 $ g++ -std=c++0x -W -Wall -Wextra -Wno-unused-parameter -Wno-write-strings \ -msse4.1 \ -o lepton \ -fno-exceptions -fno-rtti \ -s -O2 \ -DGIT_REVISION=\"fake\" \ -I./src/vp8/decoder \ -I./src/vp8/encoder \ -I./src/vp8/model \ -I./src/vp8/util \ dependencies/md5/md5.c \ src/io/MemMgrAllocator.cc \ src/io/MemReadWriter.cc \ src/io/Seccomp.cc \ src/io/Zlib0.cc \ src/io/ZlibCompression.cc \ src/io/ioutil.cc \ src/lepton/bitops.cc \ src/lepton/fork_serve.cc \ src/lepton/idct.cc \ src/lepton/jpgcoder.cc \ src/lepton/lepton_codec.cc \ src/lepton/recoder.cc \ src/lepton/simple_decoder.cc \ src/lepton/simple_encoder.cc \ src/lepton/socket_serve.cc \ src/lepton/thread_handoff.cc \ src/lepton/uncompressed_components.cc \ src/lepton/validation.cc \ src/lepton/vp8_decoder.cc \ src/lepton/vp8_encoder.cc \ src/vp8/decoder/boolreader.cc \ src/vp8/decoder/decoder.cc \ src/vp8/encoder/boolwriter.cc \ src/vp8/encoder/encoder.cc \ src/vp8/model/JpegArithmeticCoder.cc \ src/vp8/model/model.cc \ src/vp8/model/numeric.cc \ src/vp8/util/billing.cc \ src/vp8/util/debug.cc \ src/vp8/util/generic_worker.cc \ src/vp8/util/memory.cc \ -lz \ -lpthread \ ; $ ./lepton --help
It works both on i386 (force it with -m32
) and amd64 (force it with -m64
) architectures. Other architectures are not supported, because Lepton uses the SSE4.1 CPU instructions.
It also works with -std=c++11
, but it doesn't work with -std=c++98
.
Lepton also has a copy of zlib embedded, you can compile it with gcc
instead of g++
, and use it instead of -lz
.
These instructions were tested and found working with the following version of Lepton:
$ git rev-parse HEAD # e3f6c46502d958aaba17fbe7c218f8ce2b8b3f48