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

GUACAMOLE-1841: Create a Cygwin build option. #454

Closed
wants to merge 15 commits into from

Conversation

jmuehlner
Copy link
Contributor

@jmuehlner jmuehlner commented Aug 1, 2023

I was able to build and run this successfully using Cygwin. All other protocols are working correctly, as all required libraries are either provided by Cygwin, or easily built from source.

The main difference here is that Windows named pipes are used for IPC instead of local socket pairs, since these do not work as required in Cygwin/Windows. Many other related changes flow from there.

I would greatly appreciate it if people would review this carefully and give it a try themselves, especially any Windows experts (I am decidedly not one).

TODO:

1. Figure out how to build libwebsockets to enable Kubernetes support.
2. Add a README with build instructions for Cygwin.
3. Figure out how to configure fonts on windows for text-based protocols


if test "x$with_winsock" != "xno"
if test "x$with_cygwin" = "xno"
Copy link
Contributor Author

@jmuehlner jmuehlner Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Winsock support will be detected on Cygwin, but will induce compilation errors if an attempt is made to actually build with it:

In file included from /usr/include/w32api/winsock2.h:56,
                 from socket-fd.c:35:
/usr/include/w32api/psdk_inc/_fd_types.h:100:2: error: #warning "fd_set and associated macros have been defined in sys/types.      This can cause runtime problems with W32 sockets" [-Werror=cpp]
  100 | #warning "fd_set and associated macros have been defined in sys/types.  \
      |  ^~~~~~~
In file included from socket-fd.c:35:
/usr/include/w32api/winsock2.h:1031:34: error: conflicting types for 'select'; have 'int(int,  fd_set *, fd_set *, fd_set *, const TIMEVAL *)'
 1031 |   WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const TIMEVAL *timeout);
      |                                  ^~~~~~
In file included from /usr/include/sys/time.h:49,
                 from socket-fd.c:31:
/usr/include/sys/select.h:80:5: note: previous declaration of 'select' with type 'int(int,  fd_set *, fd_set *, fd_set *, struct timeval *)'
   80 | int select __P ((int __n, fd_set *__readfds, fd_set *__writefds,
      |     ^~~~~~
In file included from socket-fd.c:35:
/usr/include/w32api/winsock2.h:1040:34: error: conflicting types for 'gethostname'; have 'int(char *, int)'
 1040 |   WINSOCK_API_LINKAGE int WSAAPI gethostname(char *name,int namelen);
      |                                  ^~~~~~~~~~~
In file included from /usr/include/unistd.h:4,
                 from guacamole/socket-fntypes.h:31,
                 from guacamole/socket.h:31,
                 from socket-fd.c:23:
/usr/include/sys/unistd.h:286:9: note: previous declaration of 'gethostname' with type 'int(char *, size_t)' {aka 'int(char *, long unsigned int)'}
  286 |  int    gethostname (char *__name, size_t __len);
      |         ^~~~~~~~~~~

src/libguac/wait-handle.c Show resolved Hide resolved
* https://learn.microsoft.com/en-us/windows/win32/api/ioapiset/nf-ioapiset-getoverlappedresult#remarks.
*/
OVERLAPPED overlapped = { 0 };
overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add a check for if CreateEvent fails.

If it fails, it returns NULL and an error message can be retrieved by calling GetLastError.

* Overlapped structure and associated event for waiting on async call.
*/
OVERLAPPED overlapped = { 0 };
overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add a check for if CreateEvent fails.

If it fails, it returns NULL and an error message can be retrieved by calling GetLastError.

src/libguac/guacamole/handle-helpers.h Show resolved Hide resolved
src/guacd/connection.c Show resolved Hide resolved
src/guacd/move-pipe.c Show resolved Hide resolved
src/guacd/move-pipe.c Show resolved Hide resolved
src/guacd/proc.c Outdated Show resolved Hide resolved
@jmuehlner jmuehlner force-pushed the GUACAMOLE-1841-cygwin-build branch 2 times, most recently from 6f68d7e to 1c98b79 Compare August 2, 2023 20:57
@jmuehlner jmuehlner force-pushed the GUACAMOLE-1841-cygwin-build branch 2 times, most recently from 46da6c8 to 462242a Compare October 3, 2023 21:57
@jmuehlner jmuehlner force-pushed the GUACAMOLE-1841-cygwin-build branch 6 times, most recently from 320039d to 2a0fe85 Compare October 4, 2023 23:56
@jmuehlner jmuehlner force-pushed the GUACAMOLE-1841-cygwin-build branch 3 times, most recently from 39bee57 to afb1b36 Compare October 17, 2023 19:25
@jmuehlner jmuehlner force-pushed the GUACAMOLE-1841-cygwin-build branch 5 times, most recently from a0d18a5 to b4d8c1c Compare October 18, 2023 17:49
@jmuehlner jmuehlner force-pushed the GUACAMOLE-1841-cygwin-build branch 14 times, most recently from 8b00944 to fd9c93f Compare November 8, 2023 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants