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

Fix build on latest cygwin64 #367

Closed
wants to merge 1 commit into from
Closed

Conversation

MaEtUgR
Copy link

@MaEtUgR MaEtUgR commented Jun 28, 2018

I wanted to build DroneCore a new SDK for autonomous PX4 drones inside my up to date cygwin64 (Windows 10) setup. zlib is one of the dependencies of DroneCore and the one that made the build fail.

Looking at the Problem I found:

  • cygwin uses GCC windres syntax
  • cygwin doesn't have _wopen and hence we omit WIDECHAR
    (this problem is already fixed on develop and was skipped by git when I cherry-picked)

As Cygwin should be supported according to the documentation I though I might contribute my findings to the develop branch such that they are available in the next release.

With this pr the build works fine and I checked ./example has the expected output:

zlib version 1.2.11.1-motley = 0x12b1, 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!

closes #238 #248 #268

FYI @madler @julianoes

- cygwin uses GCC windres syntax
- cygwin doesn't have _wopen and hence we omit WIDECHAR
@MaEtUgR
Copy link
Author

MaEtUgR commented Nov 25, 2018

I rebased, this fix is currently still valid and needed. Sadly it seems that pull requests here get ignored. I'll try to reach the correct contribution channel e.g. mailing list.

@MaEtUgR
Copy link
Author

MaEtUgR commented Nov 25, 2018

@julianoes I wrote a mail to the developers:

Dear zlib authors and/or developers

I hope this is the appropriate way to suggest changes. If not please forgive me and forward this mail to any necessary list or developer.

I'm PX4 drone autopilot developer and the related DronecodeSDK to monitor and control drones depends on zlib. As Windows user I'm maintaining cygwin support for PX4.

PX4 https://github.com/PX4/Firmware
DronecodeSDK https://github.com/Dronecode/DronecodeSDK
Cygwin https://www.cygwin.com/

Now on cygwin there are two issues with the zlib usage:

  • zlib build error related to fwopen on master (cacf7f1) which is fixed on develop already ✔️:
/cygdrive/c/PX4/home/DronecodeSDK/third_party/zlib/gzlib.c: In function ‘gz_open’:
/cygdrive/c/PX4/home/DronecodeSDK/third_party/zlib/gzlib.c:243:20: warning: implicit declaration of function ‘_wopen’; did you mean ‘fwopen’? [-Wimplicit-function-declaration]
         fd == -2 ? _wopen(path, oflag, 0666) :
                    ^~~~~~
                    fwopen
  • zlib build error related to windres on develop (41d86c7) only with cmake build ❌:
/usr/bin/windres: /cygdrive/c/PX4/home/DronecodeSDK/third_party/zlib/win32/zlib1.rc:7: syntax error
make[2]: *** [CMakeFiles/zlib.dir/build.make:423: CMakeFiles/zlib.dir/win32/zlib1.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/zlib.dir/all] Error 2
make: *** [Makefile:139: all] Error 2

Please consider applying the following patch on top of develop (41d86c7) to solve the second problem:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e108c16..fa073c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -167,7 +167,7 @@ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
 string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
     "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})

-if(MINGW)
+if(MINGW OR CYGWIN)
     # This gets us DLL resource information when compiling on MinGW.
     if(NOT CMAKE_RC_COMPILER)
         set(CMAKE_RC_COMPILER windres.exe)

My suggestion is also available as pull request on GitHub for convenient merging: #367

Thanks a lot in advance!

Best regards
Matthias Grob (alias MaEtUgR)

@MaEtUgR
Copy link
Author

MaEtUgR commented Apr 2, 2020

I'm closing this since there seems to be no maintenance going on since 2017. Pity, I hoped the developer would come back or hand it over to another maintainer.

@MaEtUgR MaEtUgR closed this Apr 2, 2020
@julianoes
Copy link

It looks like there is a maintained fork by chromium but not on GitHub unfortunately.
https://chromium.googlesource.com/chromium/src/third_party/zlib

@Neustradamus
Copy link

@MaEtUgR: Any news with Zlib 1.3.1?

@Neustradamus Neustradamus mentioned this pull request Jan 1, 2025
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

Successfully merging this pull request may close these issues.

cywgin64 build broken under Windows 7
3 participants