!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

533 Members
110 Servers

Load older messages


SenderMessageTime
11 Oct 2025
@anders:sorby.xyzAnders I am trying to build relibc using nix to be able to cross compile redox os with nix again.
But I run into this problem x86_64-linux-gnu-gcc: command not found
How do I solve it? I am not trying to cross compile
11:21:28
@k900:0upti.meK900There's no general answer for this question11:22:00
@k900:0upti.meK900You need to look at the build system11:22:09
@k900:0upti.meK900And figure out what it's expecting and why11:22:13
@anders:sorby.xyzAnders
ifeq ($(TARGET),x86_64-unknown-linux-gnu)
	export CC=x86_64-linux-gnu-gcc
	export LD=x86_64-linux-gnu-ld
	export AR=x86_64-linux-gnu-ar
	export NM=x86_64-linux-gnu-nm
	export OBJCOPY=objcopy
	export CPPFLAGS=
	LD_SO_PATH=lib/ld64.so.1
endif

11:45:21
@k900:0upti.meK900 Yeah that looks immediately wrong, at least LDSOPATH 11:51:21
@k900:0upti.meK900 Yeah that looks immediately wrong, at least LD_SO_PATH 11:51:25
@anders:sorby.xyzAndersWell it works on other systems apparently. Is there not any simple way to get nix to create an env where these commands are specified?12:02:31
@k900:0upti.meK900Honestly, I'm sorry if it comes off as harsh, but you're clearly out of your depth here12:04:28
@k900:0upti.meK900Maybe try packaging something less weird first12:04:39
@anders:sorby.xyzAndersIf you have nothing helpful to say it is better to not say it12:05:25
@k900:0upti.meK900The thing is, you're expecting people to feed you answers12:06:16
@k900:0upti.meK900To questions that generally indicate that you don't understand the build system12:06:46
@k900:0upti.meK900And like, we can't do your homework for you,12:06:59
@k900:0upti.meK900* And like, we can't do your homework for you12:07:02
@anders:sorby.xyzAndersI don't care. If you don't want to help. Just simply don't. No need to be rude.12:08:10
@k900:0upti.meK900I do care, because this is not the kind of behavior we want to encourage in this community12:08:32
@anders:sorby.xyzAndersI got it working now12:44:25
@artturin:matrix.orgArtturin
In reply to @anders:sorby.xyz
ifeq ($(TARGET),x86_64-unknown-linux-gnu)
	export CC=x86_64-linux-gnu-gcc
	export LD=x86_64-linux-gnu-ld
	export AR=x86_64-linux-gnu-ar
	export NM=x86_64-linux-gnu-nm
	export OBJCOPY=objcopy
	export CPPFLAGS=
	LD_SO_PATH=lib/ld64.so.1
endif

In nixpkgs the compiler for build isn't prefixed, neither during native or cross-compilation

You should remove those lines or substituteInPlace them

12:55:57
@anders:sorby.xyzAnders I don't want to break support for other systems. What is the recommended way of doing this in nix? substituteInPlace 13:01:27
@qyliss:fairydust.spaceAlyssa Rossare they not overridable on the make command line?13:09:37
@qyliss:fairydust.spaceAlyssa Ross i.e. makeFlags 13:09:44
@qyliss:fairydust.spaceAlyssa Rossmake variables usually are13:10:05
@anders:sorby.xyzAndersYes, but I think it is cleanest to use substituteInPlace in this case13:18:17
@qyliss:fairydust.spaceAlyssa RossI don't agree at all. The Make command line is an actual API designed for doing exactly this.13:20:35
@anders:sorby.xyzAndersOk, you seem to be right. It was much simpler and cleaner.13:23:39
@matthewcroughan:defenestrate.itmatthewcroughanhttps://hercules-ci.com/accounts/github/MatthewCroughan/derivations/%2Fnix%2Fstore%2Fdywy5i6pv2l7rs2a6dh357whnhvnmvkl-audit-aarch64-unknown-linux-musl-4.1.2-unstable-2025-09-06.drv/log?via-job=f8d88c3e-3806-4bc0-bdca-0c7ea05b7c6713:51:53
@matthewcroughan:defenestrate.itmatthewcroughan This failure always seems to happen on audit nowadays 13:52:02
@matthewcroughan:defenestrate.itmatthewcroughanhttps://github.com/MatthewCroughan/nixos-musl/tree/refactor13:52:15
@matthewcroughan:defenestrate.itmatthewcroughanI'm building a flake here to track musl/llvm native and cross 13:52:24

Show newer messages


Back to Room ListRoom Version: 6