Skip to contentSkip to conversation

meson: Fix brlapi compile test for Windows builds

PATCH In review Stefan Weil via 3 participants 3 messages Aug 6, 2025 – Aug 18, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: Fix brlapi compile test for Windows builds

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

---

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(-)
meson.build +5 -3
index e53cd5b413..d6abe1917e 100644
@@ -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')
Signature · 1 line
2.47.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 46 lines · Stefan Weil via

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

---

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(-)
meson.build +0 -1
index e53cd5b413..d6abe1917e 100644
@@ -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>

meson.build if not get_option('brlapi').auto() or have_system · line 1596

Quoted 10 lines
meson.build +5 -2
-     #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')

Looks good,

Reviewed-by on v1 1/1
#2 lore raw
In reply to Stefan Weil via
Quoted 46 lines · Stefan Weil via

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

---

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(-)
meson.build +0 -1
index e53cd5b413..d6abe1917e 100644
@@ -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>

meson.build if not get_option('brlapi').auto() or have_system · line 1596

Quoted 10 lines
meson.build +5 -2
-     #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')