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

Openssl mingw fix #108170

Merged
merged 1 commit into from Apr 27, 2021
Merged

Openssl mingw fix #108170

merged 1 commit into from Apr 27, 2021

Conversation

brano543
Copy link
Contributor

@brano543 brano543 commented Jan 1, 2021

Motivation for this change

Corrected cross-compilation to Windows for OpenSSL 1.1.

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 nixpkgs-review --run "nixpkgs-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.

@brano543
Copy link
Contributor Author

brano543 commented Jan 1, 2021

Hello community,

I see that my fix is breaking this line https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix#L395. I am not that advanced in Nix. Could you please help on correcting that part?

@SuperSandro2000
Copy link
Member

Hello community,

I see that my fix is breaking this line https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix#L395. I am not that advanced in Nix. Could you please help on correcting that part?

You removed openssl from inputs and the function there still calls it with openssl. I think you need to remove openssl there but I am not sure if your PR is correct otherwise.

@brano543
Copy link
Contributor Author

brano543 commented Jan 1, 2021

Hello community,
I see that my fix is breaking this line https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix#L395. I am not that advanced in Nix. Could you please help on correcting that part?

You removed openssl from inputs and the function there still calls it with openssl. I think you need to remove openssl there but I am not sure if your PR is correct otherwise.

Thank you for the explanation. I will need to correct the commit so that it can take both coreutils and perl as input parameters while still using buildPackages for mingw build.

@brano543
Copy link
Contributor Author

brano543 commented Jan 1, 2021

Succcessfuly tested builds:

  • native
  • lib.systems.examples.mingwW64
  • lib.systems.examples.armv7a-android-prebuilt
  • aarch64-android-prebuilt

@brano543
Copy link
Contributor Author

brano543 commented Jan 2, 2021

Result of nixpkgs-review pr 108170 1

@brano543
Copy link
Contributor Author

brano543 commented Jan 2, 2021

@SuperSandro2000: I am having trouble to add @peti as reviewer. There is no option for me to add any user as reviewer. Could you please help me?

@flokli flokli requested a review from peti January 2, 2021 23:33
@flokli
Copy link
Contributor

flokli commented Jan 2, 2021

I tried building this locally, but there seems to be a patch gone missing:

❯ nix-build -A pkgs.pkgsCross.mingwW64.openssl_1_1
these derivations will be built:
  /nix/store/a12yra4nkkgcmigsq9h6qnx8ydi74ad9-stdenv-linux.drv
  /nix/store/3iw31akfh9h4455dhs6snmdz2k2l827f-mingw-w64-6.0.0-x86_64-w64-mingw32-headers.drv
  /nix/store/43l438jsccs6v3z31jjyzdyqyq8a4j9j-x86_64-w64-mingw32-binutils-2.34.drv
  /nix/store/jq4xbnxrip310cbj2hxazh96xmlf2p5q-x86_64-w64-mingw32-binutils-wrapper-2.34.drv
  /nix/store/k4spm1bmj8cwxg3hnz2yil3hncw95ghh-x86_64-w64-mingw32-stage-static-gcc-debug-10.2.0.drv
  /nix/store/wc8g0a8n3di1ybn898bmf956k30y94gm-x86_64-w64-mingw32-stage-static-gcc-debug-wrapper-10.2.0.drv
  /nix/store/gq1dix827kik7m81vqflz09wv3m4m42m-stdenv-linux.drv
  /nix/store/sym3i6lb0gk3w8zdh97p574vkb76gcis-mingw-w64-6.0.0-x86_64-w64-mingw32.drv
  /nix/store/q1n84n2g1h7vg5pxzw9bjb0mwk5zgwn8-x86_64-w64-mingw32-binutils-wrapper-2.34.drv
  /nix/store/0n81lj0ypj4afr6ciml7jh6h2hb5gkv8-x86_64-w64-mingw32-stage-static-gcc-debug-wrapper-10.2.0.drv
  /nix/store/cf9i2f70dwipk6mx3gscgv7drnswbkhk-stdenv-linux.drv
  /nix/store/1hmw26bphrsh5xw17hykxz10abif5k3y-mcfgthreads-git-x86_64-w64-mingw32.drv
  /nix/store/v6ahf53lbv7zgxdxh6lwwnif4i7934rc-9000-gcc-10-branch-Added-mcf-thread-model-support-from-mcfgthread.patch.drv
  /nix/store/m4xaqmy5g4xd71dbxqmp4qz37q7a894q-x86_64-w64-mingw32-stage-final-gcc-debug-10.2.0.drv
  /nix/store/sh4dw58v41f2nzi6s0ylwj60i2lglx8z-x86_64-w64-mingw32-stage-final-gcc-debug-wrapper-10.2.0.drv
  /nix/store/n5jsh4xymd8qrmciinqkxxkpq9jsvgvg-stdenv-linux.drv
  /nix/store/pr4g43p07pcj49ldcqimnwnnbc6q0bb9-openssl-1.1.1i-x86_64-w64-mingw32.drv
building '/nix/store/v6ahf53lbv7zgxdxh6lwwnif4i7934rc-9000-gcc-10-branch-Added-mcf-thread-model-support-from-mcfgthread.patch.drv'...
building '/nix/store/43l438jsccs6v3z31jjyzdyqyq8a4j9j-x86_64-w64-mingw32-binutils-2.34.drv'...
building '/nix/store/a12yra4nkkgcmigsq9h6qnx8ydi74ad9-stdenv-linux.drv'...
building '/nix/store/3iw31akfh9h4455dhs6snmdz2k2l827f-mingw-w64-6.0.0-x86_64-w64-mingw32-headers.drv'...
unpacking sources
unpacking source archive /nix/store/3n4i0m7s953lh0si9j9zl10i2xy8cmka-mingw-w64-v6.0.0.tar.bz2
unpacking sources
unpacking source archive /nix/store/pp6qa6cd4scy76dinpgic0g6vfz6g472-binutils-2.34.tar.bz2

trying https://raw.githubusercontent.com/lhmouse/MINGW-packages/740f233da00c4fb5bcc225b2e29768824bcecc58/mingw-w64-gcc-git/9000-gcc-10-branch-Added-mcf-thread-model-support-from-mcfgthread.patch
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404 Not Found
error: cannot download 9000-gcc-10-branch-Added-mcf-thread-model-support-from-mcfgthread.patch from any mirror
builder for '/nix/store/v6ahf53lbv7zgxdxh6lwwnif4i7934rc-9000-gcc-10-branch-Added-mcf-thread-model-support-from-mcfgthread.patch.drv' failed with exit code 1
cannot build derivation '/nix/store/m4xaqmy5g4xd71dbxqmp4qz37q7a894q-x86_64-w64-mingw32-stage-final-gcc-debug-10.2.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/sh4dw58v41f2nzi6s0ylwj60i2lglx8z-x86_64-w64-mingw32-stage-final-gcc-debug-wrapper-10.2.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/n5jsh4xymd8qrmciinqkxxkpq9jsvgvg-stdenv-linux.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/pr4g43p07pcj49ldcqimnwnnbc6q0bb9-openssl-1.1.1i-x86_64-w64-mingw32.drv': 1 dependencies couldn't be built
error: build of '/nix/store/pr4g43p07pcj49ldcqimnwnnbc6q0bb9-openssl-1.1.1i-x86_64-w64-mingw32.drv' failed

Also, it's probably easier to not nixpkgs-fmt openssl/default.nix, given this is a minor edit.

@brano543
Copy link
Contributor Author

brano543 commented Jan 3, 2021

Hello Florian,

I am unable to reproduce the issue you are having. I have tested my changes against latest nixpkgs-unstable branch.

 "nixpkgs": {
        "branch": "nixpkgs-unstable",
        "description": "Nix Packages collection",
        "homepage": "",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "2080afd039999a58d60596d04cefb32ef5fcc2a2",
        "sha256": "0i677swvj8fxfwg3jibd0xl33rn0rq0adnniim8jnp384whnh8ry",
        "type": "tarball",
        "url": "https://github.com/NixOS/nixpkgs/archive/2080afd039999a58d60596d04cefb32ef5fcc2a2.tar.gz",
        "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
    }

@SuperSandro2000
Copy link
Member

I am unable to reproduce the issue you are having. I have tested my changes against latest nixpkgs-unstable branch.

You have the patch locally but we do not so we can't fetch it.

@brano543
Copy link
Contributor Author

I am unable to reproduce the issue you are having. I have tested my changes against latest nixpkgs-unstable branch.

You have the patch locally but we do not so we can't fetch it.

I am confused a little. I wanted to contribute to solving #82924 for Windows. The only change I did was to openssl default.nix file. I didn't add any other files locally.

What do I need to do then so you guys can merge the fix?

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't gratitously reformat the file. The cosmetic changes in the diff obscure the real changes.

@flokli
Copy link
Contributor

flokli commented Jan 10, 2021

I am unable to reproduce the issue you are having. I have tested my changes against latest nixpkgs-unstable branch.

You have the patch locally but we do not so we can't fetch it.

I am confused a little. I wanted to contribute to solving #82924 for Windows. The only change I did was to openssl default.nix file. I didn't add any other files locally.

What do I need to do then so you guys can merge the fix?

I wasn't able to build this, because the cross-gcc to mingw referred to a non-existent patch file (https://raw.githubusercontent.com/lhmouse/MINGW-packages/740f233da00c4fb5bcc225b2e29768824bcecc58/mingw-w64-gcc-git/9000-gcc-10-branch-Added-mcf-thread-model-support-from-mcfgthread.patch), which seems to have disappeared from the internet.

This has been solved in the meantime, by inlining the patches (see #107978).

Please rebase this PR to master, and as requested by @peti, don't reformat unrelated things.

@brano543
Copy link
Contributor Author

I am unable to reproduce the issue you are having. I have tested my changes against latest nixpkgs-unstable branch.

You have the patch locally but we do not so we can't fetch it.

I am confused a little. I wanted to contribute to solving #82924 for Windows. The only change I did was to openssl default.nix file. I didn't add any other files locally.
What do I need to do then so you guys can merge the fix?

I wasn't able to build this, because the cross-gcc to mingw referred to a non-existent patch file (https://raw.githubusercontent.com/lhmouse/MINGW-packages/740f233da00c4fb5bcc225b2e29768824bcecc58/mingw-w64-gcc-git/9000-gcc-10-branch-Added-mcf-thread-model-support-from-mcfgthread.patch), which seems to have disappeared from the internet.

This has been solved in the meantime, by inlining the patches (see #107978).

Please rebase this PR to master, and as requested by @peti, don't reformat unrelated things.

I have cleaned up the commit and resolved the merge conflict with commit f52263c

@Ericson2314
Copy link
Member

Where is this config thing installed, `dev?

Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding buildPackages as argument to common is actually not required.

pkgs/development/libraries/openssl/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/openssl/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/openssl/default.nix Outdated Show resolved Hide resolved
@brano543
Copy link
Contributor Author

Adding buildPackages as argument to common is actually not required.

I have added the changes.

@brano543 brano543 requested review from Mic92 and peti January 11, 2021 19:14
@Ericson2314
Copy link
Member

If config goes in $dev this is fine with me, but please add a comment saying so.

@brano543
Copy link
Contributor Author

Adding buildPackages as argument to common is actually not required.

It seems that removing these makes tests unhappy.

attribute 'coreutils' missing, at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/ofborg-evaluator-3/pkgs/development/libraries/openssl/default.nix:37:60

@Mic92
Copy link
Member

Mic92 commented Jan 12, 2021

But how did it work before? It's the same buildPackages that is used, no?

@Radvendii
Copy link
Contributor

I'm also getting attribute 'coreutils' missing when I just apply this patch and try to cross-compile openssl_1_1. Presumably this is because openssl is part of the bootstrapping process, and at the point where it's supposed to work, buildPackages.coreutils doesn't exist yet?

We could do something like
if buildPackages ? coreutils then buildPackages.coreutils else coreutils
but maybe that's too kludgy. It did fix the issue for me.

@Ericson2314
Copy link
Member

Ericson2314 commented Apr 26, 2021

I fixed it; the bootstrapping issue was just because of the fetchurl overrides in all-packages.nix being quite delicate.

I also answered by question above; config is not installed so this is perfectly safe.

@Radvendii
Copy link
Contributor

Can confirm that this fixed it for me.

When I compile pkgsStatic.openssl, the tests fail to build, and I need to add "no-tests" to the configureFlags, and then it works. Can we add that in this PR, or should I open a new one after this is merged for "openssl: fix static compile"

@Ericson2314 Ericson2314 merged commit 61a31ad into NixOS:master Apr 27, 2021
@Ericson2314
Copy link
Member

@Radvendii Let's just do that separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants