https://bugs.documentfoundation.org/show_bug.cgi?id=162769

            Bug ID: 162769
           Summary: incompatible function pointer types when
                    cross-compiling for Android 64bit on Xubuntu 22.04
           Product: LibreOffice
           Version: 25.2.0.0 alpha0+
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: [email protected]
          Reporter: [email protected]

Description:
When cross-compiling for Android 64bit on Xubuntu 22.04, the following errors
under core/workdir/UnpackedTarball/nss/nspr are signaled by gcc 12.3.0:
../../../../../pr/src/md/unix/unix.c:2742:27: error: incompatible function
pointer types assigning to '_MD_Fstat64' (aka 'int (*)(int, struct stat64 *)')
from 'int (int, struct stat * _Nonnull)'
[-Wincompatible-function-pointer-types]
 2742 |     _md_iovector._fstat64 = fstat;
      |                           ^ ~~~~~
../../../../../pr/src/md/unix/unix.c:2743:26: error: incompatible function
pointer types assigning to '_MD_Stat64' (aka 'int (*)(const char *, struct
stat64 *)') from 'int (const char * _Nonnull, struct stat * _Nonnull)'
[-Wincompatible-function-pointer-types]
 2743 |     _md_iovector._stat64 = stat;
      |                          ^ ~~~~


Steps to Reproduce:
1. fill out core/autogen.input with
# 64bit Android
--with-distro=LibreOfficeAndroidAarch64
--with-android-sdk=/usr/local/android-studio/Android/Sdk
--with-android-ndk=/usr/local/android-studio/Android/Sdk/ndk/27.0.12077973
2. cd core; ./autogen.sh
3. make 

Actual Results:
[...]
../../../../../pr/src/md/unix/unix.c:2742:27: error: incompatible function
pointer types assigning to '_MD_Fstat64' (aka 'int (*)(int, struct stat64 *)')
from 'int (int, struct stat * _Nonnull)'
[-Wincompatible-function-pointer-types]
 2742 |     _md_iovector._fstat64 = fstat;
      |                           ^ ~~~~~
../../../../../pr/src/md/unix/unix.c:2743:26: error: incompatible function
pointer types assigning to '_MD_Stat64' (aka 'int (*)(const char *, struct
stat64 *)') from 'int (const char * _Nonnull, struct stat * _Nonnull)'
[-Wincompatible-function-pointer-types]
 2743 |     _md_iovector._stat64 = stat;
      |                          ^ ~~~~
../../../../../pr/src/md/unix/unix.c:3288:61: warning: passing 'int *' to
parameter of type 'socklen_t * _Nonnull' (aka 'unsigned int *') converts
between pointers to integer types with different sign [-Wpointer-sign]
 3288 |     if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char*)&err, &optlen) ==
-1) {
      |                                                             ^~~~~~~
/home/temery/Android/Sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/socket.h:292:111:
note: passing argument to parameter '__value_length' here
  292 | __socketcall int getsockopt(int __fd, int __level, int __option, void*
_Nullable __value, socklen_t* _Nonnull __value_length);
      |                                                                        
                                      ^
1 warning and 2 errors generated.
make[8]: *** [../../../../../config/rules.mk:450 : unix.o] Erreur 1
make[7]: *** [../../../../config/rules.mk:163 : export] Erreur 2
make[6]: *** [../../../config/rules.mk:163 : export] Erreur 2
make[5]: *** [../../config/rules.mk:163 : export] Erreur 2
make[4]: *** [../config/rules.mk:163 : export] Erreur 2
make[3]: *** [Makefile:147 : build_nspr] Erreur 2
make[2]: *** [Makefile:53 : nss_build_all] Erreur 2
make[1]: ***
[/usr/local/libreoffice/core/external/nss/ExternalProject_nss.mk:57 :
/usr/local/libreoffice/core/workdir/ExternalProject/nss/build] Erreur 1
make[1]: *** Attente des tâches non terminées....
make: *** [Makefile:296 : build] Erreur 2


Expected Results:
BUILD SUCCESSFUL


Reproducible: Always


User Profile Reset: No

Additional Info:
The following patch solves these 2 errors in this cross-compilation case:
--- core/workdir/UnpackedTarball/nss/nspr/pr/src/md/unix/unix.c~       
2022-09-12 13:40:15.000000000 +0200
+++ core/workdir/UnpackedTarball/nss/nspr/pr/src/md/unix/unix.c 2024-09-03
14:59:10.821939289 +0200
@@ -2739,8 +2739,8 @@
 #elif defined(_PR_NO_LARGE_FILES)
     _md_iovector._open64 = open;
     _md_iovector._mmap64 = _MD_Unix_mmap64;
-    _md_iovector._fstat64 = fstat;
-    _md_iovector._stat64 = stat;
+    _md_iovector._fstat64 = (_MD_Fstat64)fstat;
+    _md_iovector._stat64 = (_MD_Stat64)stat;
     _md_iovector._lseek64 = _MD_Unix_lseek64;
 #elif defined(_PR_HAVE_OFF64_T)
 #if (defined(ANDROID) && __ANDROID_API__ < 21)

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to