-
Notifications
You must be signed in to change notification settings - Fork 177
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
cross platform support (e.g. with CMake)? #62
Comments
@pieper can you try the branch below which adapts @ningfei's Cmake super build scripts. These scripts have been used for years with dcm2niix. One clever feature is you can specify the ZLIB_IMPLEMENTATION to be You can try this out with the following command:
I would be happy if @madler would consider including this Cmake script in the main pigz repository (though he might choose whether the System zlib should be the default). Since the Cmake uses the glibc of your system, it would be great to test if these address issue 68. None of my computers have ever exhibited that issue, it would be great to know that it has been addressed. |
@pieper the current CMake scripts support Unix (MacOS and Linux), but not Windows. There is a fork of pigz that supports Windows, albeit v2.3.1 versus v2.4. @ningfei's dcm2niix scripts do support Windows, so maybe he can can extend this to pigz. It would be nice to have Windows support be part of the main trunk and even better if users can leverage the Cloudflare zlib. |
See also the discussion here: https://discourse.vtk.org/t/cloudflare-zlib/2330/7 |
|
@dzenanz, you are correct that |
About 50% of programmers use Windows, and that percentage is much greater for ordinary users. If you don't have to support Windows (for whatever reason), PIGZ is fine. If you do (as all multi-platform libraries aim to do), PIGZ is out of the question. |
@dzenanz point taken. I evaluated znzlib since it is used by several of the most popular tools in my field (AFNI, FSL, FreeSurfer) and those tools only target Unix (though many Windows users run them via Windows Subsystem for Linux). I do not people have ported pigz to Windows, though I do not know if they have added modern CMake support or if pipes work with those. Using a pipe does have performance benefits. @ningfei is a Cmake guru who developed the dcm2niix scripts to work on Windows, Linux and MacOS as well as the Unix pigz CMake from my repository. Your comments might give him the incentive to look at making a CMake script for pigz that includes all the operating systems. |
@ningfei thanks for looking into this. As you note, forks of pigz that support the Microsoft compiler are based on pigz 2.3.1, which predates piped storage and the notes go up to Visual Studio 2012 (and remake instead of CMake). There are Windows compatible executables for pigz 2.4 built using gcc on MSYS2. I know the recent versions of Microsoft compilers have improved their compatibility with GCC conventions. Popular tools in my field (FSL, AFNI) only support Unix (though they run fine on Windows Subsystem for Linux), and the vtk thread linked above suggests the developers of that tool prefer libraries over stand alone applications. @madler can you tell us how to proceed. To summarize @pieper asked for an
|
Sure, you can generate a pull request for a CMake script, and I'll include it. However it sounds like your script does not resolve the original request for Windows support. |
You are correct, the CMake script currently only supports MacOS and Linux. It has the general benefits of CMake (detecting capabilities, installing missing components) and liabilities (requiring CMake), plus the added benefit of simplifying building with optimized zlib. So it would be a simple alternative to the current make file. Before I make a pull request, I make a call out to Windows developers to see if anyone wants to extend the CMake script to Windows. @kjk do you have any interest in this? |
@madler I need some guidance on how to proceed with the pull request. There are three options:
I am happy to follow any path you recommend, would just like to know your preference. I appreciate all your work to the community, and respect that ultimately you must maintain this code. |
@neurolabusc to minimize use of #ifdef and amount of changes I would recommend using utf8 on windows Do WCHAR -> utf8 at the beginning of wmain. Do utf8 => WCHAR conversions in leaf functions like "file open". That way most of the code is unchanged. |
@kjk would you be interested in trying to implement this? I was worried there would be a lot of changes, including the
I have very little experience with MSVC, so having someone with more experience would be greatly appreciated. |
MSVC WCHAR -> utf8 (madler#62)
@kjk, @dzenanz and @pieper I would be grateful if you could try out my fork's latest release. I have implemented @kjk's suggestion of converting WCHAR -> utf8 at the beginning of wmain. This results with minimal changes and in my testing handles both Latin and non-Latin filenames. Since utf8 is used internally, I believe the Assuming everyone is happy with the Windows compilation, the final step is to implement CMake for Windows. I have updated @ningfei's CMake script to compile with |
@jcfr would you be interested in helping @pieper out on this. I notice you do a lot of the CMake commits for your joint tools. The new pigz CMake scripts work on Linux and MacOS, and a tiny command line script compiles this for Windows. However, I am very unfamiliar with CMake, and it is unclear to me how to link the pthread library for Windows. Failing that, can you suggest a Windows CMake guru who can help out. I notice that other tools like Blender use CMake to link the Pthread library on Windows. |
Hi @neurolabusc , sorry to leave you hanging on this but it's not really in my critical path and I know how much time it can take to iron out all the details when you mix windows, cmake, and legacy code. It's not that it cannot be done, thing just tend to pop up over time so long term maintenance may always be an issue (for example we keep a fork of libarchive in Slicer that ends up needing debugging from time to time on various platforms. |
@pieper it should be fully functional now. I no longer need any help. I have submitted a Pull Request so just waiting for @madler to review. |
Could you be so kind to generate the latest |
I'm really looking forward to see the PR implemented to the source code. We use that windows implementation of pigz but it is kind of outdated. So would be awesome if we could build for windows from the original repo. I'm subscribing this topic and the PR to receive any news. |
If someone would like to make an .exe, I can include it in the distribution. I don't have a Windows machine. |
@madler you can get a Windows executable from here: The executable is v2.4, which was current when the PR was submitted. I am happy to recompile to v2.6 once the PR is merged. |
Not fully tested but two versions here: one built using MingW GCC 10.2, one built using Visual Studio 2019 Version 16.8. Both based on the latest code of pigz 2.6 and PR #77 (I merged them locally), using the CloudFlare zlib with intrinsics enabled. I've actually been trying to setup a CI pipeline so we can easily get the executables, but don't have enough time to finish it... |
@neurolabusc Do you have an executable with large file support? I'm getting this error when I try to compress a 40gb file: |
@dieperdev I submitted my pull request to support Windows appropriately four years ago, and it has yet to be reviewed. My sense is that supporting this platform is not a priority for the lead developer. I really only want to support this if it can be made part of the core code base to support all users and be maintained. Therefore, I am focusing my development efforts elsewhere. Happy to renew my work if @madler or another maintainer wants to merge my contributions or suggest how my work could be improved to allow a merge. |
Both of them crash on my end (Core2Duo with SSE3).
pigz_Windows.zip works, |
@neurolabusc maybe the repo needs an update, since pigz 2.8 is available now. Also I think it would be helpful to have a GitHub Actions setup that compiles the binary (for tagged commits). With this we don't need a full local development environment just for compiling the new binaries. |
Personally I would like to see a setup like GNU uses which is quite simple (using bootstrap, config and make). https://github.com/DanielRuf/gzip-windows-build/blob/main/.github/workflows/main.yml |
@DanielRuf it has been 53 months since I submitted PR#77. I am reluctant to invest time if there is no chance of my efforts being merged - I did target the current pigz when I made my PR. I am happy to put effort into this if there is a chance that the subsequent PR has a chance of being part of the main project. @madler can you provide any guidance on how to proceed. I think many would benefit if pigz could support non-Latin characters for the Windows operating system. |
We'd be interested in using pigz as a library in our application and would want to support Windows, Linux, and Mac with a uniform build system that supports native compilers (e.g. Visual Studio, not mingw). CMake has been our go-to solution for that so it would be great if pigz had CMake support.
Has anyone looked into CMake for pigz before?
The text was updated successfully, but these errors were encountered: