wsdl tool doesn't build on alpine
Development toolkit for Web Services and XML data bindings for C & C++
Brought to you by:
engelen
wsdl tools doesn't compile, when compiling directly by using make -f MakefileManual secure.
I made docker image, that easily reproduces this bug, as well as a patch file, that fixed it.
In stdsoap2.h the issue might be with alpine itself, because it takes last options to define SOAP_SOCKLEN_T, but other compile errors looks like a bug in stdsoap2.cpp because it check if particular linux function exists, but calls it with incorrect signature.
to test it is very simple (if you have docker)
just run
docker build -t test_alpine_gsoap .Sorry but this patch is not very useful. You need to tell us which compile-time macros are set by the compiler on Alpine so we can add an
#ifbranch. There are already OS-depenent checks forgethostbyname_r,strerror_r, andSOCKLEN_T. So we just need to add compile-time#ifchecks (and branch if neeed) for Alpine. Thanks.1) enter docker container
docker run -it n0madic/alpine-gcc:8.2.0 /bin/bash2) dump preprocessor defines for c++ (https://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines)
g++ -dM -E -x c++ - < /dev/nullthere are too many of them, so i added file attachment.
Hope that helps :)
Surprisingly Alpine Linux defines
_GNU_SOURCE 1which means that non-standard functions are available. But those do not compile. Alpine also does not define_XOPEN_SOURCEor_POSIX_C_SOURCEso just defining_GNU_SOURCE 1is just plain wrong! See e.g. https://stackoverflow.com/questions/5582211/what-does-define-gnu-source-implyCan you try the attached update for 2.8.80? I wasn't able to use docker in the way you suggested.
Updated Dockerfile (now use latest alpine version: 3.9 with gcc 8.2.0 ), in case you're interested, and your patch fixed almost all problems, except this one:
../stdsoap2.cpp: In function 'const char soap_strerror(soap)':
../stdsoap2.cpp:22358:22: error: invalid conversion from 'int' to 'const char' [-fpermissive]
return strerror_r(err, soap->msgbuf, sizeof(soap->msgbuf)); / GNU-specific */
Don't know how to solve this, maybe it should be reported to alpine?
Change the
soap_strerrorcode as follows and let me know if this change compiles on Alpine;Ignore the previous message. Please try the attached patch. Thanks!
Hello,
Now it works like a charm ;) thanks!
Tested on three alpine distros with different compilers:
alpine 3.9 (g++ 8.2.0)
alpine 3.8 (g++ 6.4.0-r9)
alipne 3.3 (g++ 5.3.0)
Bad news. This change does not work on some systems such as Solaris. It seems to me that Alpine Linux has macros set that should not be as I pointed out.
I need to change stdsoap2.cpp/.c function
tcp_gethostbyname()the line before the line that callsgethostbyname_rto the following:Let me know if this breaks Alpine builds and how you plan to fix that since I am giving up on Alpine.
Last edit: Robert van Engelen 2019-04-18
I've added a Docker example of gSOAP with Alpine, see https://www.genivia.com/examples/docker
The problem with
gethostbyname_ris mentioned there. Upcoming version 2.8.87 will hopefully have a fix once and for all.