LCDproc development and user support list

Text archives Help


[Lcdproc] Problems compiling LCDproc 0.5.6 with MUSL


Chronological Thread 
  • From: philipp_subx at redfish-solutions.com (Philip Prindeville)
  • Subject: [Lcdproc] Problems compiling LCDproc 0.5.6 with MUSL
  • Date: Thu, 19 Jan 2017 19:04:33 -0700


> On Jan 19, 2017, at 4:11 PM, Harald Geyer <harald at ccbib.org> wrote:
>
> Philip Prindeville writes:
>> I’ve got most of the packaging done, I think. Have a look at:
>>
>> https://github.com/openwrt/packages/compare/master...pprindeville:lcdproc
>
> Thanks, that's interessting. Seems like we focused on quite different
> things during packaging. We should merge this stuff!


I have to admit I was doing it as a monolithic package at first just to see
if it works with the hardware I have (which was just shoved at me with little
documentation).

I added:

TARGET_CFLAGS += -Wall -Werror

to my Makefile just to see what it would shake out.

It may be highlighting some potential bugs. Or it might be noise.

configfile.c: In function 'process_config':
configfile.c:500:13: warning: variable 'k' set but not used
[-Wunused-but-set-variable]
ConfigKey *k;
^

it does indeed get assigned on line 698 as:

else {
/* Store the value*/
k = add_key(*current_section,
keyname, value);
}

but it’s then subsequently unreferenced.

Looking in configure.ac I see:

AC_CHECK_FUNCS(select socket strdup strerror strtol uname cfmakeraw snprintf)

but when building against MUSL, I get inconsistent results:

$ grep -e HAVE_SNPRINTF -e HAVE_CFMAKERAW -e HAVE_UNAME -e HAVE_STRTOL -e
HAVE_STRERROR -e HAVE_STRDUP -e HAVE_SOCKET -e HAVE_SELECT config.h
#define HAVE_CFMAKERAW 1
#define HAVE_SELECT 1
/* #undef HAVE_SNPRINTF */
#define HAVE_SOCKET 1
/* #undef HAVE_STRDUP */
#define HAVE_STRERROR 1
#define HAVE_STRTOL 1
#define HAVE_UNAME 1
$

these should ALL be defined.

Regarding providing your own snprintf()… Please don’t. The stdio library
is a notorious attack surface (the first major internet outage in 1989
exploited the finger daemon calling gets() and it hasn’t stopped since).

If a platform doesn’t provide adequate run-time functionality I would
suggest punting it.

When I compile snprintf.c with -Wall -Werror I get:

snprintf.c: In function 'vsnprintf':
snprintf.c:437:16: error: the comparison will always evaluate as 'true' for
the address of 'p' will never be NULL [-Werror=address]
if ((endp) != NULL) *(endp) = (p); \
^
snprintf.c:706:9: note: in expansion of macro 'atosizet'
atosizet(p, &p, &min_field_width);
^
snprintf.c:447:16: error: the comparison will always evaluate as 'true' for
the address of 'p' will never be NULL [-Werror=address]
if ((endp) != NULL) *(endp) = ep; \
^
snprintf.c:706:9: note: in expansion of macro 'atosizet'
atosizet(p, &p, &min_field_width);
^
snprintf.c:437:16: error: the comparison will always evaluate as 'true' for
the address of 'p' will never be NULL [-Werror=address]
if ((endp) != NULL) *(endp) = (p); \
^
snprintf.c:725:11: note: in expansion of macro 'atosizet'
atosizet(p, &p, &precision);
^
snprintf.c:447:16: error: the comparison will always evaluate as 'true' for
the address of 'p' will never be NULL [-Werror=address]
if ((endp) != NULL) *(endp) = ep; \
^
snprintf.c:725:11: note: in expansion of macro 'atosizet'
atosizet(p, &p, &precision);
^
snprintf.c:648:19: warning: variable 'starting_p' set but not used
[-Wunused-but-set-variable]
const char *starting_p;
^
cc1: all warnings being treated as errors
Makefile:379: recipe for target 'snprintf.o' failed


>
> My current state is here:
> https://github.com/haraldg/packages/tree/lcdproc/utils/lcdproc


I’ll see if I can diff out versions and find anything significant you could
pick up from my version…


>
> of course this needs to be squashed before doing a PR. Also I still need
> to think how to handle the config files.


For the config files, I was going to use /etc/config/lcd and the UCI
interface…

That’s if I can get it working on my hardware to test it!


>
>> I’ll try to build against 0.5.8 in a little bit.
>
> Hm, I guess it will build for you as well as for me. :)
>
> Harald
>





Archive powered by MHonArc 2.6.18.

Top of page