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: cross-compilation fixes #115195

Merged
merged 1 commit into from Mar 26, 2021
Merged

nim: cross-compilation fixes #115195

merged 1 commit into from Mar 26, 2021

Conversation

ehmry
Copy link
Contributor

@ehmry ehmry commented Mar 5, 2021

Import with callPackages, use buildPackages for building a cross-compiler, cleanup nim.cfg so that it does not conflict with our configuration.

Motivation for this change

Cross-compilation doesn't work right now, the wrapper takes a Nim compiler built for the targetPlatform.

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 requested review from marsam and kamilchm March 5, 2021 14:33
Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

Small formatting nit and you might want to set strictDeps = true; to easier catch regressions for future updates.

pkgs/development/compilers/nim/default.nix Outdated Show resolved Hide resolved
pkgs/development/compilers/nim/default.nix Outdated Show resolved Hide resolved
@ehmry
Copy link
Contributor Author

ehmry commented Mar 5, 2021

@SuperSandro2000 Yes, strictDeps is what I want, thanks.

@ehmry
Copy link
Contributor Author

ehmry commented Mar 6, 2021

I'm having problems getting cross-complation to work where the build platform is GCC and the target platform is Clang.

Comment on lines +259 to 261
"--prefix PATH : ${lib.makeBinPath [ buildPackages.gdb ]}:${
placeholder "out"
}/bin"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"--prefix PATH : ${lib.makeBinPath [ buildPackages.gdb ]}:${
placeholder "out"
}/bin"
"--prefix PATH : ${lib.makeBinPath [ buildPackages.gdb ]}:${placeholder "out"}/bin"

# is not documented, so duplicate the configuration across both files.
''
runHook preBuild
cat >> config/config.nims << WTF
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer if EOF for heredocs are used. That is more common and for everyone easy to spot.

@SuperSandro2000
Copy link
Member

I'm having problems getting cross-complation to work where the build platform is GCC and the target platform is Clang.

If you need more build power or some testing and some limited help on darwin just hit me up.

@ehmry ehmry marked this pull request as ready for review March 18, 2021 09:07
* Import with callPackages
* Use buildPackages for building a cross-compiler
* Patch-out potential conflicts in nim.cfg
* Generate a configuration with toolchain detection
* Build with strictDeps enabled
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

2 participants