Error when building gnutls-wrapper

Project:GNU Smalltalk
Component:Build
Category:bug
Priority:normal
Assigned:Unassigned
Status:fixed
Description

Compilation \smalltalk-3.2.3\packages\net\gnutls-wrapper.c failed on Windows.

SHUT_RDWR macro does not exists here, it should be changed to SD_BOTH for working:

#ifdef _WIN32
shutdown (fd, SD_BOTH);
#else
shutdown (fd, SHUT_RDWR);
#endif

This fixed the compilation, but linking still fails because winsock is not included.
For fixing it, you must add "-lws2_32" to required libraries if Windows plaform is detected.

The used platform is mingw+msys.
Tested with smalltalk-3.2.3 but by looking in the GIT repository it seems that these problems still exist.

Sincerely,

Carlo Bramini.

Updates

#1 submitted by Paolo Bonzini on Tue, 03/22/2011 - 11:28
Attachment:fix-shutdown.patch (851 bytes)

Can you test this patch?

#2 submitted by Paolo Bonzini on Thu, 04/21/2011 - 06:58
Status:active» fixed

Assuming fixed...

#3 submitted by Carlo Bramini on Fri, 02/03/2012 - 20:04
Status:fixed» active
Attachment:sm.txt (1.3 KB)

It looks like the bug still exists in newer version and the patch seems wrong.
The SHUT_RDWR was still not found, probably because you added the various #define in the block where __MSVCRT__ is undefined.
I wouldn't use hardcoded values, I would simply define instead:

  1. define SHUT_RD SD_RECEIVE
  2. define SHUT_WR SD_SEND
  3. define SHUT_RDWR SD_BOTH

In my opinion there is no need to do #ifndef tests on them: if that code block is relative to Windows, then it is sure that these macro do not exist.
I do not understand very well why it has been tested __MSVCRT__ instead of _WIN32, but unless strictly required I would recommend to change it.
If socketx.h includes winsock2.h, then including windows.h is redundant because it is included directly by winsock2.h, so if you want you can delete that inclusion too.

It looks like that adding the library to gnutls_wrapper_LDADD is the right thing to do, but the order was wrong.
You must write instead:

gnutls_wrapper_LDADD = \

  $(GNUTLS_LIBS) \
  $(top_builddir)/lib-src/library.la \
  $(SOCKET_LIBS)

with $(SOCKET_LIBS) put in the bottom, otherwise a circular dependency will happen and the linking will fail.

Thanks for your time.
Sincerely,

Carlo Bramini.

PS: I got version 3.2.4, I tried to compile it, I got the error, I tried to search and I found an issue submitted by me that I had forgotten.
Should I have to get an email when somebody replied to this issue? Because I received nothing...

PPS: I did a patch with my proposed changes and I attached it. I did not only replaced __MSVCRT__ with _WIN32 because I do not know if you have some particular reason for using it.

#4 submitted by Paolo Bonzini on Sat, 02/04/2012 - 11:52
Status:active» fixed

I have not yet made a release, but I did fix the placement of the #defines in commit f38d4fa9ef4ac49a725e617c60ec26d685210e69.

I'll change the LDADD now, thanks!

User login