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

nim: fix dynamic library loading, wrap for cross-compilation #95692

Merged
merged 2 commits into from Sep 7, 2020
Merged

Conversation

@ehmry
Copy link
Member

@ehmry ehmry commented Aug 17, 2020

Motivation for this change

See nim-lang/Nim#15194.

Wait for nim-lang/Nim#15196 to close.

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.
@ehmry ehmry added this to the 20.09 milestone Aug 17, 2020
@ofborg ofborg bot requested a review from jbedo Aug 17, 2020
@jbedo
jbedo approved these changes Aug 19, 2020
Copy link
Contributor

@jbedo jbedo left a comment

This is great, tested mosdepth successfully. I hope the patch gets merged upstream.

@ehmry ehmry mentioned this pull request Aug 22, 2020
4 of 14 tasks complete
@ehmry ehmry self-assigned this Aug 22, 2020
@ehmry ehmry requested a review from FRidh Aug 22, 2020
@ehmry ehmry force-pushed the ehmry:nim branch from d686cbb to 0b5658c Aug 24, 2020
@ehmry ehmry changed the title nim: patch to fix dynamic library loading nim: fix dynamic library loading, wrap for cross-compilation Aug 24, 2020
@ehmry
Copy link
Member Author

@ehmry ehmry commented Aug 24, 2020

I've pushed a second commit that wraps the compiler for cross-compilation, but at the moment I don't have access to the right hardware to test cross-compilation.

This adds nim-unwrapped and nim-stdlib to the top-level of nixpkgs, which can be overridden in overlays to affect the final nim wrapper.

@FRidh
Copy link
Member

@FRidh FRidh commented Aug 24, 2020

For cross a test could be added that uses a qemu emulator. See e.g. https://github.com/NixOS/nixpkgs/blob/master/pkgs/test/cross/default.nix.

@@ -9277,6 +9277,8 @@ in
mozart2-binary = callPackage ../development/compilers/mozart/binary.nix { };

nim = callPackage ../development/compilers/nim { };
nim-unwrapped = nim.unwrapped;

This comment has been minimized.

@FRidh

FRidh Aug 24, 2020
Member

Do these need to be listed at top-level?

This comment has been minimized.

@ehmry

ehmry Aug 24, 2020
Author Member

I listed those at the top-level so that callPackage feeds them back to the nim-wrapper. I did this because I want to be able to patch the stdlib from an overaly without rebuilding the compiler, just the wrapper. Not sure this is the best way to do this.

@ehmry ehmry force-pushed the ehmry:nim branch from 0b5658c to 8ba4bda Aug 24, 2020
@ehmry
Copy link
Member Author

@ehmry ehmry commented Aug 24, 2020

For cross a test could be added that uses a qemu emulator.

Unfortunately I only found two packages in the tree to cross-compile, one has a dependency that is broken for cross-compiles and the other is quite expensive to build. I've used this method to cross-compile Nim from Linux to Genode so I think it should work, and if it doesn't I'll fix it eventually.

@ofborg ofborg bot requested a review from jbedo Aug 24, 2020
@ehmry
Copy link
Member Author

@ehmry ehmry commented Aug 24, 2020

Now Nimble gives me the dreaded Invalid section: . error:

     Error: Could not validate package:
        ... Could not read package info file in /home/repo/nimpkgs/geminim/geminim.nimble;
        ...   Reading as ini file failed with:
        ...     Invalid section: .
        ...   Evaluating as NimScript file failed with:
        ...     /home/repo/nimpkgs/geminim/geminim_20571.nims(5, 22) Warning: imported and not used: 'strutils' [UnusedImport]
        ... printPkgInfo() failed.
@ehmry ehmry removed this from the 20.09 milestone Aug 29, 2020
@ehmry ehmry force-pushed the ehmry:nim branch from 8ba4bda to 78dfacd Sep 7, 2020
@ehmry ehmry merged commit dc09e3e into NixOS:master Sep 7, 2020
19 checks passed
19 checks passed
tests tests
Details
action
Details
Evaluation Performance Report Evaluator Performance Report
Details
Wait for ofborg
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="78dfacd"; rev="78dfacda09e896770a68168aa5ca3566c07d5e5b"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="78dfacd"; rev="78dfacda09e896770a68168aa5ca3566c07d5e5b"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="78dfacd"; rev="78dfacda09e896770a68168aa5ca3566c07d5e5b"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="78dfacd"; rev="78dfacda09e896770a68168aa5ca3566c07d5e5b"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="78dfacd"; rev="78dfacda09e896770a68168aa5ca3566c07d5e5b"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="78dfacd"; rev="78dfacda09e896770a68168aa5ca3566c07d5e5b"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="78dfacd"; rev="78dfacda09e896770a68168aa5ca3566c07d5e5b"; } ./pkgs/t
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
nim, nim.passthru.tests on aarch64-linux Success
Details
nim, nim.passthru.tests on x86_64-linux Success
Details
@ehmry ehmry deleted the ehmry:nim branch Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.