nix-pills icon indicating copy to clipboard operation
nix-pills copied to clipboard

Pill 7.5 on macOS Fails

Open josh1703658784 opened this issue 7 years ago • 5 comments

Link to pill

System: macOS 10.12.6 nix-repl version: 1.11.15

Problem:

When following pill 7.5 An error is thrown stating that clang cannot be found. Here. you can see what I entered into my terminal. simple.c and simple_builder.sh are copied directly from the webpage.

Solution:

  • In simple_builder.sh, replace gcc on with cc. See here.

  • Change the command that creates the derivation by replacing gcc = gcc with gcc = stdenv.cc. See here.

josh1703658784 avatar Dec 06 '17 02:12 josh1703658784

This fixes issue I was having, but it raises a concern for me. The idea is that nix creates a fully reproducible environment, but looks like on Linux gcc is gcc while on OS X gcc is clang. That looks to me that current nix behavior is somewhat breaking this.

takeda avatar Feb 28 '18 23:02 takeda

Looks like all examples in chapter 8 are broken as well.

takeda avatar Feb 28 '18 23:02 takeda

I echo @takeda's concern as well.

I'm just getting started on Nix, and used pill 7.5 (Packaging a simple C program) to get my feet wet in creating custom packages. I was encouraged by @copumpkin's presentation on the state of darwin-nix (re: Nix on Darwin – History, challenges, and where it's going by Dan Peebles).

But apparently the derivations that are known to work on Linux's version of Nix may break when run on darwin-nix.

Any plans of fixing these issues?

/cc @copumpkin

gurjeet avatar Sep 29 '18 04:09 gurjeet

I can confirm that the workarounds proposed by @joshuaks do fix the problem.

gurjeet avatar Sep 29 '18 04:09 gurjeet

It looks like @joshuaks has already proposed PR #42 to address this. But I don't like the ugliness of the solution; if conditions in derivations to handle platform-specific differences is just kludgy.

It seems that @LnL7 has an alternate theory the the problem is possibly with binutils. I can't comment on that intelligently.

Any help to make these pills work on darwin-nix would be greatly appreciated.

gurjeet avatar Sep 29 '18 04:09 gurjeet