DMD as cross-compiler
Iain Buclaw
ibuclaw at gdcproject.org
Thu Nov 12 08:58:31 UTC 2020
On Thursday, 12 November 2020 at 06:45:37 UTC, Jacob Carlborg
wrote:
> On Wednesday, 11 November 2020 at 12:28:17 UTC, Iain Buclaw
> wrote:
>
>> Jonathon raised today that FreeBSD 11 -> FreeBSD 12 as been an
>> issue for cross-compiling since the build scripts were
>> replaced by a build.d source file.
>
> What's the issue with that? Use LDC and compile build.d to
> target FreeBSD 12. Sure, you need the SDK, but you should be
> able to copy that from a FreeBSD 12 machine.
Judging from the state of druntime, LDC doesn't work on FreeBSD
at all.
https://github.com/ldc-developers/druntime/blob/412467a452e2d12f561a2eace933dd44014af3c6/src/core/sys/freebsd/sys/mount.d#L291-L302
What's broken? pragma(mangle) string is invalid.
What needs to be fixed? There needs to be a new pragma(symver)
added to support symbol versioning feature of ELF.
---
If it was me porting, I'd do it in the stages of:
1. Build FBSD11 compiler on FBSD11.
2. Cross-compile FBSD12 compiler on FBSD11 using compiler built
in stage 1.
3. Copy FBSD12 compiler over to FBSD12.
4. Build FBSD12 compiler on FBSD12 using compiler built in stage
2.
I think where Jonathon is going wrong is in skipping step 2 and
jumping straight to three. In the old make build system this
just worked because (as I understand) there's a FBSD11
compatibility layer, allowing old binaries to run on the new
system. But as that is no more, building build.d using the stage
1 compiler on FBSD12 will result in a broken application (as it's
linking against FBSD12 libc).
More information about the Digitalmars-d
mailing list