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

MinGW: Enable C++ threads with mcfgthreads #73195

Merged
merged 11 commits into from Nov 12, 2019

Conversation

@Ericson2314
Copy link
Member

Ericson2314 commented Nov 11, 2019

Motivation for this change

This uses https://github.com/lhmouse/mcfgthread to get C++ threads with mingw without the slow POSIX threads emulation. The bootstrapping infrastructure is set up so this is factored through threadsCross attribute which could be parameterized to support both gthreads (GCC's threading interface) implementations. In any case, the threading library is built with gccCrossStageStatic + libcCross / lldClangNoCXX, which works.

I declare this worth merging because I cross compiled Nix with it!

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @angerman @volth

@Ericson2314 Ericson2314 requested a review from matthewbauer Nov 11, 2019
@Ericson2314 Ericson2314 requested a review from nbp as a code owner Nov 11, 2019
@ofborg ofborg bot added the 6.topic: fetch label Nov 11, 2019
@Ericson2314 Ericson2314 force-pushed the Ericson2314:mingw-mcfthreads branch from 95e70af to ab2de9b Nov 11, 2019
Ericson2314 added 2 commits Nov 11, 2019
Currently this is set up to be mcfgthreads, but it could be something
else instead.
Seems to build just fine without it, maybe it was just using C++ threads
which mcfgthread provides?
@Ericson2314 Ericson2314 force-pushed the Ericson2314:mingw-mcfthreads branch from ab2de9b to 89ec69e Nov 11, 2019
Ericson2314 added 3 commits Nov 11, 2019
Working around broken build for now.
I think those deps could be made to build, but I didn't want to get
bogged down investigating further. "Use flags" are always a good thing,
so this is fine for now.
@Ericson2314 Ericson2314 merged commit 01429fc into NixOS:master Nov 12, 2019
15 checks passed
15 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
gcc, nghttp2, openssl, pcre on aarch64-linux Success
Details
gcc, nghttp2, openssl, pcre on x86_64-darwin Success
Details
gcc, nghttp2, openssl, pcre on x86_64-linux Success
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A darwin-tested
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release-combined.nix -A tested
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
@Ericson2314 Ericson2314 deleted the Ericson2314:mingw-mcfthreads branch Nov 12, 2019
@Ericson2314 Ericson2314 mentioned this pull request Nov 12, 2019
2 of 4 tasks complete
@angerman

This comment has been minimized.

Copy link
Contributor

angerman commented Nov 12, 2019

This is pretty neat as it will likely allow to build rocksdb, however, we should note the following somewhere I believe:

This project uses a number of undocumented NT system calls for efficiency reasons and may be broken in future Windows versions.
The author gives no warranty for this project. Use it at your own risk.

I'm not sure what implications this might or might not incur wrt to building and distributing binaries for windows.


stdenv.mkDerivation {
pname = "mcfgthreads";
version = "git";

This comment has been minimized.

Copy link
@Mic92

Mic92 Nov 12, 2019

Contributor

We usually use date of commit here instead of git.

@Ericson2314

This comment has been minimized.

Copy link
Member Author

Ericson2314 commented Nov 12, 2019

@angerman I think it's probably fine for now; MS cares more about binary compat that anyone else, including these sorts of unstable interfaces. If it becomes a problem, it's all set up to be easy to switch to the pthreads emulation approach.

@Mic92 Thanks, will fix.

@tex tex mentioned this pull request Nov 15, 2019
6 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.