Match the Makefile, which never sets LZ4_DEBUG for this test. If
LZ4_DEBUG is non-zero, lib/lz4.c #includes <assert.h>, the musl version of
which has a conflicting definition for __assert_fail:
https://www.openwall.com/lists/musl/2019/03/04/6
Fixes build failure:
../../../tests/freestanding.c:173:6: error: conflicting types for '__assert_fail'; have 'void(const char *, const char *, unsigned int, const char *)'
173 | void __assert_fail(const char * assertion, const char * file, unsigned int line, const char * function) {
| ^~~~~~~~~~~~~
In file included from ../../../tests/../lib/lz4.c:270,
from ../../../tests/freestanding.c:49:
/usr/include/assert.h:19:16: note: previous declaration of '__assert_fail' with type 'void(const char *, const char *, int, const char *)'
19 | _Noreturn void __assert_fail (const char *, const char *, int, const char *);
| ^~~~~~~~~~~~~
On Solaris/OpenIndiana hosts forcing (old) C99 means disabling POSIX
2001 functionality, resulting in errors like
In file included from ../../../net/ptah/export/gentoo/working-repos/lz4/programs/bench.c:39:
../../../net/ptah/export/gentoo/working-repos/lz4/programs/util.h: In function UTIL_getOpenFileSize’:
../../../net/ptah/export/gentoo/working-repos/lz4/programs/util.h:156:23: error: implicit declaration of function ‘fileno’ [-Wimplicit-function-declaration]
156 | # define UTIL_fileno fileno
| ^~~~~~
../../../net/ptah/export/gentoo/working-repos/lz4/programs/util.h:325:10: note: in expansion of macro ‘UTIL_fileno’
325 | fd = UTIL_fileno(file);
| ^~~~~~~~~~~
These can be fixed either by forcing a standard to be applied in programs/platform.h or by not forcing the compiler to use an old standard.
Since CMake and Makefile don't force C99 by default either, just drop it from
meson.build.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
The freestanding test is special as it requires reimplementation of
runtime/toolchain functionality. When building with clang where the
compiler is configured to enable the stack-protector by default,
building fails due to missing __stack_chk_fail symbols.
Thefore disable stack protection specifically for this test.
and test resulting compilation in debug mode
and removed visual x64 debug test from appveyor, since it's run from Github Actions,
this will make appveyor a bit faster, and it's the slower test.
- MSVC-specific code is used in some places and compiled only if _MSC_VER is set; however, Clang under Windows also defines this, which reports errors on this non-standard code if the -pedantic-errors compiler flag is set
and make it build the MT version of lz4
with an option that is enabled by default but can be disabled on demand.
Also :
- added make target mesonbuild, for easy local build
- made huge tests friendlier to MT variant, for faster testing time
Since `lz4/programs/Makefile:SRCFILES` explicitly contains source code of lz4 CLI and liblz4, `CMakeLists.txt` must follow this settings.
It also means, lz4 CLI and legacy lz4c must avoid to use `liblz4`.