1
0
mirror of https://github.com/lz4/lz4.git synced 2026-10-24 01:48:57 +03:00

188 Commits

Author SHA1 Message Date
Yann Collet
c0a1b631e6 review round 12: LZ4F_uncompressedUpdate() supports linked blocks ; CLI threads capped by file jobs and memory budget, with warnings ; Windows and Makefile fixes (checkpoint)
lz4frame :
- LZ4F_uncompressedUpdate() accepts linked blocks (dev and v1.10.0 could silently corrupt such frames) :
  single-threaded mode drops the LZ4 state's history when an uncompressed segment starts
  (the decoder's history contains the uncompressed data) ; multi-threaded mode needs nothing,
  jobs reload the 64 KB actually preceding them. LZ4F_compressBegin() now starts frames in compressed mode :
  the mode of the previous frame's end was kept, which skipped the history drop (frame corrupted with a dictionary).
- Windows : worker stacks reserved instead of committed (STACK_SIZE_PARAM_IS_A_RESERVATION) ;
  #error when <windows.h> was already included without the Vista API (amalgamated sources) ;
  doc : no multi-threaded context use nor release under the loader lock (DllMain, DLL global objects).
lib/Makefile, programs/Makefile : threads detection skipped by goals building nothing threaded (clean, uninstall, ...),
run once per command (sub-makes inherit it) : make install probes once instead of 2-4 times, make clean never.
lz4 : explicit -T# also limited to the jobs of each file (-T1000 on a 10 MB file : 3 workers, RSS 298 -> 27 MB at -9),
and by the memory budget on all systems (-T99999 : 1024 liblz4 maximum, 331 threads within the 4 GB default budget) ;
an explicit nb of threads reduced triggers a warning (automatic : only with -v).
tests : frametest testUncompressedLinked (linked blocks, dictionary made of input, frames ending uncompressed),
mixed updates and small-dst scripts and fuzzer with linked blocks ; frameMT uncompressed segments with linked blocks ;
ossfuzz stream and uncompressed round-trip fuzzers with linked blocks ; test-lz4-multithread budget warnings.
2026-10-22 12:58:19 -07:00
Yann Collet
869ed8083f build: shared pthread probe within a private directory, also for programs (checkpoint)
Prototype, not intended for a PR as is.

programs/Makefile probed pthread with a fixed have_pthread.c in its directory
(pre-existing in dev) : concurrent invocations collided (24 / 192 concurrent probes
wrongly reported no threads, producing an lz4 CLI without multi-threading),
and read-only source trees made it fail.

- build/make/lz4defs.make : PTHREAD_PROBE, evaluated with the CC and ALLFLAGS of
  the invoking Makefile, within a private temporary directory (mktemp -d).
- lib/Makefile and programs/Makefile employ it (lib/'s copy from previous commit removed).

Validated : probes of lib/ and programs/ (192 concurrent, read-only trees), full tests
MT / no-MT, ASAN+UBSAN, TSAN, make test, wine, CLI build (lz4 multithread, lz4-nomt not),
build policies, install scenarios + test_install.sh.
2026-10-22 04:26:50 -07:00
Yann Collet
0852fddadc lz4frame: streaming multi-threaded compression, persistent pool, CLI uses it (checkpoint)
Prototype, not intended for a PR as is.

- persistent thread pool within LZ4F_cctx (pthread / Win32), replaces the per-call fork-join;
  nbWorkers is now the nb of worker threads (the calling thread also runs jobs while waiting).
- streaming : LZ4F_compressUpdate() / LZ4F_flush() / LZ4F_compressEnd() cut input into jobs
  (4 MB linked, 1 MB independent), at fixed positions of the content; outputs emitted in order;
  input read in place with stableSrc or autoFlush, copied otherwise; autoFlush respected;
  LZ4F_compressBound() covers jobs in flight; LZ4F_uncompressedUpdate() drains pending jobs.
- one-shot compression goes through the same engine.
- CLI : frame compression goes through LZ4F streaming with nbWorkers (output identical to
  previous CLI, and lz4 == lz4-nomt); custom block sizes fall back to single-thread.
- build systems compile the CLI's liblz4 sources with LZ4F_MULTITHREAD.
- tests/frameMT.c : streaming validation (slicing, stableSrc, flushes, autoFlush,
  uncompressed segments, exact bounds, abandoned frames).
2026-10-22 04:26:50 -07:00
Yann Collet
6f8f65d2c4 fix minor yet complex issue involving thread pool
in the context of multiple Makefile invoking each other.
2026-01-25 12:02:46 -08:00
Yann Collet
b1e83528d3 static library built with multiconf.make 2025-05-05 17:12:23 -07:00
Yann Collet
c9c9bf8c12 added multiconf doc 2025-05-01 16:53:52 -07:00
Yann Collet
cde9d9c98b fixed: LIBDIR variable name no longer employed in programs/Makefile
since this variable can theoretically be used
to guide some custom installation process of the library.
2025-04-30 17:06:44 -07:00
Yann Collet
e77b14f8ad update multiconf.make 2025-04-30 17:06:44 -07:00
Yann Collet
5387a1595c support *_SRCDIRS 2025-04-30 17:06:44 -07:00
Yann Collet
1d05c07a37 also works for lz4 on Windows (mingw) 2025-04-30 17:06:44 -07:00
Yann Collet
3df0068022 premiere application de multiconf.make
limitee a programs/
2025-04-30 17:06:43 -07:00
Yann Collet
04341f1974 changed Makefile variable HAVE_THREAD -> HAVE_MULTITHREAD
and updated documentation `programs/README.md`
2024-07-06 01:55:50 -07:00
Yann Collet
71ef5b7256 Makefile: automatic MT detection under native msys2/mingw64 2024-07-05 18:52:46 -07:00
Yann Collet
604122c848 Makefile build automatically detect multithreading for Windows 2024-07-05 18:11:37 -07:00
Yann Collet
043745887c fixed tsan warnings
and gate some assert() to be triggered only when no TSAN test is ongoing
2024-07-05 13:52:35 +02:00
Yann Collet
540b539979 change INSTALL_DIR into MAKE_DIR
INSTALL_DIR is apparently used by cmake
2024-01-20 23:06:14 -08:00
Yann Collet
cbe7211b9c make: fix lz4 mt compilation on linux/posix
now lz4 build defaults to single-thread mode
2023-12-28 16:26:01 -08:00
Yann Collet
5c9e349c4a changed test name cpp->cxx
cpp evokes the C PreProcessor, rather than C++
2023-12-24 17:09:52 -08:00
Yann Collet
fc25339a22 rename variable to LIBDIR for consistency 2023-12-24 15:57:54 -08:00
Yann Collet
fe18314de0 more thorough target classification for programs/Makefile
also:
- target `all` also produces symlinks `unlz4` and `lz4cat`
- user-provided `CFLAGS` are appended, so have higher priority
- `-O3` is no longer erased when `CFLAGS` is provided via environment variables
- No more usage of non-standard `MOREFLAGS`
- Better centralized `clean` logic
  + as a consequence of noticing that Windows' Makefile doesn't necessarily $(EXT) suffix to properly delete executable
2023-12-21 18:04:19 -08:00
Yann Collet
e2cb69c7ea SED can be defined on command line and with environment variables 2023-12-17 15:25:51 -08:00
LocalSpook
e270f2edd9 Make Makefile version number parsing more robust 2023-10-11 18:58:47 -07:00
Yann Collet
596c747211 make UNAME externally definable
on top of providing a central definition place, which eases maintenance,
it might also help for #1021.

Also : updated doc
2021-08-16 16:43:17 -07:00
Yann Collet
aeac6227d2 Merge pull request #999 from pekdon/solaris-10
add -lrt on Solaris 10, required for nanosleep
2021-08-06 19:10:00 +02:00
Eddy Jansson
eba110ad5b Print target directories during 'make install'.
This takes #975 to its logical conclusion.
2021-07-24 17:20:37 +02:00
Claes Nästén
c756d90da9 add -lrt on Solaris 10, required for nanosleep 2021-06-02 09:09:16 +02:00
Yann Collet
5a551754cf Merge branch 'dev' into Makefile
remove `LN_S`
2020-11-30 16:09:22 -08:00
Yann Collet
e585a438c7 refactor Makefile
remove usage of include Makefile.inc in too Makefile
as it seems to somehow unexport CFLAGS ...
2020-11-30 16:06:50 -08:00
Yann Collet
165fdddc28 install links over existing install
ensures links are created
2020-11-30 05:13:38 -08:00
Yann Collet
87a80acbe7 updated license & header dates 2020-11-25 14:45:14 -08:00
Yann Collet
0760724577 update doc 2020-11-15 01:31:09 -08:00
Yann Collet
3dd34df751 added target lz4-wlib
variant of lz4 linking to liblz4 dynamic library

requires the dynamic library to expose static-only symbols (experimental API)

Example for #888
2020-08-11 14:07:51 -07:00
JPeterMugaas
7136489d33 More build imrpvements
Moved a few other tests to Makefiles.inc.  Other things might need to go there.
Made a test for symlink appropriateness.  Windows can NOT handle them the same way Unix-like operating systems do (if at all).  This is mostly the same as the Visual C projects.
embed version info into .dll and .exes that are redistributed.
2019-04-23 07:44:00 -04:00
JPeterMugaas
5e6807fd95 Make programs/Makefile use the includes. 2019-04-22 17:38:43 -04:00
JPeterMugaas
773b66547f Initial commits from diff I submitted earlier 2019-04-22 13:48:59 -04:00
Yann Collet
8d76c8a44a introduce LZ4_DISTANCE_MAX build macro
make it possible to generate LZ4-compressed block
with a controlled maximum offset (necessarily <= 65535).

This could be useful for compatibility with decoders
using a very limited memory budget (<64 KB).

Answer #154
2019-04-11 14:15:33 -07:00
Vincent Torri
0360981f68 Allow installation of lz4 for Windows 10 with MSYS2 2019-03-03 22:06:38 +01:00
Vincent Torri
0314027051 Allow installation of lz4 for Windows (MSYS2 or when cross-compiling) 2018-11-20 21:08:23 +01:00
Lucas Holt
3318d573ba Add support for MidnightBSD 2018-09-08 14:46:54 -04:00
Yann Collet
d136118ea9 Merge pull request #556 from kou/add-missing-exeext
Add missing $(EXT)
2018-09-05 15:55:34 -07:00
Kouhei Sutou
9c457ccb7a Add missing $(EXT) 2018-08-13 14:17:54 +09:00
fbrosson
2149b1a8f6 Add Haiku as a validated target.
lz4 1.8.2 works fine on Haiku and passes all tests.
2018-05-17 16:52:53 +00:00
Nick Terrell
a7cc0b590a Fix make install
* Uninstall didn't remove the pkg-config correctly.
* Fix `mandir`
* Allow overriding either upper- or lower-case location variables, but
  always use the lower case variables.
* Add test case that ensures overriding both upper- and lower-case
  variables is the same, and that the directory is empty after uninstall.
2018-05-04 13:50:23 -07:00
Yann Collet
ac38ffa9af updated manuals to v1.8.1 2018-01-13 18:46:13 -08:00
Yann Collet
ee5332438b minor Makefile fixes 2017-09-06 17:41:44 -07:00
Yann Collet
c4d6884cd8 build: source files sorted in a FS independent manner
to be more compatible with reproducible builds.
patch inspired by @bmwiedemann
2017-08-26 12:22:51 -07:00
Yann Collet
c04655bebf fixed make recurrence from /tests 2017-08-24 17:58:13 -07:00
Yann Collet
82ccdec2fb minor : added header license 2017-08-24 16:59:47 -07:00
Yann Collet
68040a76ad fixed man directory installation (#337)
also : lz4c is now a symlink to lz4
2017-08-23 17:53:45 -07:00
Yann Collet
01cdbfb5fe lz4c legacy commands are now enabled at runtime based on link/binary name "lz4c"
instead of selected at compilation time depending on a macro.
This design makes it possible to have a single binary which supports both modes.

An advantageous side effect is that when doing `make; make install`
no additional binary is created during `make install`
(it used to create `lz4c`, because `make` would only build `lz4`)
2017-08-14 16:56:05 -07:00