!lheuhImcToQZYTQTuI:nixos.org

Nix on macOS

1160 Members
“There are still many issues with the Darwin platform but most of it is quite usable.” — http://yves.gnu-darwin.org187 Servers

Load older messages


SenderMessageTime
17 Jan 2026
@alexfmpe:matrix.orgalexfmpe

can one use gcc instead of clang on aarch64-darwin?
tried nix-build -E "with import ./. {}; pkgs.hello.override { stdenv = pkgs.gccStdenv; }" which fails with

configure:5654: checking whether the C compiler works
configure:5676: gcc    conftest.c  >&5
ld: library not found for -liconv
collect2: error: ld returned 1 exit status
...
configure:5728: error: C compiler cannot create executables
See 'config.log' for more details
16:35:46
@k900:0upti.meK900Not well16:36:00
@reckenrode:matrix.orgRandy EckenrodeDoes the GCC stdenv not include the SDK? It should, and libiconv should be propagated.16:38:25
@reckenrode:matrix.orgRandy EckenrodeBut using GCC is a bad idea unless you have no choice. It doesn’t support availability annotations. It’s not set up to use libc++, which everything C++ on Darwin is linked against. (GCC can use it, but we don’t support that AFAIK.)16:40:05
@alexfmpe:matrix.orgalexfmpehmm I mainly wanted it to test some stuff that is currently broken ish with clang and didn't want to investigate/fix right now16:41:39
@alexfmpe:matrix.orgalexfmpeit's more of a "would unlock progress on current task immediately" rather than a "I'll actually rely on this for anything"16:42:31
@alexfmpe:matrix.orgalexfmpeat any rate, the libiconv error seems odd16:43:06
@alexfmpe:matrix.orgalexfmpeis the expression even right? should I be overriding stdenv for hello only?16:44:12
@reckenrode:matrix.orgRandy EckenrodeThe expression seems right.16:47:04
@reckenrode:matrix.orgRandy Eckenrode Can you nix develop (or whatever the equivalent is for the old CLI) the failing drv to check that the path to libiconv is there and that ld is wrapped? 16:48:00
@alexfmpe:matrix.orgalexfmpe
$ nix-shell -E "with import ./. {}; pkgs.hello.override { stdenv = pkgs.gccStdenv; }"
Using versionCheckHook

# echo $NIX_LDFLAGS
-liconv

# which ld
/nix/store/cjkf5fm587xv34pz9zfs3q2qpvij61fz-gcc-wrapper-15.2.0/bin/ld
16:54:10
@alexfmpe:matrix.orgalexfmpe fwiw, with gnuStdenv I get /usr/bin/ld 16:56:43
@alexfmpe:matrix.orgalexfmpe *
$ nix-shell -E "with import ./. {}; pkgs.hello.override { stdenv = pkgs.gccStdenv; }"
Using versionCheckHook

# echo $NIX_LDFLAGS
-liconv

# which ld
/nix/store/cjkf5fm587xv34pz9zfs3q2qpvij61fz-gcc-wrapper-15.2.0/bin/ld

# ld
ld: library not found for -liconv
16:57:25
@alexfmpe:matrix.orgalexfmpe *
$ nix-shell -E "with import ./. {}; pkgs.hello.override { stdenv = pkgs.gccStdenv; }"
Using versionCheckHook

# env | grep iconv
NIX_LDFLAGS=-liconv

# which ld
/nix/store/cjkf5fm587xv34pz9zfs3q2qpvij61fz-gcc-wrapper-15.2.0/bin/ld

# ld
ld: library not found for -liconv
16:59:57
@alexfmpe:matrix.orgalexfmpe * fwiw, with gnuStdenv I get /usr/bin/ld (or rather, it's unchanged) 17:01:19
@reckenrode:matrix.orgRandy EckenrodeThat’s definitely not right.17:13:04
@alexfmpe:matrix.orgalexfmpeno clue how to debug/fix this, but up for legwork if that helps17:22:37
@alexfmpe:matrix.orgalexfmpeI'm waiting for builds anyway on the next best thing to work on17:23:38
@reckenrode:matrix.orgRandy Eckenrode SDKROOT is missing, which means there is no SDK. Hmm. 17:45:22
@reckenrode:matrix.orgRandy Eckenrode

gccStdenv =
  if stdenv.cc.isGNU then
    stdenv
  else
    stdenv.override {
      cc = buildPackages.gcc;
      allowedRequisites = null;
      # Remove libcxx/libcxxabi, and add clang for AS if on darwin (it uses
      # clang's internal assembler).
      extraBuildInputs = lib.optional stdenv.hostPlatform.isDarwin clang.cc;
    };
17:46:16
@reckenrode:matrix.orgRandy EckenrodeThat’s probably not right. I guess this has been broken since the SDK rework.17:46:28
@reckenrode:matrix.orgRandy Eckenrode Should be extraBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ clang.cc apple-sdk ]. 17:47:13
@alexfmpe:matrix.orgalexfmpetesting17:47:50
@reckenrode:matrix.orgRandy Eckenrode Though I don’t think the clang.cc is needed anymore for as. That’s done as a script with an absolute path to clang. 17:48:50
@reckenrode:matrix.orgRandy Eckenrode (Not unless something expects to invoke clang explicitly as the assembler, so it may not be worth dropping it.) 17:50:13
@alexfmpe:matrix.orgalexfmpe

adding apple-sdk there causes -L to be passed with libiconv

echo $NIX_LDFLAGS
-liconv -L/nix/store/6nmmi317rg2bnybndbgc944dpg5cnl5a-libiconv-109.100.2/lib -L/nix/store/lgcr7kswpb1hap1vsjwrzzcqjks0xal6-libresolv-91/lib -L/nix/store/0x1fcnqb9lf6x3vcn53rxn7ijv7skg7y-libsbuf-14.1.0/lib -L/nix/store/fq0jizzyjkilz0rj3kvc1hskc7ry84ds-libutil-72/lib -L/nix/store/6nmmi317rg2bnybndbgc944dpg5cnl5a-libiconv-109.100.2/lib -L/nix/store/lgcr7kswpb1hap1vsjwrzzcqjks0xal6-libresolv-91/lib -L/nix/store/0x1fcnqb9lf6x3vcn53rxn7ijv7skg7y-libsbuf-14.1.0/lib -L/nix/store/fq0jizzyjkilz0rj3kvc1hskc7ry84ds-libutil-72/lib
17:51:57
@alexfmpe:matrix.orgalexfmpe

building hello now gets through configure but fails with several errors on string.h

lib/string.h:754:20: error: expected declaration specifiers or '...' before '__builtin_object_size'
  754 | _GL_EXTERN_C void *memcpy (void *__dest, const void *__src, size_t __n)
17:52:48
@emilazy:matrix.orgemily note that GCC does not even support aarch64-darwin upstream 17:56:47
@emilazy:matrix.orgemilywe basically only use it at all because nobody's gotten around to integrating Flang for Fortran yet17:57:17
@alexfmpe:matrix.orgalexfmpeouch17:57:27

Show newer messages


Back to Room ListRoom Version: 6