I ran into this problem when trying to compile Wiimm's tools on Alpine Linux, a musl-based distro.
More specifically, dclib -- Wiimm's library which is bundled in to the source of his programs -- relies on stdout and stderr being mutable, behavior which is not mandated by the C standard. This is fine on glibc, where stdout and stderr are declared as mutable, but musl declares them as const.
The offending code is in
Alles anzeigen
If Wiimm is okay with it, I'm willing to try to create and submit a patch fixing the problem. I haven't found any place where I could submit a patch or contact Wiimm though, so if Wiimm wishes to fix the problem himself, that's also fine. Alternatively, if there's a workaround that I can use to get the programs to compile, please let me know. Thanks in advance!
More specifically, dclib -- Wiimm's library which is bundled in to the source of his programs -- relies on stdout and stderr being mutable, behavior which is not mandated by the C standard. This is fine on glibc, where stdout and stderr are declared as mutable, but musl declares them as const.
The offending code is in
dclib/dclib-color.c
. I've marked the offending lines with comments saying HERE
.C-Quellcode: dclib/dclib-color.c
- void RestoreStdFiles ( SavedStdFiles_t *ssf )
- {
- DASSERT(ssf);
- stdout = ssf->std_out; // HERE
- stderr = ssf->std_err; // HERE
- stdlog = ssf->std_log;
- stdmsg = ssf->std_msg;
- stdwrn = ssf->std_wrn;
- colout = ssf->col_out;
- colerr = ssf->col_err;
- collog = ssf->col_log;
- colmsg = ssf->col_msg;
- colwrn = ssf->col_wrn;
- stdout_seq_count = ssf->stdout_seq_count;
- }
- ///////////////////////////////////////////////////////////////////////////////
- void RedirectStdFiles
- (
- SavedStdFiles_t *ssf, // not NULL: save old output here
- FILE *f, // use this as out,err,log and msg, never NULL
- const ColorSet_t *colset,// new colset; if NULL: use GetFileColorSet(f)
- bool err_too // true: redirect stderr too
- )
- {
- DASSERT(f);
- if (ssf)
- SaveStdFiles(ssf);
- stdout = stdwrn = stdmsg = f; // HERE
- colout = colwrn = colmsg = colset ? colset : GetFileColorSet(f);
- // special handling for stdlog
- if (stdlog)
- {
- stdlog = stdout;
- collog = colout;
- }
- if (err_too)
- {
- stderr = stdout; // HERE
- colerr = colout;
- }
- }