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

erlang: cross compile support #58042

Closed
wants to merge 1 commit into from

Conversation

illegalprime
Copy link
Member

Motivation for this change

Adds support to cross compile the erlang interpreter, patchShebangs is still broken for other architectures but it still works on the physical board. (#33956)

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@GrahamcOfBorg GrahamcOfBorg added 6.topic: erlang 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Mar 21, 2019
buildPackages.perl
buildPackages.gnum4
buildPackages.libxslt
buildPackages.libxml2
Copy link
Member

Choose a reason for hiding this comment

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

Does the buildPackages prefix here actually makes a difference?
I only know that sometimes overrides in all-packages.nix breaks splicing
of the correct architecture. The problem when using this approach is
that it is no longer possible to override packages externally.

Copy link
Member Author

Choose a reason for hiding this comment

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

yea you're right, not sure, let me try it without those

Copy link
Member Author

Choose a reason for hiding this comment

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

@Mic92 just tried it and it doesn't work if I don't explicitly set buildPackages, maybe i'm going about this wrong but it seems to not be able to find perl if I remove buildPackages.

Copy link
Member

Choose a reason for hiding this comment

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

What is the error?

Copy link
Member Author

Choose a reason for hiding this comment

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

sorry, I was building it with wxSupport, which doesn't work right now, this patch is to cross-compile erlang without wxSupport (GUI stuff). after fiddling the smallest I can get it is:

{
  nativeBuildInputs = [
    autoreconfHook
    makeWrapper
    perl
    gnum4
    buildPackages.libxslt
    libxml2
  ];
}

if I remove that buildPackages from libxslt I get a format error for xsltproc:

xsltproc --output "../man3/array.3" --stringparam company "Ericsson AB" --stringparam docgen "/build/source/bootstrap/lib/erl_docgen" --stringparam gendate "$date" --stringparam appname "stdlib" --stringparam appver "3.4.5" --stringparam specs_file "$specs_file" --xinclude -path /build/source/bootstrap/lib/erl_docgen/priv/dtd  -path /build/source/bootstrap/lib/erl_docgen/priv/dtd_man_entities /build/source/bootstrap/lib/erl_docgen/priv/xsl/db_man.xsl array.xml
/nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash: line 2: /nix/store/rlv5jd00hksp449aqizf33q8nnrx6j80-libxslt-1.1.33-armv7l-unknown-linux-gnueabihf-bin/bin/xsltproc: cannot execute binary file: Exec format error
make[5]: *** [/build/source/make/armv7l-unknown-linux-gnueabihf/otp.mk:293: ../man3/array.3] Error 126
make[5]: Leaving directory '/build/source/lib/stdlib/doc/src'
make[4]: *** [/build/source/make/otp_release_targets.mk:182: release_docs] Error 2
make[4]: Leaving directory '/build/source/lib/stdlib/doc/src'
make[3]: *** [/build/source/make/otp_subdir.mk:29: release_docs] Error 2
make[3]: Leaving directory '/build/source/lib/stdlib'
make[2]: *** [/build/source/make/otp_subdir.mk:29: release_docs] Error 2
make[2]: Leaving directory '/build/source/lib'
make[1]: *** [Makefile:416: release_docs] Error 2
make[1]: Leaving directory '/build/source'
make: *** [Makefile:1029: install-docs] Error 2

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for investigating! We should definitely get to the bottom of why libxslt is different.

Copy link
Member

Choose a reason for hiding this comment

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

Opened #58327 in case that makes a difference.

I only know that sometimes overrides in all-packages.nix breaks splicing
of the correct architecture.

This PR works around that.

Copy link
Member

Choose a reason for hiding this comment

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

That other PR causes more problems. (I almost rather remove the with pkgs!) Can we do everything but xslt leaving a TODO?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do everything but xslt leaving a TODO?

Am I right if I think it then will work already with erlang_nox?

@veprbl veprbl added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Mar 23, 2019
@globin globin requested a review from matthewbauer May 18, 2019 10:39
@cw789
Copy link
Contributor

cw789 commented Oct 8, 2019

Is there anything I could help in bringing this forward?
I think Nix could be "The Tool" for building cross compiled Elixir / Erlang releases.

@FRidh
Copy link
Member

FRidh commented Nov 3, 2019

Please rebase. This PR looks good to me.

@Ericson2314
Copy link
Member

Per https://github.com/NixOS/nixpkgs/pull/58042/files#r292261100 we should get rid of most of the buildPackges. in the nativeBuildInputs list except for the weird misbehaving XSLT, and leave a TODO for it.

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@tolbrino
Copy link
Contributor

tolbrino commented Sep 1, 2020

👍 to move this forward.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 1, 2020
@ryantm ryantm added 2.status: merge conflict This PR has merge conflicts with the target branch and removed 2.status: merge conflict This PR has merge conflicts with the target branch labels Oct 3, 2020
@stale
Copy link

stale bot commented Jun 5, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 5, 2021
@domenkozar
Copy link
Member

#100835 is still outdated, but slightly newer.

@domenkozar domenkozar closed this Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: erlang 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.