Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 643916 - [prefix/cygwin] sys-libs/zlib-1.2.11: Emerge fails on prefixed cygwin with USE="minizip"
Summary: [prefix/cygwin] sys-libs/zlib-1.2.11: Emerge fails on prefixed cygwin with US...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Other
: Normal major (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-08 16:38 UTC by Sven Eden
Modified: 2018-01-18 10:43 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch zlib-1.2.11.ebuild to zlib-1.2.11-r1.ebuild (fix_zlib_on_cygwin.patch,1.45 KB, patch)
2018-01-08 16:41 UTC, Sven Eden
Details | Diff
Patch contrib/minizip to build on gentoo prefixed cygwin (zlib-1.2.11-minizip-cygwin.patch,938 bytes, patch)
2018-01-08 16:42 UTC, Sven Eden
Details | Diff
New patch for zlib-1.2.11-r1.ebuild (fix_zlib_on_cygwin.patch,1.79 KB, patch)
2018-01-11 16:06 UTC, Sven Eden
Details | Diff
Additional patch to make zlib.pc to report the correct sharedlibdir. (zlib-1.2.11-pkgconfig-cygwin.patch,691 bytes, patch)
2018-01-11 16:09 UTC, Sven Eden
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Eden 2018-01-08 16:38:56 UTC
I need to have zlib built with USE="minizip", which abysmally fails.

The reasons are:

1. When using the minizip USE flag, src_prepare() cd's into contrib/minizip, but does not cd back again. The result is, that the following sed'ing of "win32/zlib.def" fails with a "file not found" message.

2. Building the minizip shared dll is ended with the message, that libtool can only build shared libraries on cygwin if -no-undefined is provided.

3. In contrib/minizip/ioapi.c it is assumed, that non-apple systems have fopen64() and friends. This is not true for cygwin. We have to use plain fopen(). This leads to linking failures due to undefined references.

4. When using cygwin with gentoo prefix, the gentoo build system is used. This means this is not windows. Using the fixed windows files instead of the GNU configuration leads to other errors like:
  "gzlib.c:14:17: warning: implicit declaration of function ‘lseek’ [-Wimplicit-function-declaration]"

Reproducible: Always

Steps to Reproduce:
1. USE="minizip" emerge -1 zlib

Actual Results:  
Emerge fails

Expected Results:  
Emerge succeeds

I have fixed it (!!)for me(!!) and kindly asked for review, and eventual inclusion for cygwin prefixes, of my patches.

The patches follow this submission.

Thanks and cheers

Sven
Comment 1 Sven Eden 2018-01-08 16:41:15 UTC
Created attachment 513772 [details, diff]
Patch zlib-1.2.11.ebuild to zlib-1.2.11-r1.ebuild

This patches the ebuild to patch contrib/minizip if used, and removes the usage of win32/Makefile.gcc
Comment 2 Sven Eden 2018-01-08 16:42:35 UTC
Created attachment 513774 [details, diff]
Patch contrib/minizip to build on gentoo prefixed cygwin

This patch is needed by the patched ebuild. It adds -no-undefined to libminizip_la_LDFLAGS and switches fopen64() and frinds to their non-64 counterparts.
Comment 3 Sven Eden 2018-01-11 16:06:46 UTC
Created attachment 514230 [details, diff]
New patch for zlib-1.2.11-r1.ebuild

I have made somne false assumptions about how zlib can be built on cygwin.

Apart from that I discovered, that there are more issues than I thought.

This new patch fixes the build, so that the dynamic cygz.dll is actually built and installed.
Further the .pc files are fixed. They are utterly broken with the stock ebuild.
(Symptoms:
  - file-5.32.ebuild breaks in configuration stage, because it can not find libz
  - "pkg-config --cflags|--libs zlib" report wrong flags.)
Comment 4 Sven Eden 2018-01-11 16:09:05 UTC
Created attachment 514232 [details, diff]
Additional patch to make zlib.pc to report the correct sharedlibdir.

Unfortunately win32/Makefile.gcc has an error:
It installs the dynamic cygz.dll in BINARY_PATH, but sets sharedlibdir to LIBRARY_PATH.

This patch fixes that, so packages searching for cygz.dll using pkg-configure --libs zlib will no longer fail.
Comment 5 Larry the Git Cow gentoo-dev 2018-01-17 17:20:38 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=03d80d896aa99447ff64cc89078b20b2d7755441

commit 03d80d896aa99447ff64cc89078b20b2d7755441
Author:     Michael Haubenwallner <haubi@gentoo.org>
AuthorDate: 2018-01-17 17:19:51 +0000
Commit:     Michael Haubenwallner <haubi@gentoo.org>
CommitDate: 2018-01-17 17:20:14 +0000

    sys-libs/zlib: apply minizip cygwin patches
    
    Let's see how Cygwin upstream patches for minizip can help here.
    
    Closes: https://bugs.gentoo.org/643916
    Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/zlib/Manifest              |  2 ++
 sys-libs/zlib/zlib-1.2.11-r1.ebuild | 19 +++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)
Comment 6 Sven Eden 2018-01-18 10:43:51 UTC
Just wanted to confirm that the new ebuild and patches work very well and exactly as expected.

Thank you very much!