Re: poudriere-devel-3.3.99.20211015 fails to build in my aarch64&armv7 environments (built on amd64 just fine)

From: Bryan Drewery <bdrewery_at_FreeBSD.org>
Date: Sun, 17 Oct 2021 22:45:51 UTC
On 10/17/2021 3:06 PM, Mark Millard wrote:
> On 2021-Oct-17, at 11:19, Mark Millard <marklmi@yahoo.com> wrote:
> 
>> On 2021-Oct-16, at 23:41, Mark Millard <marklmi at yahoo.com> wrote:
>>
>> On 2021-Oct-16, at 19:20, Mark Millard via freebsd-toolchain <freebsd-toolchain@freebsd.org> wrote:
>>>
>>>
>>>> [00:00:45] [06] [00:00:18] Saving ports-mgmt/poudriere-devel | poudriere-devel-3.3.99.20211015 wrkdir
>>>> [00:00:49] [06] [00:00:22] Saved ports-mgmt/poudriere-devel | poudriere-devel-3.3.99.20211015 wrkdir to: /usr/local/poudriere/data/wrkdirs/13_0R-CA72-default/default/poudriere-devel-3.3.99.20211015.tbz
>>>>
>>>> Log:
>>>>
>>>> . . .
>>>> --- src/libexec/poudriere/pwait/sh-pwait.o ---
>>>> cc -DHAVE_CONFIG_H -I. -I./src   -mcpu=cortex-a72 -Wall -pipe -O2   -Wno-extra -DSHELL -std=gnu99 -DVTABSIZE=1000  -DNO_HISTORY -Wno-unused-const-variable -include  ./external/sh_compat/compat.h -I./s
>>>> rc  -I./external/sh -I./src/poudriere-sh  -I./src/poudriere-sh -O2 -pipe -mcpu=cortex-a72  -g -fstack-protector-strong -fno-strict-aliasing -MT src/libexec/poudriere/pwait/sh-pwait.o -MD -MP -MF src/l
>>>> ibexec/poudriere/pwait/.deps/sh-pwait.Tpo -c -o src/libexec/poudriere/pwait/sh-pwait.o `test -f 'src/libexec/poudriere/pwait/pwait.c' || echo './'`src/libexec/poudriere/pwait/pwait.c
>>>> . . .
>>>> --- src/libexec/poudriere/pwait/sh-pwait.o ---
>>>> src/libexec/poudriere/pwait/pwait.c:62:2: error: passing 'void *' to parameter of incompatible type 'va_list' (aka '__builtin_va_list')
>>>>       exit(EX_USAGE);
>>>>       ^~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:106:20: note: expanded from macro 'exit'
>>>> #define exit(...)               exit_(_, ##__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:107:21: note: expanded from macro 'exit_'
>>>> #define exit_(...)              exit_X(__VA_ARGS__, _1, _0)(__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:108:32: note: expanded from macro 'exit_X'
>>>> #define exit_X(_0, _1, X, ...)  exit ## X
>>>>                               ^
>>>> <scratch space>:40:1: note: expanded from here
>>>> exit_1
>>>> ^
>>>> ./src/poudriere-sh/helpers.h:110:58: note: expanded from macro 'exit_1'
>>>> #define exit_1(_, status)       verrorwithstatus(status, NULL, NULL)
>>>>                                                              ^~~~
>>>> /usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL'
>>>> #define NULL    ((void *)0)
>>>>               ^~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:104:49: note: passing argument to parameter here
>>>> void verrorwithstatus(int, const char *, va_list) __printf0like(2, 0) __dead2;
>>>>                                               ^
>>>> src/libexec/poudriere/pwait/pwait.c:205:5: error: passing 'void *' to parameter of incompatible type 'va_list' (aka '__builtin_va_list')
>>>>                               exit(EX_OK);
>>>>                               ^~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:106:20: note: expanded from macro 'exit'
>>>> #define exit(...)               exit_(_, ##__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:107:21: note: expanded from macro 'exit_'
>>>> #define exit_(...)              exit_X(__VA_ARGS__, _1, _0)(__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:108:32: note: expanded from macro 'exit_X'
>>>> #define exit_X(_0, _1, X, ...)  exit ## X
>>>>                               ^
>>>> <scratch space>:41:1: note: expanded from here
>>>> exit_1
>>>> ^
>>>> ./src/poudriere-sh/helpers.h:110:58: note: expanded from macro 'exit_1'
>>>> #define exit_1(_, status)       verrorwithstatus(status, NULL, NULL)
>>>>                                                              ^~~~
>>>> /usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL'
>>>> #define NULL    ((void *)0)
>>>>               ^~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:104:49: note: passing argument to parameter here
>>>> void verrorwithstatus(int, const char *, va_list) __printf0like(2, 0) __dead2;
>>>>                                               ^
>>>> src/libexec/poudriere/pwait/pwait.c:275:5: error: passing 'void *' to parameter of incompatible type 'va_list' (aka '__builtin_va_list')
>>>>                               exit(124);
>>>>                               ^~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:106:20: note: expanded from macro 'exit'
>>>> #define exit(...)               exit_(_, ##__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:107:21: note: expanded from macro 'exit_'
>>>> #define exit_(...)              exit_X(__VA_ARGS__, _1, _0)(__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:108:32: note: expanded from macro 'exit_X'
>>>> #define exit_X(_0, _1, X, ...)  exit ## X
>>>>                               ^
>>>> <scratch space>:42:1: note: expanded from here
>>>> exit_1
>>>> ^
>>>> ./src/poudriere-sh/helpers.h:110:58: note: expanded from macro 'exit_1'
>>>> #define exit_1(_, status)       verrorwithstatus(status, NULL, NULL)
>>>>                                                              ^~~~
>>>> /usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL'
>>>> #define NULL    ((void *)0)
>>>>               ^~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:104:49: note: passing argument to parameter here
>>>> void verrorwithstatus(int, const char *, va_list) __printf0like(2, 0) __dead2;
>>>>                                               ^
>>>> src/libexec/poudriere/pwait/pwait.c:303:5: error: passing 'void *' to parameter of incompatible type 'va_list' (aka '__builtin_va_list')
>>>>                               exit(EX_OK);
>>>>                               ^~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:106:20: note: expanded from macro 'exit'
>>>> #define exit(...)               exit_(_, ##__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:107:21: note: expanded from macro 'exit_'
>>>> #define exit_(...)              exit_X(__VA_ARGS__, _1, _0)(__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:108:32: note: expanded from macro 'exit_X'
>>>> #define exit_X(_0, _1, X, ...)  exit ## X
>>>>                               ^
>>>> <scratch space>:43:1: note: expanded from here
>>>> exit_1
>>>> ^
>>>> ./src/poudriere-sh/helpers.h:110:58: note: expanded from macro 'exit_1'
>>>> #define exit_1(_, status)       verrorwithstatus(status, NULL, NULL)
>>>>                                                              ^~~~
>>>> /usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL'
>>>> #define NULL    ((void *)0)
>>>>               ^~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:104:49: note: passing argument to parameter here
>>>> void verrorwithstatus(int, const char *, va_list) __printf0like(2, 0) __dead2;
>>>>                                               ^
>>>> src/libexec/poudriere/pwait/pwait.c:319:2: error: passing 'void *' to parameter of incompatible type 'va_list' (aka '__builtin_va_list')
>>>>       exit(EX_OK);
>>>>       ^~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:106:20: note: expanded from macro 'exit'
>>>> #define exit(...)               exit_(_, ##__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:107:21: note: expanded from macro 'exit_'
>>>> #define exit_(...)              exit_X(__VA_ARGS__, _1, _0)(__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:108:32: note: expanded from macro 'exit_X'
>>>> #define exit_X(_0, _1, X, ...)  exit ## X
>>>>                               ^
>>>> <scratch space>:44:1: note: expanded from here
>>>> exit_1
>>>> ^
>>>> ./src/poudriere-sh/helpers.h:110:58: note: expanded from macro 'exit_1'
>>>> #define exit_1(_, status)       verrorwithstatus(status, NULL, NULL)
>>>>                                                              ^~~~
>>>> . . .
>>>>
>>>>
>>>> --- src/poudriere-sh/sh-mkdir.o ---
>>>> cc -DHAVE_CONFIG_H -I. -I./src   -mcpu=cortex-a72 -Wall -pipe -O2   -Wno-extra -DSHELL -std=gnu99 -DVTABSIZE=1000  -DNO_HISTORY -Wno-unused-const-variable -include  ./external/sh_compat/compat.h -I./src  -I./external/sh -I./src/poudriere-sh  -I./src/poudriere-sh -O2 -pipe -mcpu=cortex-a72  -g -fstack-protector-strong -fno-strict-aliasing -MT src/poudriere-sh/sh-mkdir.o -MD -MP -MF src/poudriere-sh/.deps/sh-mkdir.Tpo -c -o src/poudriere-sh/sh-mkdir.o `test -f 'src/poudriere-sh/mkdir.c' || echo './'`src/poudriere-sh/mkdir.c
>>>> . . .
>>>> --- src/poudriere-sh/sh-mkdir.o ---
>>>> src/poudriere-sh/mkdir.c:139:2: error: passing 'void *' to parameter of incompatible type 'va_list' (aka '__builtin_va_list')
>>>>       exit(exitval);
>>>>       ^~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:106:20: note: expanded from macro 'exit'
>>>> #define exit(...)               exit_(_, ##__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:107:21: note: expanded from macro 'exit_'
>>>> #define exit_(...)              exit_X(__VA_ARGS__, _1, _0)(__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:108:32: note: expanded from macro 'exit_X'
>>>> #define exit_X(_0, _1, X, ...)  exit ## X
>>>>                               ^
>>>> <scratch space>:46:1: note: expanded from here
>>>> exit_1
>>>> ^
>>>> ./src/poudriere-sh/helpers.h:110:58: note: expanded from macro 'exit_1'
>>>> #define exit_1(_, status)       verrorwithstatus(status, NULL, NULL)
>>>>                                                              ^~~~
>>>> /usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL'
>>>> #define NULL    ((void *)0)
>>>>               ^~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:104:49: note: passing argument to parameter here
>>>> void verrorwithstatus(int, const char *, va_list) __printf0like(2, 0) __dead2;
>>>>                                               ^
>>>> src/poudriere-sh/mkdir.c:226:2: error: passing 'void *' to parameter of incompatible type 'va_list' (aka '__builtin_va_list')
>>>>       exit (EX_USAGE);
>>>>       ^~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:106:20: note: expanded from macro 'exit'
>>>> #define exit(...)               exit_(_, ##__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:107:21: note: expanded from macro 'exit_'
>>>> #define exit_(...)              exit_X(__VA_ARGS__, _1, _0)(__VA_ARGS__)
>>>>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> ./src/poudriere-sh/helpers.h:108:32: note: expanded from macro 'exit_X'
>>>> #define exit_X(_0, _1, X, ...)  exit ## X
>>>>                               ^
>>>> <scratch space>:47:1: note: expanded from here
>>>> exit_1
>>>> . . .
>>>>
>>>> I'll not list the rest.
>>>
>>> I'll note that https://developer.arm.com/documentation/ihi0055/d/ reports
>>> that va_list is based on:
>>>
>>> struct __va_list {
>>> void *__stack;
>>>   void *__gr_top;
>>>   void *__vr_top;
>>>   int   __gr_offs;
>>>   int   __vr_offs;
>>> }
>>>
>>> so NULL is not type compatible for aarch64.
>>>
>>> My guess is an empty va_list needs to be created and used
>>> instead of NULL, following the normal va_list protocol. This
>>> should avoid presumptions about aspects that the language
>>> standard does not specify.
>>>
>>
>>
>> My armv7 contexts fail similarly.
>>
>> https://developer.arm.com/documentation/ihi0042/latest
>>
>> indicates that the va_list typedef is for:
>>
>> struct __va_list {void *__ap;}
>>
>> So, again, NULL it not type compatible.
>>
> 
> [Bryan has seen a variation of this material via comments
> on github.]
> 
> poudriere-devel was later updated to avoid the type compatibility.
> But the update does not follow the va_list protocol in that it
> does initialization of a va_list via ={} to supposedly form an
> empty va_list. The ={} is not guaranteed by the language (C99+,
> say) to assign the same va_list content as va_start would for an
> empty match to a routine's ... in its parameter list.
> 
> It looks to be that va_start is the only langauge-definition
> supported form of initialization of a va_list (and that va_end
> is required to close out such an initialized va_list).
> 
> So the likes of:
> 
> git: 14e5e1370ddb - main - ports-mgmt/poudriere-devel: Update to 3.3.0-1020-g59a87677c Bryan Drewery
> and:
> git: 4116dc2f1f63 - main - ports-mgmt/poudriere-devel: Update to 3.3.0-1022-g964cf327f Bryan Drewery
> 
> may not prove sufficient in general, although it may well "work"
> for amd64 where NULL happened to be compatible with va_list
> as far as types go. I do not claim a known operational failure
> elsewhere, just going outside what the langauge guarantees for
> source code to be guaranteed work for a correct language
> implementation.
> 

If it builds I don't think it will matter beyond that. The va_list is 
only used if the msg param is non-NULL, which it always is in this case.

See external/sh/error.c verrorwithstatus().

-- 
Bryan Drewery