Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows builds #164

Closed
Neustradamus opened this issue Sep 23, 2021 · 3 comments
Closed

Windows builds #164

Neustradamus opened this issue Sep 23, 2021 · 3 comments

Comments

@Neustradamus
Copy link

Dear @ bk138,

Where are the current Windows builds from 2021?

@bk138
Copy link
Owner

bk138 commented Sep 23, 2021

There are none at the moment as no Windows CI/CD is set up. Help welcome!

@genpfault
Copy link

Got the AndroidMultiVNC-2.1.1 tag to build on Windows with Visual Studio 2019.

Required CMake 3.25.2 (so wxWidgets_ROOT_DIR would work properly with the wxWidgets v3.2.1 binaries) and some fix-up patches:

  • multivnc:

    diff --git a/src/VNCConn.cpp b/src/VNCConn.cpp
    index 75c5d5e..c030f82 100644
    --- a/src/VNCConn.cpp
    +++ b/src/VNCConn.cpp
    @@ -28,7 +28,7 @@
     #include <wx/log.h>
     #include <wx/socket.h>
     #ifdef __WIN32__
    -#include <winsock.h>
    +#include <winsock2.h>
     #else
     #include <arpa/inet.h>
     #endif
    @@ -1650,18 +1650,30 @@ int VNCConn::getMaxSocketRecvBufSize()
       int recv_buf_try = 33554432; // 32 MB
       if(setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char*)&recv_buf_try, sizeof(recv_buf_try)) < 0)
         {
    +    #ifdef __WIN32__
    +      closesocket(sock);
    +    #else
           close(sock);
    +    #endif
           return -1;
         }
       int recv_buf_got = -1;
       socklen_t recv_buf_got_len = sizeof(recv_buf_got);
       if(getsockopt(sock, SOL_SOCKET, SO_RCVBUF,(char*)&recv_buf_got, &recv_buf_got_len) <0)
         {
    +    #ifdef __WIN32__
    +      closesocket(sock);
    +    #else
           close(sock);
    +    #endif
           return -1;
         }
    
    +#ifdef __WIN32__
    +  closesocket(sock);
    +#else
       close(sock);
    +#endif
    
       return recv_buf_got/1024;
     }
    
  • multivnc/libwxservdisc:

    diff --git a/src/mdnsd.c b/src/mdnsd.c
    index 5976dd2..0dc4fd5 100644
    --- a/src/mdnsd.c
    +++ b/src/mdnsd.c
    @@ -25,6 +25,20 @@ They inter-relate too, like records affect the querys they are relevant to
     Nice things about MDNS: we only publish once (and then ask asked), and only query once, then just expire records we've got cached
     */
     
    +#ifdef WIN32
    +#include <fcntl.h>
    +#include <conio.h>
    +#include <sys/timeb.h>
    +
    +static void gettimeofday(struct timeval* tv, char* dummy)
    +{
    +   SYSTEMTIME t;
    +   GetSystemTime(&t);
    +   tv->tv_sec=t.wHour*3600+t.wMinute*60+t.wSecond;
    +   tv->tv_usec=t.wMilliseconds*1000;
    +}
    +#endif
    +
     struct query
     {
         char *name;
    
  • multivnc/libvncserver:

    diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c
    index f843c13f..175b1832 100644
    --- a/libvncclient/rfbproto.c
    +++ b/libvncclient/rfbproto.c
    @@ -75,6 +75,20 @@
     
     #define MAX_TEXTCHAT_SIZE 10485760 /* 10MB */
     
    +#if !defined LIBVNCSERVER_HAVE_GETTIMEOFDAY && defined WIN32
    +#include <fcntl.h>
    +#include <conio.h>
    +#include <sys/timeb.h>
    +
    +static void gettimeofday(struct timeval* tv, char* dummy)
    +{
    +   SYSTEMTIME t;
    +   GetSystemTime(&t);
    +   tv->tv_sec=t.wHour*3600+t.wMinute*60+t.wSecond;
    +   tv->tv_usec=t.wMilliseconds*1000;
    +}
    +#endif
    +
     /*
      * rfbClientLog prints a time-stamped message to the log file (stderr).
      */
    diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c
    index d83df158..0f710f73 100644
    --- a/libvncclient/vncviewer.c
    +++ b/libvncclient/vncviewer.c
    @@ -41,6 +41,20 @@
     #include "tls.h"
     #include "ghpringbuf.h"
     
    +#if !defined LIBVNCSERVER_HAVE_GETTIMEOFDAY && defined WIN32
    +#include <fcntl.h>
    +#include <conio.h>
    +#include <sys/timeb.h>
    +
    +static void gettimeofday(struct timeval* tv, char* dummy)
    +{
    +   SYSTEMTIME t;
    +   GetSystemTime(&t);
    +   tv->tv_sec=t.wHour*3600+t.wMinute*60+t.wSecond;
    +   tv->tv_usec=t.wMilliseconds*1000;
    +}
    +#endif
    +
     static void Dummy(rfbClient* client) {
     }
     static rfbBool DummyPoint(rfbClient* client, int x, int y) {
    diff --git a/libvncserver/main.c b/libvncserver/main.c
    index ece36bf0..994d7341 100644
    --- a/libvncserver/main.c
    +++ b/libvncserver/main.c
    @@ -55,6 +55,20 @@ char rfbEndianTest = (1==0);
     char rfbEndianTest = (1==1);
     #endif
     
    +#if !defined LIBVNCSERVER_HAVE_GETTIMEOFDAY && defined WIN32
    +#include <fcntl.h>
    +#include <conio.h>
    +#include <sys/timeb.h>
    +
    +static void gettimeofday(struct timeval* tv, char* dummy)
    +{
    +   SYSTEMTIME t;
    +   GetSystemTime(&t);
    +   tv->tv_sec=t.wHour*3600+t.wMinute*60+t.wSecond;
    +   tv->tv_usec=t.wMilliseconds*1000;
    +}
    +#endif
    +
     /*
      * Protocol extensions
      */
    @@ -1375,20 +1389,6 @@ void rfbShutdownServer(rfbScreenInfoPtr screen,rfbBool disconnectClients) {
     #endif
     }
     
    -#if !defined LIBVNCSERVER_HAVE_GETTIMEOFDAY && defined WIN32
    -#include <fcntl.h>
    -#include <conio.h>
    -#include <sys/timeb.h>
    -
    -static void gettimeofday(struct timeval* tv,char* dummy)
    -{
    -   SYSTEMTIME t;
    -   GetSystemTime(&t);
    -   tv->tv_sec=t.wHour*3600+t.wMinute*60+t.wSecond;
    -   tv->tv_usec=t.wMilliseconds*1000;
    -}
    -#endif
    -
     rfbBool
     rfbProcessEvents(rfbScreenInfoPtr screen,long usec)
     {
    diff --git a/rfb/rfb.h b/rfb/rfb.h
    index 0c37e5ea..8c7a6047 100644
    --- a/rfb/rfb.h
    +++ b/rfb/rfb.h
    @@ -394,7 +394,7 @@ typedef struct _rfbScreenInfo
         uint16_t  mcublen;
         rfbBool multicastUseCopyRect;            /**< All multicast clients support CopyRect */
         sraRegionPtr multicastUpdateRegion;
    -#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
    +#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) || defined(LIBVNCSERVER_HAVE_WIN32THREADS)
         MUTEX(multicastOutputMutex);             /**< Ensures that exactly one thread is sending multicast output */
         MUTEX(multicastUpdateMutex);             /**< Ensures that exactly one thread is processing a multicast framebuffer update */
         MUTEX(multicastSharedMutex);             /**< Ensures that exactly one thread is modifying the shared variables
    

bk138 added a commit that referenced this issue May 1, 2023
bk138 added a commit that referenced this issue May 1, 2023
bk138 added a commit that referenced this issue May 1, 2023
bk138 added a commit that referenced this issue May 1, 2023
bk138 added a commit that referenced this issue May 1, 2023
@bk138
Copy link
Owner

bk138 commented May 1, 2023

Windows CI now builds, missing bits are

Contributions welcome!

bk138 added a commit that referenced this issue May 1, 2023
bk138 added a commit that referenced this issue May 1, 2023
bk138 added a commit that referenced this issue May 7, 2023
@bk138 bk138 closed this as completed in e7adc9e May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants