Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINGW build failing in coverage tests #935

Open
pmqs opened this issue Feb 11, 2024 · 4 comments
Open

MINGW build failing in coverage tests #935

pmqs opened this issue Feb 11, 2024 · 4 comments

Comments

@pmqs
Copy link
Contributor

pmqs commented Feb 11, 2024

Trying out a MinGW workflow (see https://github.com/pmqs/zlib/actions/runs/7862720591/job/21452504884)

I'm running configure, which appears to be ok.

$ ./configure --warn
If this doesn't work for you, try win32/Makefile.gcc.
Checking for shared library support...
Building shared library libz.so.1.3.1.1-motley with gcc.
Checking for size_t... Yes.
Checking for off64_t... No.
Checking for fseeko... Yes.
Checking for strerror... Yes.
Checking for unistd.h... Yes.
Checking for stdarg.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for attribute(visibility) support... No.

It builds fine & the standard tests pass,

gcc -O3 -Wall -Wextra -I. -c -o example.o test/example.c
gcc -O3 -Wall -Wextra  -c -o adler[32](https://github.com/pmqs/zlib/actions/runs/7862720591/job/21452504884#step:6:33).o adler32.c
gcc -O3 -Wall -Wextra  -c -o crc32.o crc32.c
gcc -O3 -Wall -Wextra  -c -o deflate.o deflate.c
gcc -O3 -Wall -Wextra  -c -o infback.o infback.c
gcc -O3 -Wall -Wextra  -c -o inffast.o inffast.c
gcc -O3 -Wall -Wextra  -c -o inflate.o inflate.c
gcc -O3 -Wall -Wextra  -c -o inftrees.o inftrees.c
gcc -O3 -Wall -Wextra  -c -o trees.o trees.c
gcc -O3 -Wall -Wextra  -c -o zutil.o zutil.c
gcc -O3 -Wall -Wextra  -c -o compress.o compress.c
gcc -O3 -Wall -Wextra  -c -o uncompr.o uncompr.c
gcc -O3 -Wall -Wextra  -c -o gzclose.o gzclose.c
gcc -O3 -Wall -Wextra  -c -o gzlib.o gzlib.c
gcc -O3 -Wall -Wextra  -c -o gzread.o gzread.c
gcc -O3 -Wall -Wextra  -c -o gzwrite.o gzwrite.c
gcc -O3 -Wall -Wextra -I. -c -o minigzip.o test/minigzip.c
gcc -O3 -fPIC  -DPIC -c -o objs/adler32.o adler32.c
gcc -O3 -fPIC  -DPIC -c -o objs/crc32.o crc32.c
gcc -O3 -fPIC  -DPIC -c -o objs/deflate.o deflate.c
gcc -O3 -fPIC  -DPIC -c -o objs/infback.o infback.c
gcc -O3 -fPIC  -DPIC -c -o objs/inffast.o inffast.c
gcc -O3 -fPIC  -DPIC -c -o objs/inflate.o inflate.c
gcc -O3 -fPIC  -DPIC -c -o objs/inftrees.o inftrees.c
gcc -O3 -fPIC  -DPIC -c -o objs/trees.o trees.c
gcc -O3 -fPIC  -DPIC -c -o objs/zutil.o zutil.c
gcc -O3 -fPIC  -DPIC -c -o objs/compress.o compress.c
gcc -O3 -fPIC  -DPIC -c -o objs/uncompr.o uncompr.c
gcc -O3 -fPIC  -DPIC -c -o objs/gzclose.o gzclose.c
gcc -O3 -fPIC  -DPIC -c -o objs/gzlib.o gzlib.c
gcc -O3 -fPIC  -DPIC -c -o objs/gzread.o gzread.c
gcc -O3 -fPIC  -DPIC -c -o objs/gzwrite.o gzwrite.c
ar rc libz.a adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o 
gcc -O3 -Wall -Wextra  -o example.exe example.o -L. libz.a
gcc -O3 -Wall -Wextra  -o minigzip.exe minigzip.o -L. libz.a
gcc -shared -O3 -fPIC -o libz.so.1.3.1.1-motley adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo   
rm -f libz.so libz.so.1
ln -s libz.so.1.3.1.1-motley libz.so
ln -s libz.so.1.3.1.1-motley libz.so.1
gcc -O3 -Wall -Wextra -o examplesh.exe example.o  -L. libz.so.1.3.1.1-motley
gcc -O3 -Wall -Wextra -o minigzipsh.exe minigzip.o  -L. libz.so.1.3.1.1-motley


$ make test
hello world
zlib version 1.3.1.1-motley = 0x1311, compile flags = 0xa[9](https://github.com/pmqs/zlib/actions/runs/7862720591/job/21452504884#step:7:10)
uncompress(): hello, hello!
gzread(): hello, hello!
gzgets() after gzseek:  hello!
inflate(): hello, hello!
large_inflate(): OK
after inflateSync(): hello, hello!
inflate with dictionary: hello, hello!
		*** zlib test OK ***
hello world
zlib version 1.3.1.1-motley = 0x13[11](https://github.com/pmqs/zlib/actions/runs/7862720591/job/21452504884#step:7:12), compile flags = 0xa9
uncompress(): hello, hello!
gzread(): hello, hello!
gzgets() after gzseek:  hello!
inflate(): hello, hello!
large_inflate(): OK
after inflateSync(): hello, hello!
inflate with dictionary: hello, hello!
		*** zlib shared test OK ***

but is failing in the coverage test

gcc -O3 -Wall -Wextra -I. -c -o infcover.o test/infcover.c
gcc -O3 -Wall -Wextra -o infcover infcover.o libz.a
rm -f *.gcda

./infcover
1.3.1.1-motley
inflate init: 7160 allocated
prime: 7160 high water mark
force window allocation: 79856 high water mark
force window replacement: 148[32](https://github.com/pmqs/zlib/actions/runs/7862720591/job/21452504884#step:7:33) high water mark
force split window update: 14832 high water mark
use fixed blocks: 7160 high water mark
bad window size: 7160 high water mark
wrong version: 0 high water mark
inflate built-in memory routines
inflate bad parameters
bad gzip method: 7160 high water mark
bad gzip flags: 7160 high water mark
bad zlib method: 7160 high water mark
set window size from header: 14320 high water mark
bad zlib window size: 7160 high water mark
check adler32: 7160 high water mark
bad header crc: 7160 high water mark
check gzip length: 7160 high water mark
bad zlib header check: 7160 high water mark
need dictionary: 14832 high water mark
compute adler32: 79856 high water mark
miscellaneous, force memory errors: 14576 high water mark
inflateBack bad parameters
inflateBack bad state: 7160 high water mark
inflateBack built-in memory routines
invalid stored block lengths-late: 7160 high water mark
invalid stored block lengths-back: 7160 high water mark
fixed-late: 7160 high water mark
fixed-back: 7160 high water mark
invalid block type-late: 7160 high water mark
invalid block type-back: 7160 high water mark
stored-late: [39](https://github.com/pmqs/zlib/actions/runs/7862720591/job/21452504884#step:7:40)928 high water mark
stored-back: 7160 high water mark
too many length or distance symbols-late: 7160 high water mark
too many length or distance symbols-back: 7160 high water mark
invalid code lengths set-late: 7160 high water mark
invalid code lengths set-back: 7160 high water mark
invalid bit length repeat-late: 7160 high water mark
invalid bit length repeat-back: 7160 high water mark
invalid bit length repeat-late: 7160 high water mark
invalid bit length repeat-back: 7160 high water mark
invalid code -- missing end-of-block-late: 7160 high water mark
invalid code -- missing end-of-block-back: 7160 high water mark
invalid literal/lengths set-late: 7160 high water mark
invalid literal/lengths set-back: 7160 high water mark
invalid distances set-late: 7160 high water mark
invalid distances set-back: 7160 high water mark
invalid literal/length code-late: 7160 high water mark
invalid literal/length code-back: 7160 high water mark
invalid distance code-late: 7160 high water mark
invalid distance code-back: 7160 high water mark
invalid distance too far back-late: 7160 high water mark
invalid distance too far back-back: 7160 high water mark
incorrect data check-late: 7160 high water mark
incorrect length check-late: 7160 high water mark
pull 17-late: 7160 high water mark
pull 17-back: 7160 high water mark
long code-late: 7160 high water mark
long code-back: 7160 high water mark
length extra-late: 39928 high water mark
length extra-back: 7160 high water mark
long distance and extra-late: 39928 high water mark
long distance and extra-back: 7160 high water mark
window end-late: 39928 high water mark
window end-back: 7160 high water mark
inflate_fast TYPE return: 7160 high water mark
window wrap: 14832 high water mark
inflate_table not enough errors
fast length extra bits: 7160 high water mark
fast distance extra bits: 7160 high water mark
fast invalid distance code: 7160 high water mark
fast invalid literal/length code: 7160 high water mark
fast 2nd level codes and too far back: 7160 high water mark
very common case: 14832 high water mark
contiguous and wrap around window: 14832 high water mark
copy direct from output: 7[41](https://github.com/pmqs/zlib/actions/runs/7862720591/job/21452504884#step:7:42)6 high water mark
gcov inf*.c
infback.gcno:cannot open notes file
infback.gcda:cannot open data file, assuming not executed
inffast.gcno:cannot open notes file
inffast.gcda:cannot open data file, assuming not executed
inflate.gcno:cannot open notes file
inflate.gcda:cannot open data file, assuming not executed
inftrees.gcno:cannot open notes file
inftrees.gcda:cannot open data file, assuming not executed
No executable lines
make: *** [Makefile:124: cover] Error 1
``
@dbjh
Copy link

dbjh commented Feb 12, 2024

Would the coverage test also be the place to test whether large file support is working properly? Both the MinGW and MinGW-w64 (default build) targets appear to have never worked properly for large files (>4GB). See #934.
BTW the mingw32 toolchain of MinGW-w64 is not the same as MinGW (the original, "MinGW.org").

@madler
Copy link
Owner

madler commented Feb 12, 2024

Would the coverage test also be the place to test whether large file support is working properly?

No. infcover is a deep test of just the inflate code, which has nothing to do with large files. Or with files at all for that matter.

@madler
Copy link
Owner

madler commented Feb 12, 2024

infcover needs to be used with a libz that was built using configure's --cover option. Then you should get output that looks like this:

File 'infback.c'
Lines executed:100.00% of 302
Creating 'infback.c.gcov'

File 'inffast.c'
Lines executed:99.47% of 190
Creating 'inffast.c.gcov'

File 'inflate.c'
Lines executed:95.87% of 823
Creating 'inflate.c.gcov'

File 'inftrees.c'
Lines executed:100.00% of 139
Creating 'inftrees.c.gcov'

@pmqs
Copy link
Contributor Author

pmqs commented Feb 12, 2024

infcover needs to be used with a libz that was built using configure's --cover option. Then you should get output that looks like this:

File 'infback.c'
Lines executed:100.00% of 302
Creating 'infback.c.gcov'

File 'inffast.c'
Lines executed:99.47% of 190
Creating 'inffast.c.gcov'

File 'inflate.c'
Lines executed:95.87% of 823
Creating 'inflate.c.gcov'

File 'inftrees.c'
Lines executed:100.00% of 139
Creating 'inftrees.c.gcov'

Just looking at an Ubuntu build on my dev box, I don't see the coverage code in play at all when I run ./configure --warn; make test.

To get Ubuntu to run the coverage tests I need ./configure --warn --cover; make test cover.

Not sure why the MINGW code is triggering it at all with my previous attempt , given I didn't ask for coverage.

Let's try adding --cover anyway... ok, that makes things 50% better. Now all the gcc builds work fine.

On the flip side, all the clang builds fail (see https://github.com/pmqs/zlib/actions/runs/7874628236/job/21484681152)

/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: libz.a(inflate.o/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld):inflate.c:(.text+0x647a): undefined reference to `llvm_gcda_start_file'
: minigzip.o:minigzip.c/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld:(: .text+0xlibz.af97(): undefined reference to `inflate.o):inflate.c:(.text+0x64ad): undefined reference to `llvm_gcda_emit_function'
llvm_gcda_start_file'
/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: : libz.a(inflate.o):minigzip.oinflate.c::(minigzip.c:(.text+0xfa9): undefined reference to `llvm_gcda_emit_function'
.text+0x64b8): undefined reference to `/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ldllvm_gcda_emit_arcs: minigzip.o:minigzip.c:'
(.text+0xfba)/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: undefined reference to `llvm_gcda_emit_arcs'

This link msys2/MINGW-packages#2148 suggests that coverage on windows with clang is (or has been) broken.

Next try disabling the cover tests for clang. That fails in the standard tests (see https://github.com/pmqs/zlib/actions/runs/7875157382/job/21486417752)

hello world
gzprintf err: 
zlib version 1.3.1.1-motley = 0x1311, compile flags = 0xa9
uncompress(): hello, hello!
		*** zlib test FAILED ***
make: *** [Makefile:85: teststatic] Error 1

I think the gzprintf err: line is from example.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants