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

WIP: z80: add cross-compile support #101993

Closed
wants to merge 6 commits into from
Closed

WIP: z80: add cross-compile support #101993

wants to merge 6 commits into from

Conversation

siraben
Copy link
Member

@siraben siraben commented Oct 29, 2020

Closed due to infeasibility.

Motivation for this change

#101990

Current difficulty seems to be two things;

  • Get z88dk to work in place of gcc
  • Use the newlib C library which is in z88dk
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.

@siraben
Copy link
Member Author

siraben commented Oct 29, 2020

This is the first time I've added cross-compilation support, so I'm following my intuition from #72657 and #48286.

@siraben
Copy link
Member Author

siraben commented Oct 29, 2020

Fork of GCC 4.8 that targets Z80. https://github.com/AHelper/gcc/tree/z80-target However I think it's better to try to get cross-compilation support using z88dk's compiler.

@@ -304,6 +305,12 @@ stdenv.mkDerivation {
done
''

+ optionalString (libc != null && targetPlatform.isZ80) ''
for isa in z80; do
Copy link
Member

Choose a reason for hiding this comment

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

Is this supposed to grow?

Copy link
Member Author

@siraben siraben Oct 29, 2020

Choose a reason for hiding this comment

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

I don't think so. I'll fix this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not even sure it makes sense to modify bintools-wrapper like this, at least until the Z80 libcissue is resolved.

@siraben
Copy link
Member Author

siraben commented Oct 29, 2020

Current difficulty seems to be two things;

  1. getting z88dk to work in place of gcc
  2. using thenewlibC library also in z88dk

@Ericson2314
Copy link
Member

@siraben I don't think z88dk is using cc-wrapper? If this isn't working try doing z88dk -> z88dk-unwraped and then making defining z88dk with wrapCC.

@siraben
Copy link
Member Author

siraben commented Oct 29, 2020

I seem to get infinite loop error;

  z88dk = wrapCC {
    cc = z88dk-unwrapped;
    extraBuildCommands = ''
      wrap zcc $wrapper $ccPath/zcc
      export named_cc=zcc
    '';
  };

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

@siraben siraben marked this pull request as draft October 29, 2020 15:26
@siraben siraben changed the title z80: add cross-compile support WIP: z80: add cross-compile support Oct 29, 2020
@ofborg ofborg bot added the 6.topic: stdenv Standard environment label Oct 29, 2020
@siraben
Copy link
Member Author

siraben commented Oct 29, 2020

@cleverca22 if you're available I'd greatly appreciate your help in this PR

@@ -68,7 +68,7 @@ in lib.init bootStages ++ [
else if crossSystem.useLLVM or false
then buildPackages.llvmPackages_8.lldClang
else if crossSystem.isZ80
then buildPackages.z88dk
then buildPackages.z88dk-unwrapped
Copy link
Member

Choose a reason for hiding this comment

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

This should be buildPackages.z88dk so I guess we'll need to figure out a different way to break the cycle.

@siraben
Copy link
Member Author

siraben commented Oct 30, 2020

Here's an example of cross-compilation to the reMarkable tablet, looks like we would use wrapCC similarly https://github.com/pl-semiotics/nix-remarkable/blob/15ea031e95670c95fabeb27808446f4f3a645782/rM/toolchain-pkgs.nix#L51

@veprbl veprbl added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Dec 3, 2020
@siraben siraben closed this Jun 7, 2021
@siraben siraben deleted the z80 branch February 1, 2024 20:11
@github-actions github-actions bot added the 6.topic: lib The Nixpkgs function library label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 6.topic: lib The Nixpkgs function library 6.topic: stdenv Standard environment 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants