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

Conversation

ehmry
Copy link
Contributor

@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.

Copy link
Contributor

@jbedo jbedo left a comment

Choose a reason for hiding this comment

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

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

@ehmry ehmry self-assigned this Aug 22, 2020
@ehmry ehmry requested a review from FRidh August 22, 2020 07:05
@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
Contributor Author

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 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;
Copy link
Member

Choose a reason for hiding this comment

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

Do these need to be listed at top-level?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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
Copy link
Contributor Author

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 August 24, 2020 11:12
@ehmry
Copy link
Contributor Author

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
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

3 participants