ruby: command not foundThe Huffman table generation step requires Ruby. Install it:
sudo apt-get install ruby # Debian/Ubuntu
sudo dnf install ruby # Fedora/RHEL
gcc: command not found or wrong compilerThe Makefile expects GCC at /usr/bin/gcc. If your compiler is elsewhere,
edit Makefile.inc or override on the command line:
make CC=/path/to/gcc
-fPICObject files must be compiled with -fPIC for the shared library. This is the
default in Makefile.inc (OBJ_CFLAGS=-fPIC -Wl,--relocatable). If you have
overridden OBJ_CFLAGS, ensure -fPIC is still included.
huffman_codes.inc out of date or missingThe Makefile regenerates src/huffman_codes.inc automatically when
huffman_codes.rb changes. If the file is missing or corrupt, regenerate it
manually:
ruby huffman_codes.rb > src/huffman_codes.inc
Then rebuild:
make clean && make
Each test executable prints PASS (green) or an error message (red) for each
test case, followed by a summary line. The exit code is the number of failures.
make check runs all test executables and prints the failure count:
test/test-huffman
0 test failures
test/test-mkhpack
0 test failures
Done
A non-zero failure count indicates which test executable had problems. Run it directly for detailed output:
make lib
make test/test-huffman
./test/test-huffman
error: 1 — ERROR_OVERFLOW: the internal test buffer (1024 bytes) was
too small for the test case. This would indicate a logic change that increased
output size unexpectedly.error: 2 — ERROR_TRUNCATED: the test input was consumed before the
value was fully decoded. Check whether huffman_codes.inc is up to date.mismatch at byte N — the encoded/decoded output differs from the
expected value at byte position N. The test prints the input (<), actual
output (>), and expected output (~) in hex for comparison.The default benchmark harness (benchmark-custom.c) uses the x86 RDTSC
instruction. On non-x86 platforms or virtualised environments where RDTSC is
unavailable, switch to the clock_gettime harness by editing the Makefile:
BENCHLIB=benchmark-gettime
BENCHFLAGS=-Wl,--no-as-needed -Wl,-lrt
CPU frequency scaling and other processes can affect results. For more stable measurements:
sched_setaffinityERROR_OVERFLOW (1) from encoding functionsThe output buffer is too small for the encoded data. For integer encoding, the worst case is 10 bytes (a full 64-bit value with a 1-bit prefix). For Huffman encoding, the worst case is approximately 4× the input length (for byte values with 30-bit Huffman codes). For string encoding, add the length prefix overhead.
ERROR_TRUNCATED (2) from decoding functionsThe input buffer ended before the encoded value was complete. Ensure the full
encoded sequence is present in the buffer and that bytesize accurately
reflects the available data.
ERROR_EOS (3) from huffman_decode()The Huffman-encoded data contained the EOS symbol (code point 256), which is forbidden in HPACK string data per RFC 7541 §5.2. This typically indicates corrupted input.
ERROR_BAD_PREFIX (4) from integer functionsEither prefix_bits is outside the range 1–8, or the prefix byte has bits
set in the region reserved for the integer value. Check that the caller is
correctly partitioning the first byte.
debhelpersudo apt-get install debhelper
The debian/control file requires debhelper-compat (= 13).
The mkhpack.spec file has its own Version: field. If it does not match the
VERSION in Makefile, the resulting RPM will have a different version string
from the shared library SONAME. Keep both in sync.
⚠️ LOW CONFIDENCE: mkhpack is a library, not a service, and does not produce log files. If a consuming application logs mkhpack errors, consult that application’s documentation for log file locations.