gSoap MinGW compilation error _set_errno was not declared in this scope

196 Views Asked by At

I am trying to compile gsoap_2.8.123 version in windows xp 32 bit (I realize that it is old, but for the project to be carried out I have no alternative)

I use MinGW (installed in C:\MinGW)as a compiler and ran mintty with the msys.bat beautify mintty command.

Inside mintty I ran ./configure So i run make and i get the following error

In file included from stdsoap2_cpp.cpp:65:0:
stdsoap2_cpp.cpp: In function 'SOCKET soap_accept(soap*)':
stdsoap2.h:1158:40: error: '_set_errno' was not declared in this scope
#  define soap_reset_errno _set_errno(0)
                                    ^
stdsoap2_cpp.cpp:7037:3: note: in expansion of macro 'soap_reset_errno'
soap_reset_errno;
^~~~~~~~~~~~~~~~

I tried with ./configure --includedir="C:\MinGW\lib\gcc\mingw32\6.3.0\include"

or

./configure --includedir="/MinGW/lib/gcc/mingw32/6.3.0/include"

without success

In config.log is reported

configure:6317: checking for errno.h
configure:6317: gcc -c -g -O2  conftest.c >&5
configure:6317: $? = 0
configure:6317: result: yes
...
configure:6407: checking for sys/socket.h
configure:6407: gcc -c -g -O2  conftest.c >&5
conftest.c:64:24: fatal error: sys/socket.h: No such file or directory
#include <sys/socket.h>

******* Update *******

I have installed msys-gcc and in C:\MinGW\msys\1.0\include there are the headers I need,

I tried with ./configure --includedir="/MinGW/msys/1.0/include/" and I keep getting the error checking for sys/socket.h ... no

***** Update *****

To set the include directories I set the environment variable:

SET CPPFLAGS=-I"C:\MinGW\msys\1.0\include" -I"C:\MinGW\include"

and is now used during compilation, as shown below, where it is noted that the _set_errno issue is still present :

make[4]: Entering directory `/c/PrgEda/Installazioni/gSoap/gsoap-2.8/gsoap'
gcc -DHAVE_CONFIG_H -I. -I..   -IC:\MinGW\msys\1.0\include -IC:\MinGW\include
-DMINGW -MT libgsoap_a-stdsoap2.o -MD -MP -MF .deps/libgsoap_a-stdsoap2.Tpo 
-c -o libgsoap_a-stdsoap2.o `test -f 'stdsoap2.c' || echo './'`stdsoap2.c
In file included from stdsoap2.c:65:0:
stdsoap2.c: In function 'soap_accept':
stdsoap2.h:1158:28: warning: implicit declaration of function '_set_errno' [-Wimplicit-function-declaration]
 #  define soap_reset_errno _set_errno(0)
                            ^
stdsoap2.c:7037:3: note: in expansion of macro 'soap_reset_errno'
   soap_reset_errno;

******* Update *******

In stdsoap2.h I have replaced

#define soap_reset_errno _set_errno(0)  

with

#define soap_reset_errno (errno = ENOENT)

and I set

export CPPFLAGS="-I/MinGW/msys/1.0/include/ -I/MinGW/include/ -m32 -std=gnu++11 -DWITH_NO_C_LOCALE"
export CXXFLAGS="-I/MinGW/msys/1.0/include/ -I/MinGW/include/ -m32 -std=gnu++11 -DWITH_NO_C_LOCALE"

but now I have this errors:

In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\postypes.h:40:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iterator:64,
                 from stdsoap2.h:752,
                 from stdsoap2_cpp.cpp:65:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:64:11: error: '::mbstate_t' has not been declared
   using ::mbstate_t;
           ^~~~~~~~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:141:11: error: '::btowc' has not been declared
   using ::btowc;
           ^~~~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:142:11: error: '::fgetwc' has not been declared
   using ::fgetwc;
           ^~~~~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:143:11: error: '::fgetws' has not been declared
   using ::fgetws;

...

c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar: In function 'wchar_t* std::wcschr(wchar_t*, wchar_t)':
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:213:19: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
   { return wcschr(const_cast<const wchar_t*>(__p), __c); }
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

...

Update

I have removed the includes from the CPPFLAGS and CXXFLAGS variables and now I no longer have the compilation errors

Update

With the above indications I was able to compile soapcpp2.exe, now I would like to compile wsdl2h.exe with ssl support, see How can I compile gSoap wsdl2h.exe using MinGW with ssl support

How can i include the correct compile directives using compile parameters ?

It seems that the configure script does not handle the includedir parameter

0

There are 0 best solutions below