Menu

#1238 wsdl tool doesn't build on alpine

v1.0 (example)
closed-fixed
7
2019-06-26
2019-02-20
No

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.

2 Attachments

Discussion

  • Mindaugas Vinkelis

    to test it is very simple (if you have docker)
    just run
    docker build -t test_alpine_gsoap .

     
  • Robert van Engelen

    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 #if branch. There are already OS-depenent checks for gethostbyname_r, strerror_r, and SOCKLEN_T. So we just need to add compile-time #if checks (and branch if neeed) for Alpine. Thanks.

     
  • Robert van Engelen

    • status: open --> pending
     
  • Mindaugas Vinkelis

    1) enter docker container
    docker run -it n0madic/alpine-gcc:8.2.0 /bin/bash
    2) dump preprocessor defines for c++ (https://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines)
    g++ -dM -E -x c++ - < /dev/null
    there are too many of them, so i added file attachment.
    Hope that helps :)

     
  • Robert van Engelen

    Surprisingly Alpine Linux defines _GNU_SOURCE 1 which means that non-standard functions are available. But those do not compile. Alpine also does not define _XOPEN_SOURCE or _POSIX_C_SOURCE so just defining _GNU_SOURCE 1 is just plain wrong! See e.g. https://stackoverflow.com/questions/5582211/what-does-define-gnu-source-imply

     
  • Robert van Engelen

    Can you try the attached update for 2.8.80? I wasn't able to use docker in the way you suggested.

     
  • Mindaugas Vinkelis

    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?

     
  • Robert van Engelen

    Change the soap_strerror code as follows and let me know if this change compiles on Alpine;

    # ifdef HAVE_STRERROR_R
    #  if (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__ANDROID__) || defined(__GLIBC__) || defined(__GNU__) || defined(__GNUC__) || defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD)
        strerror_r(err, soap->msgbuf, sizeof(soap->msgbuf)); /* XSI-compliant */
    
     
  • Robert van Engelen

    Ignore the previous message. Please try the attached patch. Thanks!

     
  • Mindaugas Vinkelis

    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)

     
  • Robert van Engelen

    • status: pending --> closed-fixed
     
  • Robert van Engelen

    • status: closed-fixed --> open-fixed
    • assigned_to: Robert van Engelen
     
  • Robert van Engelen

    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 calls gethostbyname_r to the following:

    #if defined(__GLIBC__) && (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) && defined(HAVE_GETHOSTBYNAME_R)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__ANDROID__) || (defined(HAVE_GETHOSTBYNAME_R) && (defined(FREEBSD) || defined(__FreeBSD__)))
      while ((r = gethostbyname_r(addr, hostent, tmpbuf, tmplen, &hostent, &soap->errnum)) < 0)
    

    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
  • Robert van Engelen

    • status: open-fixed --> closed-fixed
     
  • Robert van Engelen

    I've added a Docker example of gSOAP with Alpine, see https://www.genivia.com/examples/docker

    The problem with gethostbyname_r is mentioned there. Upcoming version 2.8.87 will hopefully have a fix once and for all.

     

Log in to post a comment.

MongoDB Logo MongoDB