[OpenWrt-Devel] -Werror=format-nonliteral and musl

W. Michael Petullo mike at flyn.org
Sun Mar 17 11:05:12 EDT 2019

>> It seems this follows from the use of -Werror=format-nonliteral. The
>> definition in musl's stdio.h is as follows:
>> _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, const char *__f, ...)
>> {
>>         size_t __b = __builtin_object_size(__s, 0);
>>         if (__n > __b)
>>                 __builtin_trap();
>>         return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
>> }
>> Other packages address this locally by setting TARGET_CFLAGS to include
>> -Wno-format-nonliteral. See for example the commit "package/elfutils:
>> add CFLAG -Wno-format-nonliteral."
>> Is there a more global way to address this?

> The issue is probably missing __attribute__((format(printf, x, x))) in
> function declarations in fortify-headers. I can whip up a patch if
> you'd like.

Do you mean a patch for musl?

I also came across some trouble when updating the gst1-plugins-good
package. Gst-plugins-good captures ioctl with a function pointer,
but musl declares ioctl's second argument as an int whereas glibc and
gst1-plugins-good expect it to be a long. This causes a "incompatible
pointer type" warning, which OpenWrt treats as an error.

I again address this by using CFLAGS to turn off a warning.

Musl does not provide a __MUSL__-like symbol for cpp to use, so the
gst1-plugins-good folks are not likely to fix this with a simple #ifdef
as they do with Android. I read musl's position on this in their FAQ, and
I do not disagree. I do wonder about the right way to handle this, though.

There is some discussion about the ioctl function pointer issue at:




openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list