diff mbox series

[FFmpeg-devel,1/1] libavutil: Fix uClibc build for mips

Message ID 20210411175208.1458204-1-bernd.kuhls@t-online.de
State New
Headers show
Series [FFmpeg-devel,1/1] libavutil: Fix uClibc build for mips
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Bernd Kuhls April 11, 2021, 5:52 p.m. UTC
uClibc does not provide sys/auxv.h:

libavutil/mips/cpu.c:26:10: fatal error: sys/auxv.h: No such file or directory

and not getauxval:

libavutil/mips/cpu.c: In function ‘cpucfg_available’:
libavutil/mips/cpu.c:37:12: error: implicit declaration of function ‘getauxval’ [-Werror=implicit-function-declaration]
     return getauxval(AT_HWCAP) & HWCAP_LOONGSON_CPUCFG;
            ^~~~~~~~~
libavutil/mips/cpu.c:37:22: error: ‘AT_HWCAP’ undeclared (first use in this function)
     return getauxval(AT_HWCAP) & HWCAP_LOONGSON_CPUCFG;

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 libavutil/mips/cpu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Carl Eugen Hoyos April 11, 2021, 6:40 p.m. UTC | #1
Am So., 11. Apr. 2021 um 19:53 Uhr schrieb Bernd Kuhls
<bernd.kuhls@t-online.de>:
>
> uClibc does not provide sys/auxv.h:

Unfortunately, this is also true for older glibc versions,
see ticket #9138.

A check in configure is necessary instead.

Carl Eugen
diff mbox series

Patch

diff --git a/libavutil/mips/cpu.c b/libavutil/mips/cpu.c
index 59619d54de..c5da77b22b 100644
--- a/libavutil/mips/cpu.c
+++ b/libavutil/mips/cpu.c
@@ -19,7 +19,8 @@ 
 #include "libavutil/cpu.h"
 #include "libavutil/cpu_internal.h"
 #include "config.h"
-#if defined __linux__ || defined __ANDROID__
+#include <features.h>
+#if (defined __linux__ || defined __ANDROID__) && !defined(__UCLIBC__)
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
@@ -28,7 +29,7 @@ 
 #include "libavutil/avstring.h"
 #endif
 
-#if defined __linux__ || defined __ANDROID__
+#if (defined __linux__ || defined __ANDROID__) && !defined(__UCLIBC__)
 
 #define HWCAP_LOONGSON_CPUCFG (1 << 14)
 
@@ -105,7 +106,7 @@  static int cpu_flags_cpuinfo(void)
 
 int ff_get_cpu_flags_mips(void)
 {
-#if defined __linux__ || defined __ANDROID__
+#if (defined __linux__ || defined __ANDROID__) && !defined(__UCLIBC__)
     if (cpucfg_available())
         return cpu_flags_cpucfg();
     else