guacamole-server icon indicating copy to clipboard operation
guacamole-server copied to clipboard

GUACAMOLE-1841: Implement MinGW build for libguac.

Open jmuehlner opened this issue 2 years ago • 3 comments

This PR enables a MinGW build for libguac only (no guacd) after I was unable to get the Cygwin build in https://github.com/apache/guacamole-server/pull/454 working.

Caveats: ~* RDP Printing needs further testing, and is subject to future changes~

  • I haven't figured out how to correctly set up FontConfig to read fonts on Windows, so the terminal protocols are not fully tested. If anyone has experience with FontConfig and Windows, I'd love to know about it!

jmuehlner avatar Jan 25 '24 19:01 jmuehlner

Hi, after building the final committed code using msys mingw64 shell according to the steps mentioned in windows build yaml file and running it, I get this error RDPGFX channel will be used for the RDP Graphics Pipeline Extension. Server resized display to 1396x654 Render planning phase 1/5 (draft): 0ms

Render planning phase 2/5 (rects): 0ms Render planning phase 3/5 (search): 0ms

Render planning phase 4/5 (combine): 0ms Render planning phase 5/5 (commit): 2ms

Thread 8 received signal SIGSEGV, Segmentation fault. [Switching to Thread 12292.0x3960] 0x00007ffa34a638b5 in ?? () from C:\msys64\mingw64\bin\libwinpthread-1.dll (gdb) bt #0 0x00007ffa34a638b5 in ?? () from C:\msys64\mingw64\bin\libwinpthread-1.dll #1 0x00007ff9cb6e1f29 in guac_client_alloc_stream () from C:\msys64\mingw64\bin\libguac-24.dll #2 0x00007ff9cb6e3165 in guac_client_stream_png () from C:\msys64\mingw64\bin\libguac-24.dll #3 0x00007ff9cb6e9002 in guac_display_worker_thread () from C:\msys64\mingw64\bin\libguac-24.dll #4 0x00007ffa34a666fb in ?? () from C:\msys64\mingw64\bin\libwinpthread-1.dll #5 0x00007ffa450df0ad in msvcrt!_beginthreadex () from C:\WINDOWS\System32\msvcrt.dll #6 0x00007ffa450df17c in msvcrt!_endthreadex () from C:\WINDOWS\System32\msvcrt.dll #7 0x00007ffa453ce8d7 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\System32\kernel32.dll #8 0x00007ffa45fdc5dc in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll #9 0x0000000000000000 in ?? ()

Using this simple socket code and connecting to it using guacamole client 1.5.5 running in docker, guac_socket* socket = guac_socket_open_wsa(connection); guac_parser* parser = guac_parser_alloc();

printf("Accepted connection. Waiting for select...\n");

/* Wait for select */
if (guac_parser_expect(parser, socket, 15000000, "select")) {
    printf("\"select\" not read: %s %d\n", guac_error_message,
            WSAGetLastError());
    return 1;
}

guac_client* client = guac_client_alloc();

client->log_handler = my_logging_handler;

if(guac_client_load_plugin(client, "rdp")) {
    printf("protocol loading failed\n");
    return 1;
}

/* Validate select length */
if (parser->argc != 1) {
    printf("\"select\" had wrong number of arguments.\n");
    return 1;
}

guac_user* user = guac_user_alloc();
user->owner = 1;

user->client = client;
user->socket = socket;

guac_user_handle_connection(user, 150000000);

palaashjain avatar May 20 '25 15:05 palaashjain

The issue is with, guac_client_alloc_stream, stream_index = guac_pool_next_int_below(client->internal->__stream_pool, GUAC_CLIENT_MAX_STREAMS);

client->internal->__stream_pool, not directly client->__stream_pool

palaashjain avatar May 21 '25 05:05 palaashjain

Also in, void guac_client_free_stream(guac_client* client, guac_stream* stream) guac_pool_free_int(client->internal->__stream_pool, (freed_index - 1) / 2)

palaashjain avatar May 21 '25 06:05 palaashjain