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

Bernd Kuhls bernd.kuhls at t-online.de
Sun Apr 11 20:52:08 EEST 2021


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 at t-online.de>
---
 libavutil/mips/cpu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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
-- 
2.29.2



More information about the ffmpeg-devel mailing list