!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

581 Members
127 Servers

Load older messages


SenderMessageTime
28 Mar 2025
@k900:0upti.meK900 Maybe you need the right -march? 20:16:52
@stephen:crabsin.spacen3tcat I'm using -m68000 and I've tried playing around with the -march flags. It seems like my actual code compiles just fine but it's almost like the __whatever helpers are being compiled for the wrong CPU 20:17:27
@stephen:crabsin.spacen3tcat
test.bin: test.o Linker.ld
	m68k-unknown-none-elf-gcc -T Linker.ld -o test.bin -O2 -m68000 -Wall -Wextra -nostdlib test.o -ffreestanding -lgcc

%.o: %.c
	m68k-unknown-none-elf-gcc -m68000 -c $< -o $@ -ffreestanding -nostdlib -O0 -Wall -Wextra -fno-PIC -static-libgcc

Here's my makefile btw

20:17:43
@k900:0upti.meK900Oh 20:18:27
@k900:0upti.meK900Yeah that could be it 20:18:31
@k900:0upti.meK900If those are coming from newlib 20:18:37
@k900:0upti.meK900 And newlib is using a wrong -march too 20:18:44
@k900:0upti.meK900And you're just linking an already built newlib20:18:58
@stephen:crabsin.spacen3tcat I think they might be? I am not entirely sure what -lgcc and -static-libgcc do - I assume they link into newlib 20:19:12
@k900:0upti.meK900No, that's libgcc20:19:31
@k900:0upti.meK900But it could be the same thing 20:19:45
@k900:0upti.meK900Uhh there is a setting for this 20:20:37
@k900:0upti.meK900Somewhere 20:20:39
@stephen:crabsin.spacen3tcatLike for choosing how libgcc is compiled?20:20:57
@k900:0upti.meK900Like you can set march in the platform definition 20:20:59
@k900:0upti.meK900Somewhere 20:21:08
@k900:0upti.meK900 OK so here's the way I remember this can work 20:23:09
@stephen:crabsin.spacen3tcatwould this be a gcc setting or a nix setting? I am struggling to find anything20:23:09
@k900:0upti.meK900 You can use lib.systems.elaborate "m68k-unknown-none-elf" 20:23:32
@k900:0upti.meK900In a REPL or something 20:23:38
@k900:0upti.meK900That will shit out a huge attrset 20:23:44
@k900:0upti.meK900 That you can take and pass to crossSystem instead of just the triple 20:24:04
@k900:0upti.meK900And hopefully that attrset will have a place to put the right march value in 20:24:27
@k900:0upti.meK900That will hopefully be obvious from the name 20:24:35
@stephen:crabsin.spacen3tcat Sick! I have never used the nix repl before, do I have to do something to define lib? 20:24:42
@stephen:crabsin.spacen3tcat
 λ nix repl
Nix 2.24.12
Type :? for help.
nix-repl> lib.systems
error: undefined variable 'lib'
       at «string»:1:1:
            1| lib.systems
             | ^

nix-repl>
20:24:47
@k900:0upti.meK900 nix repl nixpkgs 20:25:18
@k900:0upti.meK900 Or maybe nix repl <nixpkgs> 20:25:25
@k900:0upti.meK900I don't remember which one works on 2.2420:25:35
@stephen:crabsin.spacen3tcatahh tyty20:25:42

Show newer messages


Back to Room ListRoom Version: 6