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

Update request: mcfgthreads git → 1.5-ga.2 #233099

Closed
1 task done
panicgh opened this issue May 20, 2023 · 3 comments
Closed
1 task done

Update request: mcfgthreads git → 1.5-ga.2 #233099

panicgh opened this issue May 20, 2023 · 3 comments
Labels
6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: windows Running, or buiding, packages on Windows 9.needs: package (update) This needs a package to be updated

Comments

@panicgh
Copy link
Contributor

panicgh commented May 20, 2023

  • Package name: pkgsCross.mingwW64.windows.mcfgthreads, default.nix
  • Latest released version: 1.5-ga.2
  • Current version on the unstable channel: git (commit from 2021)
  • Current version on the stable/release channel: git, same as unstable
  • Checked the nixpkgs pull requests

The upstream repository is a bit strange. Our current source commit is found but does not belong to any branch. Cloning and inspecting the repo, it looks like the upstream rewrote the entire history (including the root commit) in April 2022. Some files that we delete in postUnpack don't exist any more. Simply bumping the version and hash of the source and cleanup postUnpack makes the new package build, but then mingw doesn't build any more (header file not found and indeed the file doesn't exist any more).

The package pname is mcfgthreads (plural) while the upstream repository and the built DLL is mcfgthread (singular).

The update script to download the patches for GCC from another repo does not work either:
https://github.com/NixOS/nixpkgs/blob/49a1f4a0b4b656b5f810959f49d42026f51701e2/pkgs/development/compilers/gcc/update-mcfgthread-patches.sh

It appears as if the patches are now in branch master_gcc-10. But these are identical to the ones we already have (dated 2018), which don't work with the updated mcfgthread.

I tried to update the pkg myself, but it became too complex for me due to all the issues described above.

Notify maintainers

The package has no maintainer (in fact, no meta at all).

@Ericson2314 (last committer to the package)


Note for maintainers: Please tag this issue in your PR.

@panicgh panicgh added 9.needs: package (update) This needs a package to be updated 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: windows Running, or buiding, packages on Windows labels May 20, 2023
@lhmouse
Copy link

lhmouse commented May 23, 2023

The old implementation, which had the DLL name mcfgthread-12.dll did not make use of libtool, which was partly the reason why static linking was not supported. The new implementation uses libtool for version management and by default builds a static library and a shared library at the same time.

That's already breakage, but there's more: Previously, if a TLS key was deleted, all destructors would be called for each TLS value that had been set with that key, mimicking the behavior of FlsFree() 1. The new implementation tries to be more compliant to standards: Such destructors are only called upon a thread's exit; none of returning from main(), calling exit() and freeing a TLS key shall invoke destructors of TLS keys 2.

The mcf thread model, basing on the new implementation, has been merged into GCC 13 3 and is part of the official release.

Footnotes

  1. https://learn.microsoft.com/en-us/windows/win32/api/fibersapi/nf-fibersapi-flsfree

  2. https://en.cppreference.com/w/c/thread/tss_create

  3. https://github.com/gcc-mirror/gcc/commit/f036d759ecee538555fa8c6b11963e4033732463

@panicgh
Copy link
Contributor Author

panicgh commented Dec 5, 2023

Thanks for the hint of GCC 13, for which the patch should becomes obsolete. And indeed it is applied only to GCC < 13 and already omitted for GCC 13:

++ optional (atLeast6 && !atLeast13 && !withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf")

@panicgh panicgh closed this as completed Dec 5, 2023
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/statically-linked-mingw-binaries/38395/7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: windows Running, or buiding, packages on Windows 9.needs: package (update) This needs a package to be updated
Projects
None yet
Development

No branches or pull requests

3 participants