C What package(s) do I need to install to compile and link amd64 binaries on FreeBSD 14 on arm64?

I am running FreeBSD 14 on arm64. I need to build some binaries (from C source) targeting FreeBSD 14 on amd64.

I can cross compile without issue:

$ cc -target x86_64-unknown-freebsd -c -o mss.o mss.c $ file mss.o mss.o: ELF 64-bit LSB relocatable, x86-64, version 1 (FreeBSD), not stripped

But I am not able to link:

$ cc -target x86_64-unknown-freebsd -o mss mss.c ld: error: /tmp/mss-46ecd7.o is incompatible with /usr/lib/crt1.o cc: error: linker command failed with exit code 1 (use -v to see invocation)

Presumably I need to install some package(s) that includes the amd64 libraries? Can anyone advise which package(s) are needed? Also, is anything else needed to get this working?

Thanks.
 
I did not try myself, but reading ld.lld's manual, you may achieve it by
1) putting the amd64 userland (at least /lib, /usr/include and /usr/lib) somewhere. (say /somewhere)
2) running the command like:
cc -target x86_64-unknown-freebsd -Wl,--sysroot=/somewhere -o mss mss.c
 
Back
Top