[MXS-1265] strerror_r calls result in compiler warnings Created: 2017-05-14  Updated: 2018-02-20  Resolved: 2017-08-09

Status: Closed
Project: MariaDB MaxScale
Component/s: build, Core
Affects Version/s: 2.1.2
Fix Version/s: 2.2.0

Type: Bug Priority: Minor
Reporter: Ron Arts Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None
Environment:

Alpine Linux


Sprint: 2017-39

 Description   

Hi, I am trying to compile MaxScale on Alpine Linux. During building I get the following errors (excerpt):

/root/MaxScale-maxscale-2.0.5/server/core/buffer.c:738:9: note: in expansion of macro 'MXS_ERROR'
MXS_ERROR("Memory allocation failed due to %s.",
^~~~~~~~~
/root/MaxScale-maxscale-2.0.5/server/core/buffer.c: In function 'gwbuf_add_property':
/root/MaxScale-maxscale-2.0.5/server/core/buffer.c:822:19: error: format '%s' expects argument of type 'char *', but argument 6 has type 'int' [-Werror=format=]
MXS_ERROR("Memory allocation failed due to %s.",
^
/root/MaxScale-maxscale-2.0.5/server/include/log_manager.h:112:61: note: in definition of macro 'MXS_LOG_MESSAGE'
mxs_log_message(priority, _FILE, __LINE, __func, format, ##VA_ARGS_)
^~~~~~
/root/MaxScale-maxscale-2.0.5/server/core/buffer.c:822:9: note: in expansion of macro 'MXS_ERROR'
MXS_ERROR("Memory allocation failed due to %s.",
^~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [server/core/CMakeFiles/maxscale-common.dir/build.make:111: server/core/CMakeFiles/maxscale-common.dir/buffer.c.o] Error 1

I am baffled. strerror_r returns an int, and the format string uses %s. What am I missing here?



 Comments   
Comment by markus makela [ 2017-05-15 ]

This is due to the fact that Alpine linux uses musl instead of glibc and the strerror_r signature is different. MaxScale currently only supports glibc as the C library implementation but with newer versions, we're looking into making it possible to compile MaxScale on Alpine Linux.

Comment by markus makela [ 2017-08-09 ]

MaxScale now supports non-glib systems.

Comment by elliot schlegelmilch [ 2018-02-20 ]

in order to support non-glibc, do all the references of `strerror_r` need to be refactored with `mxs_strerror`?

Generated at Thu Feb 08 04:05:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.