Skip to content

Minor fixes for cygwin/msys2 - #311

Closed
rkitover wants to merge 1 commit into
ccache:masterfrom
gnulag:msys2-fixes
Closed

rkitover wants to merge 1 commit into
ccache:masterfrom
gnulag:msys2-fixes

Conversation

@rkitover

Copy link
Copy Markdown
Contributor

Add -Wno-error=implicit-fallthrough to dev.mk so that zlib will compile
with -Werror.

Disable -Wdeprecated-declarations in the mkstemp() shim in util.c so
that it compiles with -Werror.

Fix a couple of erroneous checks in zlib that assume cygwin is the same
as win32.

@rkitover

Copy link
Copy Markdown
Contributor Author

Added autoconf check for -Wimplicit-fallthrough, build should pass now.

rkitover added a commit to visualboyadvance-m/visualboyadvance-m that referenced this pull request Sep 13, 2018
Build zlib before ccache so that ccache does not try to use its bundled
zlib, which does not compile cleanly on cygwin/msys2.

A couple of related PRs for ccache:

ccache/ccache#311
ccache/ccache#310

Replace the usage of xzcat/bzcat in archive unpacking with `xz -dc` and
`bzip2 -dc` because @ZachBacon had some issues with xzcat trying to
compress instead of decompress.

When switching msys2 build modes, unset related env vars first,
sometimes they can get mixed up for some reason.
@afbjorklund

Copy link
Copy Markdown
Contributor

Have you reported these issues in zlib already ? Maybe that mkstemp is used in error, see 6354a40

It would be great if you were able to test the other MSYS fixes, that are proposed in: #246

@afbjorklund afbjorklund added os: windows Related to building or running on Windows issue: portability Caused by OS or platform differences when building or running ccache labels Sep 13, 2018
@rkitover

Copy link
Copy Markdown
Contributor Author

Hi, yes if the mkstemp check for cygwin is a historical artifact, I would suggest removing it, there are very very few people using old versions of cygwin. If there are macros for cygwin/msys2 versions, I could use those as well, I will look. One case of old cygwin usage, is the original msys (not msys2) there are still a very few people sometimes using the original msys releases.

I'll figure out some way to detect all of this, if not by macros then with autoconf.

I will try that PR in my environment.

@rkitover

Copy link
Copy Markdown
Contributor Author

Forgot to say, I will check on the zlib upstream situation as well. The WIDECHAR thing has been around for a while.

@rkitover

Copy link
Copy Markdown
Contributor Author

zlib appears to not have any bug tracking system or public repo available, I will join their -devel list.

@rkitover

Copy link
Copy Markdown
Contributor Author

@afbjorklund I tried to research the mkstemp() issue some more, and was not able to see anything relevant, other than people having issues because mkstemp() forces binary mode.

And this doc:

http://www.cygwin.com/cygwin-ug-net/using-textbinary.html

The mkstemp() and mkstemps() calls force binary mode.
Use mkostemp() or mkostemps() with the same flags as
open() for more control on temporary files.

I think we can safely assume that mkstemp() will force binary under any cygwin?

@afbjorklund

Copy link
Copy Markdown
Contributor

I think we can safely assume that mkstemp() will force binary under any cygwin?

It certainly was broken at the time, and most people don't care about text/binary.

Maybe it is this commit ? The one with mkostemps... Doesn't really matter.
https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=commitdiff;h=8092f467704a09cbfffb553e38f6ca1408c0d9ed

Add -Wno-error=implicit-fallthrough, if the compiler supports it,  to
dev.mk so that zlib will compile with -Werror.

Disable -Wdeprecated-declarations in the mkstemp() shim in util.c so
that it compiles with -Werror.

Stop assuming that mkstemp() is broken on cygwin, I could not find any
documentation for this.

Fix a couple of erroneous checks in zlib that assume cygwin is the same
as win32.
@rkitover

Copy link
Copy Markdown
Contributor Author

@afbjorklund in regards to the mkstemp() issue, the comment says:

mkstemp() on some versions of cygwin don't handle binary files, so override.

I can find no documentation for this claim, the cygwin documentation says binary files are always created.

If it ever did not do this, there is no way to check with a configure test because the behavior would depend on mount point options.

For the time being I just removed the check completely in this PR.

As for zlib, I'm afraid I hit a dead end. The mailing list is dead and requires confirmation by someone who is not responding. There are public repos or issue tracking. I don't think having these minor changes in the zlib directory would be a big deal for the time being.

@jrosdahl jrosdahl changed the title minor fixes for cygwin/msys2 Minor fixes for cygwin/msys2 Oct 2, 2018
@jrosdahl

jrosdahl commented Oct 2, 2018

Copy link
Copy Markdown
Member

@afbjorklund: LGTY?

@jrosdahl jrosdahl added this to the 3.5 milestone Oct 13, 2018
@jrosdahl

Copy link
Copy Markdown
Member

Thanks, applied on master.

Note that the zlib fixes will most likely be lost when we upgrade zlib the next time...

@jrosdahl jrosdahl closed this Oct 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

issue: portability Caused by OS or platform differences when building or running ccache os: windows Related to building or running on Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants