Fwd: [PATCH] Fix building on musl-libc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



libdrm git master fails to compile due to undefined functions/constants
on musl libc. The attached patches fix it. (I've attached them rather than
included them in the message since gmail is really bad about ruining patch
formatting.)

I originally posted these to https://bugs.freedesktop.org/show_bug.cgi?id=93764
in a different form, and have modified them to Emil's comments on the
bugzilla entry.

commit 6ec5d220184e46135109923d252ae619068b7eb2
Author: Kylie McClain <somasis@xxxxxxxxxxx>
Date:   Tue Jan 19 22:27:28 2016 -0500

    tests: Include poll.h rather than sys/poll.h

    sys/poll.h is a non-standard location of the poll.h header, and is
    incorrect on non-glibc libcs. poll.h, however, is defined in SUS (v2)
    and is more portable.

    http://pubs.opengroup.org/onlinepubs/007908799/xsh/poll.h.html

commit 6e7f12f1977bd13d10d99bc7826c54b692284c38
Author: Kylie McClain <somasis@xxxxxxxxxxx>
Date:   Tue Jan 19 22:24:15 2016 -0500

    kms-steal-crtc: Make use of sys/select.h if available

    On systems using musl libc, FD_ZERO, FD_SET, select, etc. are defined
    in sys/select.h. This behavior is defined in IEEE Std 1003.1, 2000,
    http://pubs.opengroup.org/onlinepubs/009696899/basedefs/sys/select.h.html
    and fixes building kms-steal-crtc on musl libc systems.
From 6e7f12f1977bd13d10d99bc7826c54b692284c38 Mon Sep 17 00:00:00 2001
From: Kylie McClain <somasis@xxxxxxxxxxx>
Date: Tue, 19 Jan 2016 22:24:15 -0500
Subject: [PATCH 1/2] kms-steal-crtc: Make use of sys/select.h if available

On systems using musl libc, FD_ZERO, FD_SET, select, etc. are defined
in sys/select.h. This behavior is defined in IEEE Std 1003.1, 2000,
http://pubs.opengroup.org/onlinepubs/009696899/basedefs/sys/select.h.html
and fixes building kms-steal-crtc on musl libc systems.
---
 configure.ac               | 2 +-
 tests/kms/kms-steal-crtc.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 057a846..40b6f88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,7 +53,7 @@ AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
 AC_FUNC_ALLOCA
 
-AC_CHECK_HEADERS([sys/mkdev.h sys/sysctl.h])
+AC_CHECK_HEADERS([sys/mkdev.h sys/select.h sys/sysctl.h])
 
 # Initialize libtool
 LT_PREREQ([2.2])
diff --git a/tests/kms/kms-steal-crtc.c b/tests/kms/kms-steal-crtc.c
index 2f7f327..e555e16 100644
--- a/tests/kms/kms-steal-crtc.c
+++ b/tests/kms/kms-steal-crtc.c
@@ -29,6 +29,9 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <stdio.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
 #include <string.h>
 #include <unistd.h>
 
-- 
2.7.0

From 6ec5d220184e46135109923d252ae619068b7eb2 Mon Sep 17 00:00:00 2001
From: Kylie McClain <somasis@xxxxxxxxxxx>
Date: Tue, 19 Jan 2016 22:27:28 -0500
Subject: [PATCH 2/2] tests: Include poll.h rather than sys/poll.h

sys/poll.h is a non-standard location of the poll.h header, and is
incorrect on non-glibc libcs. poll.h, however, is defined in SUS (v2)
and is more portable.

http://pubs.opengroup.org/onlinepubs/007908799/xsh/poll.h.html
---
 tests/modetest/modetest.c | 2 +-
 tests/vbltest/vbltest.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 22e3e81..375b64a 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -53,7 +53,7 @@
 #include <string.h>
 #include <strings.h>
 #include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/time.h>
 
 #include "xf86drm.h"
diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c
index 1833321..a4c8247 100644
--- a/tests/vbltest/vbltest.c
+++ b/tests/vbltest/vbltest.c
@@ -35,7 +35,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/time.h>
 
 #include "xf86drm.h"
-- 
2.7.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux