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

glibc: enable cross builds on Darwin #55956

merged 1 commit into from Feb 20, 2019

glibc: enable cross builds on Darwin #55956

merged 1 commit into from Feb 20, 2019


Copy link

@mroi mroi commented Feb 17, 2019

I wanted to install a Linux-targetting compiler on a Darwin (macOS) host. The compiler part actually works out-of-the-box with Nixpkgs, which I found quite impressive. However, building glibc on macOS fails with multiple successive errors. I have fixed them and can now build and install a x86_64-linux and i686-linux compiler on macOS.

I decided to put all my changes into a patch file so I do not pollute the Linux builds of glibc. The changes are documented at the top of the patch file. I will copy those notes here for completeness:

  • increase ulimit for open files: macOS default of 256 is too low for glibc build system
  • use host version of ar, which is given by environment variable
  • build system uses stamp.os and stamp.oS files, which only differ in case; this fails on macOS, so replace .oS with .o_S
  • libintl.h does not exist (and is not needed) on macOS
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

add patch file for cross compilation on Darwin
documentation of the changes is at the top of the patch file
@matthewbauer matthewbauer merged commit 4141fda into NixOS:master Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants