xlocale.h strikes again
Development toolkit for Web Services and XML data bindings for C & C++
Brought to you by:
engelen
With gsoap-2.8.62, glibc-2.26 and g++-7, I get:
$ g++ -c x.cpp
In file included from x.cpp:2:0:
/usr/include/stdsoap2.h:732:13: fatal error: xlocale.h: No such file or directory
# include <xlocale.h>
^~~~~~~~~~~
compilation terminated.
$ cat x.cpp
#include <math.h>
#include <stdsoap2.h>
gsoap needs to cease unconditionally including <xlocale.h>.</xlocale.h>
That is because other folks have complained that it would otherwise not compile on their Linux system!!
The problem is that we have several customers who cannot use gSOAP 2.8.5x and 2.8.6x on their Linux OS because of errors compiling
locale_t, which is not defined without includingxlocale.hexplicitly. I have tested this on several Linux distros and it works fine. If you can share with me a#ifdefthat tests for your specific OS version than we can consider using it,xlocale.his conditionally included, see stdsoap2.h:The
config.hfile that is build with./configurealso definesHAVE_XLOCALE_H. Theconfig.hfile is used to buildlibgsoap.aetc.Your config.h may be used while building libgsoap.a, but not while building other party's software that tries to use (/usr/include/)stdsoap2.h, for several reasons:
.. fixing that will take me a while
I cannot remove
#define HAVE_XLOCALE_Hfrom thedefined(__GLIBC__) || defined(__GNU__)because it breaks builds on some GNU Linux systems. If you have another#ifdefclause we can use to conditionally includexlocale.hthen we should consider it.Removing
xlocale.hfails on x86_64-redhat-linux with g++ (GCC) 4.4.7 (Red Hat 4.4.7-4). As expected./configuresets#define HAVE_XLOCALE_H 1to build the libs, but compiling the source code withoutconfig.hfails.I have made several improvements in 2.8.64 to deal with the
xlocale.hissues. I removed#include <xlocale.h>again. If GNU Linux systems requirexlocale.hthen./configurewill of course find it but if not the new option./configure --enable-xlocalewill force this as well as the new-DWITH_INCLUDE_XLOCALE_Hflag.The problem will likely still never go away as some Linux systems (Red Hat) require
xlocale.hto be included to uselocale_tand the locale_lfunctions.Hope this helps.
This is how headering ought to look like.
So what this patch does:
xlocale.h. That's inside out - it should be completely automatic. If one's system hasxlocale.h, it should be used, and if it is absent, it should not get used ever again. 2.8.63's approach withHAVE_XLOCALE_Hwas good as it was.HAVE_*variables were put intoconfig.h, butconfig.hwas never installed to/usr/include, making the whole exercise pointless.config.hclashes with other software when installed to/usr/include. A new file,gsoap_config.his put into existence.HAVE_*clashes with other software when used, so new names,GSOAP_WITH_*are used withgsoap_config.h.