develooper Front page | perl.perl5.porters | Postings from June 2020

Re: Smoke Failures on Alpine Linux

Thread Previous | Thread Next
From:
ilmari
Date:
June 16, 2020 09:54
Subject:
Re: Smoke Failures on Alpine Linux
Message ID:
87a713pcha.fsf@wibble.ilmari.org
Carlos Guevara <carlos@carlosguevara.com> writes:

> I recently started smoke testing Alpine Linux, and it appears that all
> builds using g++ are failing early in 'make'.  For example:
>
> https://perl5.test-smoke.org/report/114477
>
> I suspect it has something to do with the fact that Alpine uses musl
> instead of glibc:

Yes, this is the error messsage:

time64.c: In function 'void S_copy_little_tm_to_big_TM(const tm*, TM64*)':
time64.c:317:32: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
  317 |     dest->tm_zone       = src->tm_zone;
      |                           ~~~~~^~~~~~~
      |                                |
      |                                const char*


Which stems from the the fact that musl's time.h defines struct tm's
tm_zone as const char*, while time64.h only defines it as const on
glibc, QNX, Cygwin and Android (except under C++):

#ifdef HAS_TM_TM_ZONE
/* If glibc is defined or we are on QNX, use const.
 * Otherwise, if we are on android, use const but
 * not with g++.
 */
#  if defined(__GLIBC__) || (defined(__ANDROID__) && !defined(__cplusplus)) \
    || defined(__QNX__) || defined(__CYGWIN__)
        const
#  endif
        char    *tm_zone;
#endif

This compiles (with a warning) under C, but is not allowed under C++
(which nobody appears to have tried on musl before).

Unfortunately, musl doesn't define a preprocessor symbol
(https://wiki.musl-libc.org/faq.html#Q:-Why-is-there-no-%3Ccode%3E__MUSL__%3C/code%3E-macro?),
so we would have to replace the above preprocessor conditionals with a
Configure check for the actual constness of the field.

- ilmari
-- 
"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About