haikuports / haikuports

Software ports for the Haiku operating system.
MIT License
386 stars 301 forks source link

cairo: build failed #10860

Open X547 opened 3 weeks ago

X547 commented 3 weeks ago

Version: cairo1.18-1.18.0-1

Build log:

FAILED: perf/cairo-perf-micro.p/cairo-perf-micro.c.o 
cc -Iperf/cairo-perf-micro.p -Iperf -I../perf -I. -I.. -Isrc -I../src -Iboilerplate -I../boilerplate -Iutil/cairo-missing -I../util/cairo-missing -I/packages/fontconfig-2.13.96-2/.self/develop/headers -I/packages/libxml2-2.12.5-1/.self/develop/headers/libxml2 -I/packages/freetype-2.13.2-1/.self/develop/headers/freetype2 -I/packages/libpng16-1.6.40-1/.self/develop/headers -I/packages/zlib-1.3-3/.self/develop/headers -I/packages/harfbuzz-8.3.0-2/.self/develop/headers/harfbuzz -I/packages/graphite2-1.3.14-2/.self/develop/headers -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -Wmissing-declarations -Wpointer-arith -Wwrite-strings -Wsign-compare -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wvolatile-register-var -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations -Wno-missing-field-initializers -Wno-unused-parameter -Wno-attributes -Wno-long-long -Winline -Wno-unused-but-set-variable -Wno-enum-conversion -fno-strict-aliasing -fno-common -Wp,-D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -MD -MQ perf/cairo-perf-micro.p/cairo-perf-micro.c.o -MF perf/cairo-perf-micro.p/cairo-perf-micro.c.o.d -o perf/cairo-perf-micro.p/cairo-perf-micro.c.o -c ../perf/cairo-perf-micro.c
../perf/cairo-perf-micro.c: In function 'check_cpu_affinity':
../perf/cairo-perf-micro.c:418:5: error: unknown type name 'cpu_set_t'; did you mean 'cpuset_t'?
  418 |     cpu_set_t affinity;
      |     ^~~~~~~~~
      |     cpuset_t
../perf/cairo-perf-micro.c:421:48: warning: passing argument 3 of 'sched_getaffinity' from incompatible pointer type [-Wincompatible-pointer-types]
  421 |     if (sched_getaffinity(0, sizeof(affinity), &affinity)) {
      |                                                ^~~~~~~~~
      |                                                |
      |                                                int *
In file included from ../perf/cairo-perf-micro.c:46:
/boot/system/develop/headers/gnu/sched.h:56:69: note: expected 'cpuset_t *' {aka 'struct _cpuset *'} but argument is of type 'int *'
   56 | extern int sched_getaffinity(pid_t id, size_t cpusetsize, cpuset_t* mask);
      |                                                           ~~~~~~~~~~^~~~
../perf/cairo-perf-micro.c:427:13: warning: implicit declaration of function 'CPU_ISSET'; did you mean 'FD_ISSET'? [-Wimplicit-function-declaration]
  427 |         if (CPU_ISSET(i, &affinity))
      |             ^~~~~~~~~
      |             FD_ISSET
X547 commented 3 weeks ago

Draft patch:

diff --git a/perf/cairo-perf-micro.c b/perf/cairo-perf-micro.c
index 618272e..ddd0fb4 100644
--- a/perf/cairo-perf-micro.c
+++ b/perf/cairo-perf-micro.c
@@ -46,6 +46,11 @@
 #include <sched.h>
 #endif

+#ifdef __HAIKU__
+typedef cpuset_t cpu_set_t;
+#define CPU_ISSET CPUSET_ISSET
+#endif
+
 #define CAIRO_PERF_ITERATIONS_DEFAULT          100
 #define CAIRO_PERF_LOW_STD_DEV                 0.03
 #define CAIRO_PERF_STABLE_STD_DEV_COUNT                5
waddlesplash commented 3 weeks ago

CC @korli.

korli commented 3 weeks ago

I think we follow the naming of FreeBSD, and FreeBSD also needs patching for Cairo in this case.

X547 commented 3 weeks ago

I think we follow the naming of FreeBSD, and FreeBSD also needs patching for Cairo in this case.

But then why sched.h header is inside "gnu" directory?

Begasus commented 3 weeks ago

Just did a "quick" check, regular cairo1.18.0 builds fine, the xcairo variant fails with the above error also on 64bit.

korli commented 3 weeks ago

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259787 for more information