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

fixes for cygwin #4953

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

fixes for cygwin #4953

wants to merge 5 commits into from

Conversation

corngood
Copy link
Contributor

I'm just working on building nix on cygwin. In addition to these changes, I needed to build libeditline locally.

Boost coroutines are also currently broken on cygwin, so I've been using the changes described here:

https://cygwin.com/pipermail/cygwin-developers/2020-September/011970.html

to work around the problem.

@corngood corngood force-pushed the cygwin branch 2 times, most recently from 4220db4 to 9b97dc6 Compare December 22, 2021 01:55
@corngood corngood changed the title wip: fixes for cygwin fixes for cygwin Dec 22, 2021
@corngood
Copy link
Contributor Author

@edolstra are you able to take a look or recommend a reviewer?

This fixes:
src/libmain/shared.cc:173: undefined reference to `sodium_init'
on cygwin.
@stale
Copy link

stale bot commented Jun 20, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Jun 20, 2022
@Artturin Artturin mentioned this pull request Sep 4, 2023
8 tasks
@Ericson2314
Copy link
Member

It would be very good to see this revived! The Nix team is more active now and so we can ensure it won't get neglected.

What is the state of Cygwin/Msys2 cross in Nixpkgs? That one issue would be merging things we cannot CI. But it shouldn't be too hard to fix that.

@stale stale bot removed the stale label Sep 4, 2023
@corngood
Copy link
Contributor Author

corngood commented Sep 5, 2023

This is a better place for what I posted on #8901:

I've never had much trouble building nix on cygwin. What I did have a lot of trouble with is fibers/coroutines, which are used by nix via boost. They are sort of fundamentally broken in cygwin, which causes nix to crash (e.g. on network operations).

I actually proposed a patch to cygwin which allows them to work, but it hasn't been merged:

https://cygwin.com/pipermail/cygwin-developers/2020-September/011970.html

Last time I did any work on this, it was mostly on the nixpkgs side. The idea was to be able to cross compile a patched cygwin1.dll, and use that to bootstrap, and build up from there. Unfortunately I haven't had time to work on it for a while.

I gave up on bootstrapping using unmodified cygwin.

If anyone's interested in seeing where I was going:

https://github.com/corngood/nix/tree/cygwin

It's is a mess of WIP commits, but this will show you the changes from the base:

https://github.com/corngood/nixpkgs/compare/66de24bef8351fb6ee4bd8e75717e99e1ada5794..cygwin

There are some other things in there that I think are important for cygwin, such as stateless rebasing of dlls, and using native symlinks for dlls.

I'd love to get back to this at some point, but performance on cygwin (forking especially) is so bad that it makes it extremely time consuming to build a stdenv.

@Ericson2314
Copy link
Member

OK Awesome! Yes let's take it to the Nixpkgs, and start merging PRs there for your stuff, and then come back to this. :)

@Ericson2314
Copy link
Member

https://www.msys2.org/wiki/How-does-MSYS2-differ-from-Cygwin/ I'm a bit more familiar with MSYS2 than Cygwin; since they are only slightly different I wonder how hard it would be to support both.

@corngood
Copy link
Contributor Author

corngood commented Sep 5, 2023

It sounds like they would have a lot in common, and could probably both use the same method of handling dll dependencies, etc. I have a feeling cygwin is probably better supported as a build target upstream in many packages, but I could be wrong. I was at least able to build all of the gcc stdenv and nix on cygwin (with some hacks and patches).

@Artturin
Copy link
Member

Artturin commented Sep 5, 2023

@corngood @Ericson2314 FYI a improvement to win-dll-links was merged NixOS/nixpkgs#252459, also see the linked PR

@wegank wegank mentioned this pull request Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants