-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
zlib: use default configure script on windows #428871
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
Open
greg-hellings
wants to merge
1
commit into
NixOS:staging
Choose a base branch
from
greg-hellings:ucrt/zlib
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+18
−8
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| diff --git a/configure b/configure | ||
| index c55098a..07f7c08 100755 | ||
| --- a/configure | ||
| +++ b/configure | ||
| @@ -243,6 +243,8 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then | ||
| echo "If this doesn't work for you, try win32/Makefile.gcc." | tee -a configure.log | ||
| LDSHARED=${LDSHARED-"$cc -shared"} | ||
| LDSHAREDLIBC="" | ||
| + shared_ext='.dll' | ||
| + SHAREDLIB='libz.dll' | ||
| EXE='.exe' ;; | ||
| QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 | ||
| # (alain.bonnefoy@icbt.com) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be a symlink instead like before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have written about the details of why extensively in other PRs related to Windows cross builds, but the short answer is no. DLL files properly belong under the
bin/folder on Windows, not symlinked there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought there was a setup hook that did this for you, but I guess not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most packages seem to have it automatically done, but I believe that is because of updates to
autotoolsover the years and setting the destination folders properly nowadays. In the early days of MinGW, the post fixup had to be done to every single package as autotools didn't have any real knowledge of DLL files. However, zlib uses its own homegrown system so as not to rely on autotools, so I think that's why it is not handled by the standard scripts and options. If there is an automatic hook that would handle this properly, then I would be happy to use it, instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It happens with my Rust projects, which do not use autotools. Looks like it's called
win-dll-linkThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's fine to symlink transitive DLLs I don't get why it's not fine to symlink DLLs from lib.
I would but the static libs / stub libs in
$dev/lib, and the DLLs in$out/lib.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can also change the hook (in a future PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DLLs properly belong in the
bin/folder on Windows targets. This is because Windows has an extremely limited search path for loading dynamic libraries, but it will always look in the same directory alongside the executing binary. Therefore, the DLLs do not belong in$out/libbut instead belong in$out/bin. This has been established practice for the MinGW packages due to the limitations in Windows search paths and it is how every other package inpkgsCross.mingwW64handles it, it's how autotools handles it, it's how CMake handles it. The final target's$out/binwhen building a.exegets the dependency and transitive dependency DLL files symlinked into place because there is no equivalent to setting LD paths for Windows. There simply is no precedent anywhere else, including in other nixpkgs Windows targets, for putting the DLL file inlib/. It doesn't belong there. It is not a linker-related file, it is a binary executable on Windows.Stub libraries and fully static libraries end up in
lib/because they are used at link time but are not necessary to distribute alongside binary files unless you are intentionally distributing build products to enable a downstream dev environment. They could live in$dev/libor$out/libdepending on the purpose of the parent package, but that's a moot discussion here.The only reason this difference is exposed here is because zlib has a custom, hand-rolled build system instead of using something like autotools. This change is just maintaining how the library already works, but enabling it to be built for Windows with LLVM compilers. This move is not introducing anything new or altering existing behavior. Here is the current output of building
pkgsCross.mingwW64.zlibwithout this patch:We really should put this information up in the packaging guidelines somewhere so it doesn't need to be reiterated on every pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am very aware how windows search paths work. I am just wondering out loud if we can automate it, because us devs who care about Windows is a much much smaller population than the other major platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#431820
I am opening a separate issue for this point, which is a general disagreement on policy separate from zlib in particular.