--- libreoffice-7.1.8.1/external/redland/UnpackedTarball_raptor.mk.old	2022-03-01 14:16:56.125876607 +0000
+++ libreoffice-7.1.8.1/external/redland/UnpackedTarball_raptor.mk	2022-03-01 14:17:32.716422003 +0000
@@ -21,6 +21,7 @@
 
 $(eval $(call gb_UnpackedTarball_add_patches,raptor,\
 	external/redland/raptor/raptor-freebsd.patch.1 \
+	external/redland/raptor/raptor-illumos.patch \
 	external/redland/raptor/raptor-msvc.patch.1 \
 	$(if $(filter-out WNT,$(OS)),external/redland/raptor/raptor-bundled-soname.patch.1) \
 	$(if $(filter ANDROID,$(OS)),external/redland/raptor/raptor-android.patch.1) \
diff -Naur libreoffice-7.1.8.1/external/redland/raptor.old/raptor-illumos.patch libreoffice-7.1.8.1/external/redland/raptor/raptor-illumos.patch
--- libreoffice-7.1.8.1/external/redland/raptor.old/raptor-illumos.patch	1969-12-31 19:00:00.000000000 +0000
+++ libreoffice-7.1.8.1/external/redland/raptor/raptor-illumos.patch	2022-03-01 14:16:35.011222651 +0000
@@ -0,0 +1,37 @@
+--- src/sort_r.h.orig	2014-10-10 01:00:44.000000000 +0000
++++ src/sort_r.h	2020-10-11 15:42:02.343998167 +0000
+@@ -31,6 +31,8 @@
+ #  define _SORT_R_LINUX
+ #elif (defined _WIN32 || defined _WIN64 || defined __WINDOWS__)
+ #  define _SORT_R_WINDOWS
++#elif (defined __illumos__)
++#  define _SORT_R_ILLUMOS
+ #else
+ #  error Cannot detect operating system
+ #endif
+@@ -85,6 +87,7 @@
+     extern void qsort_r(void *base, size_t nel, size_t width,
+                         __compar_d_fn_t __compar, void *arg)
+       __attribute__((nonnull (1, 4)));
++  #elif defined _SORT_R_ILLUMOS
+ 
+   #endif
+ 
+@@ -105,6 +108,10 @@
+       tmp.compar = compar;
+       qsort_r(base, nel, width, &tmp, sort_r_arg_swap);
+ 
++    #elif defined _SORT_R_ILLUMOS
++
++      qsort_r(base, nel, width, compar, arg);
++
+     #else /* defined _SORT_R_WINDOWS */
+ 
+       struct sort_r_data tmp;
+@@ -120,5 +127,6 @@
+ #undef _SORT_R_WINDOWS
+ #undef _SORT_R_LINUX
+ #undef _SORT_R_BSD
++#undef _SORT_R_ILLUMOS
+ 
+ #endif /* SORT_R_H_ */