On 06/08/2025 22.45, Stefan Weil via wrote:
brlapi__openConnection returns a brlapi_fileDescriptor which is a pointer
for Windows builds.

The test for brlapi fails with cross builds on Debian trixie
(x86_64-w64-mingw32-gcc (GCC) 14-win32):

testfile.c:4:30: error: returning 'brlapi_fileDescriptor' {aka 'void *'} from a 
function with return type 'int' makes integer from pointer without a cast 
[-Wint-conversion]
     4 |      int main(void) { return brlapi__openConnection (NULL, NULL, 
NULL); }
       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------
../../../meson.build:1607: WARNING: could not link brlapi, disabling

Signed-off-by: Stefan Weil <s...@weilnetz.de>
---

I think that this patch is trivial because it does not change
anything for Linux.

Note that this patch only fixes the configure test and allows builds
with the Braille API for Windows.

A similar change can be applied to chardev/baum.c and will be sent
separately because it is not required for 10.1.

Note that for 64 bit Windows there is an issue because brlapi_fileDescriptor
is a 64 bit pointer while QEMU assumes int for file descriptors. But the
good news is that the resulting code seems to work nevertheless – at least
the people who asked me for Braille support on Windows are satisfied as
far as I know.

Regards,
Stefan W.


  meson.build | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index e53cd5b413..d6abe1917e 100644
--- a/meson.build
+++ b/meson.build
@@ -1586,9 +1586,11 @@ if not get_option('brlapi').auto() or have_system
    brlapi = cc.find_library('brlapi', has_headers: ['brlapi.h'],
                           required: get_option('brlapi'))
    if brlapi.found() and not cc.links('''
-     #include <brlapi.h>
-     #include <stddef.h>
-     int main(void) { return brlapi__openConnection (NULL, NULL, NULL); }''', 
dependencies: brlapi)
+    #include <brlapi.h>
+    #include <stddef.h>
+    int main(void) {
+      return brlapi__openConnection(NULL, NULL, NULL) == 
BRLAPI_INVALID_FILE_DESCRIPTOR;
+    }''', dependencies: brlapi)
      brlapi = not_found
      if get_option('brlapi').enabled()
        error('could not link brlapi')

Reviewed-by: Thomas Huth <th...@redhat.com>


Reply via email to