[DTrace-devel] [PATCH 2/5] build: get the architecture from gcc -dumpmachine, not uname -m

Nick Alcock nick.alcock at oracle.com
Mon Jan 15 15:56:26 UTC 2024


On 12 Dec 2023, Eugene Loh via DTrace-devel outgrape:

> A hesitant
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
>
> I'm unclear what's going on here.  What will the strategy be for cross compilation?

I haven't really thought about it, but whatever it is it is definitely
wrong to assume the ARCH is the machine we're running on rather than the
machine we're generating code for!

(Honestly, these days, the only approach that really makes sense is
letting QEMU do it, which gets the build machine right too -- but this
was the first thing the Gentoo people asked about, and they seemed, uh,
*intense* about it, and the fix was easy and non-disruptive, so...)

> On 11/29/23 11:08, Nick Alcock via DTrace-devel wrote:
>> This makes it at least*possible*  to support cross-compilation.
>> It doesn't mean we do support it, but it's the first necessary
>> prerequisite for such support.
>
> How about,
> "This step starts to lay the groundwork for cross-compilation."

Much clearer, thank you. I've said

"This lays the groundwork for future support of cross-compilation."

because it's a tiny bit less clumsy to my ears (eyes?)

>> diff --git a/GNUmakefile b/GNUmakefile
>> @@ -18,12 +18,13 @@ VERSION := 2.0.0
>>     # Verify supported hardware.
>>   -ARCH := $(shell uname -m)
>> +ARCHOS := $(shell gcc -dumpmachine | sed 's,-redhat,,; s,-unknown,,; s,-pc,,; s,-gnu$$,,')
>> +ARCH := $(subst -linux,,$(ARCHOS))
>>   -$(if $(subst sparc64,,$(subst aarch64,,$(subst x86_64,,$(ARCH)))), \
>> +$(if $(subst sparc64-linux,,$(subst aarch64-linux,,$(subst x86_64-linux,,$(ARCHOS)))), \
>
> What's the motivation for this change?  Didn't the old code suffice?

... good point. Adjusted back. I think the motivation was syntax errors,
but I'm almost certain those were because I accidentally deleted the
trailing \ and didn't notice :)



More information about the DTrace-devel mailing list