helpGnuTLS - Support: sr #107827, Build GnuTLS 3.0.2 for windows!

 
 

sr #107827: Build GnuTLS 3.0.2 for windows!

Submitted by:  Bjørn Christensen <cybear>
Submitted on:  Mon 03 Oct 2011 12:35:24 PM UTC  
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  Nikos Mavrogiannopoulos <nmav>
Open/Closed:  Closed Operating System:  None

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Tue 04 Oct 2011 09:49:28 AM UTC, comment #15: 

The #undef select worked, thank you!

I have made some more changes to avoid warnings:

in nettle/rnd.c line 32

I have add #include <locks.h>  to avoid warnings on gnutls_mutex* undeclared.

and in gnutls_str_array.h I have added
#include <gnutls_error.h>

just after the #include <gnutls_int.h>

/bhc

Bjørn Christensen <cybear>
Tue 04 Oct 2011 09:29:51 AM UTC, comment #14: 

Could you add an #undef select, under the #undef recv?

Anonymous
Tue 04 Oct 2011 08:10:36 AM UTC, comment #13: 

<sys/select.h> is not available under windows, it tried with <winsock2.h> where select in define for windows but it did not help.

If I add <sys/select.h> I get file not found.

I can see that the old gcrypt.h had a forward declarations for select, but now where we have moved to nettle gcrypt.h is not included any more.

I am sure that the declaration of select is in the winsock2.h

The declaration of select is cover by a:
#if ! (defined (_INSIDE_CYGWIN_) || defined (_INSIDE_MSYS_))

Which is not is not the case. I do not know what that means.

I can solve the problem by in the #ifdef _WIN32 section of system.c  include the winsock2.h and add a forward declaration for select. (stolen from gcrypt.h)

#ifdef _WIN32
#include <windows.h>

#include <winsock2.h>
ssize_t (*select) (int nfd, void rset, void wset, void eset, struct timeval timeout);

#else

That is not a nice solution but it works.

Better suggestions are appreciated

/bhc

PS: --disable-cxx worked.

Thanks!

Bjørn Christensen <cybear>
Mon 03 Oct 2011 09:18:40 PM UTC, comment #12: 

You can use ./configure --disable-cxx
to disable the C++ library.

About the select issue, if you add an include <sys/select.h> does it work?

Nikos Mavrogiannopoulos <nmav>
Project AdministratorIn charge of this item.
Mon 03 Oct 2011 08:15:21 PM UTC, comment #11: 

make -i build libgnutls.a but when I link with the application I get an error:

/devt/users/bhc/build/congassl/win/congassl32/libs/libgnutls.a(system.o):system.c:(.text+0x172): undefined reference to `_select_used_without_including_sys_select_h'

and a warning from compiling lib/system.c

system.c: In function 'system_recv_timeout':
system.c:132: warning: implicit declaration of function 'select_used_without_including_sys_select_h'

I have tried to include <winsock2.h> after <windows.h> but that did not help.

I looks to me like a it would like to have sys/select.h included.

/bhc

Bjørn Christensen <cybear>
Mon 03 Oct 2011 07:05:17 PM UTC, comment #10: 

make -i in lib/ works, then I get the libgnutls.a

Can I skip building the libgnutlsxx.a lib? running make with -i could bring me into problem later.

/bhc

Bjørn Christensen <cybear>
Mon 03 Oct 2011 04:22:21 PM UTC, comment #9: 

Even if you use make -i in lib/?

Nikos Mavrogiannopoulos <nmav>
Project AdministratorIn charge of this item.
Mon 03 Oct 2011 04:03:59 PM UTC, comment #8: 

I would but the make file ends without producing a libgnutls.a

/bhc

Bjørn Christensen <cybear>
Mon 03 Oct 2011 03:38:46 PM UTC, comment #7: 

If you don't use the c++ gnutls library ignore this issue. It looks like a header problem to me.

Nikos Mavrogiannopoulos <nmav>
Project AdministratorIn charge of this item.
Mon 03 Oct 2011 03:26:48 PM UTC, comment #6: 

I have this from the log file when building:

I am not sure what is wrong here! I have included <vector> in my sourcefiles with out problems.

  CC     crypto-backend.lo
  CC     gnutls_srp.lo
  CC     gnutls_psk.lo
  CCLD   libgnutls.la
copying selected object files to avoid basename conflicts...
  CXX    libgnutlsxx_la-gnutlsxx.lo
In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/cwchar:52,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/bits/postypes.h:46,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/iosfwd:49,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/bits/stl_algobase.h:70,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/vector:66,
                 from ./includes/gnutls/gnutlsxx.h:27,
                 from gnutlsxx.cpp:5:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/ctime:76: error: '::gmtime' has not been declared
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/ctime:77: error: '::localtime' has not been declared
make[3]: *** [libgnutlsxx_la-gnutlsxx.lo] Error 1
make[3]: Leaving directory `/devt/users/bhc/build/congassl/win/congassl32/gnutls-3.0.2/lib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/devt/users/bhc/build/congassl/win/congassl32/gnutls-3.0.2/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/devt/users/bhc/build/congassl/win/congassl32/gnutls-3.0.2'
make: *** [all] Error 2

Bjørn Christensen <cybear>
Mon 03 Oct 2011 02:05:39 PM UTC, comment #5: 

gnutls_dtls.c line 48 uint  ==> unsigned int

uint is not declared.

Bjørn Christensen <cybear>
Mon 03 Oct 2011 01:11:52 PM UTC, comment #4: 

Including wincrypt.h makes the rnd.c compile with warnings.

But I suspect that the warnings are because I have an old version of the cross compiler HCRYPTPROV is define as ULONG where real windows declares it as ULONG *.

I cannot cover all of egd.c with #ifndef _WIN32 unless I also do it for the headerfile.

Or leave some empty function for the defined function in the header file.

What do you normally do?

Bjørn Christensen <cybear>
Mon 03 Oct 2011 01:04:06 PM UTC, comment #3: 

So does including wincrypt.h fixes the issue in nettle/rnd.c?
For egd.c you don't need it. Add an #ifndef _WIN32 after include config.h.

Anonymous
Mon 03 Oct 2011 01:03:28 PM UTC, comment #2: 

Is it correct that egd.c is not used when _WIN32 is defined.

_rndegd_connect_socket is only called from the POSIX section of rnd.c

can all of egd.c be removed for windows?

/bhc

Bjørn Christensen <cybear>
Mon 03 Oct 2011 12:38:02 PM UTC, comment #1: 

That was a little to short!

I can not compile nettle/rnd.c
I think it is needed to include <windows.h> and <wincrypt.h> to have HCRYPTPROV defined.

egd.c also have a problem it includes <sys/un.h> which does not exist on windows.

Please Advise

/bhc

Bjørn Christensen <cybear>
Mon 03 Oct 2011 12:35:24 PM UTC, original submission:  
Bjørn Christensen <cybear>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nmav (Posted a comment)
  • -email is unavailable- added by cybear (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-10-23 nmav StatusNone => Done
        Assigned toNone => nmav
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.7