For armv7 (cross build target): multimedia/libvpx depends on the GNU C library function getauxval and so fails to build; so, disable its <sys/auxv.h> expectation?
Mark Millard
markmi at dsl-only.net
Wed Dec 6 09:45:06 UTC 2017
For armv7 attempting to build multimedia/libvpx
(via an indirect dependency) leads to:
cp libvpx_g.a libvpx.a
vpx_ports/arm_cpudetect.c.o: In function `arm_cpu_caps':
/wrkdirs/usr/ports/multimedia/libvpx/work/libvpx-1.6.1/vpx_ports/arm_cpudetect.c:198: undefined reference to `getauxval'
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [Makefile:384: libvpx.so.4.1.0] Error 1
gmake[1]: *** [Makefile:17: .DEFAULT] Error 2
gmake[1]: Leaving directory '/wrkdirs/usr/ports/multimedia/libvpx/work/libvpx-1.6.1'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1
The arm_cpudetect.c code looks like it expects <sys/auxv.h>
for FreeBSD to define getauxval (but it does not) and
has alternate code it uses if <sys/auxv.h> is not
available:
. . .
#elif defined(__FreeBSD__)
#if __has_include(<sys/auxv.h>)
#include <sys/auxv.h>
#else
#include <sys/param.h>
#include <sys/sysctl.h>
#include <elf.h>
#include <errno.h>
#include <unistd.h>
static unsigned long getauxval(unsigned long type) {
Elf_Auxinfo auxv[AT_COUNT];
size_t len = sizeof(auxv);
int mib[] = {
CTL_KERN,
KERN_PROC,
KERN_PROC_AUXV,
getpid(),
};
if (sysctl(mib, nitems(mib), auxv, &len, NULL, 0) != -1) {
for (size_t i = 0; i < nitems(auxv); i++)
if ((unsigned long)auxv[i].a_type == type)
return auxv[i].a_un.a_val;
errno = ENOENT;
}
return 0;
}
#endif
#ifndef AT_HWCAP
#define AT_HWCAP 25 /* 16 on Linux */
#endif
#ifndef HWCAP_NEON
#define HWCAP_NEON (1 << 12)
#endif
int arm_cpu_caps(void) {
int flags;
int mask;
unsigned long hwcaps;
if (!arm_cpu_env_flags(&flags)) {
return flags;
}
mask = arm_cpu_env_mask();
hwcaps = getauxval(AT_HWCAP);
#if HAVE_NEON || HAVE_NEON_ASM
if (hwcaps & HWCAP_NEON) flags |= HAS_NEON;
#endif
return flags & mask;
}
. . .
<sys/auxv.h> has:
# more /usr/include/sys/auxv.h
. . .
#ifndef _SYS_AUXV_H_
#define _SYS_AUXV_H_
#include <sys/types.h>
#include <machine/elf.h>
__BEGIN_DECLS
int elf_aux_info(int aux, void *buf, int buflen);
__END_DECLS
#endif /* !_SYS_AUXV_H_ */
# grep -r getauxval /usr/src/* | more
/usr/src/contrib/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc: return getauxval(AT_PAGESZ);
/usr/src/contrib/compiler-rt/lib/scudo/scudo_utils.cpp: uptr HWCap = getauxval(AT_HWCAP);
/usr/src/contrib/compiler-rt/lib/dfsan/libc_ubuntu1404_abilist.txt:fun:__getauxval=uninstrumented
/usr/src/contrib/compiler-rt/lib/dfsan/libc_ubuntu1404_abilist.txt:fun:getauxval=uninstrumented
/usr/src/contrib/unbound/compat/getentropy_linux.c: p = (char *) getauxval(AT_RANDOM);
/usr/src/contrib/unbound/compat/getentropy_linux.c: p = (char *) getauxval(AT_SYSINFO_EHDR);
/usr/src/contrib/unbound/compat/getentropy_linux.c: p = (char *) getauxval(AT_BASE);
/usr/src/contrib/unbound/config.h.in:/* Define to 1 if you have the `getauxval' function. */
/usr/src/contrib/unbound/configure.ac: AC_CHECK_FUNCS([getauxval])
/usr/src/contrib/unbound/doc/Changelog: - getauxval test for ppc64 linux compatibility.
/usr/src/contrib/unbound/configure: for ac_func in getauxval
/usr/src/contrib/unbound/configure: ac_fn_c_check_func "$LINENO" "getauxval" "ac_cv_func_getauxval"
/usr/src/contrib/unbound/configure:if test "x$ac_cv_func_getauxval" = xyes; then :
/usr/src/contrib/unbound/config.h:/* Define to 1 if you have the `getauxval' function. */
/usr/src/crypto/openssl/crypto/armcap.c: * Use a weak reference to getauxval() so we can use it if it is available but
/usr/src/crypto/openssl/crypto/armcap.c:extern unsigned long getauxval(unsigned long type) __attribute__ ((weak));
/usr/src/crypto/openssl/crypto/armcap.c:static unsigned long (*getauxval) (unsigned long) = NULL;
/usr/src/crypto/openssl/crypto/armcap.c: if (getauxval != NULL) {
/usr/src/crypto/openssl/crypto/armcap.c: if (getauxval(HWCAP) & HWCAP_NEON) {
/usr/src/crypto/openssl/crypto/armcap.c: unsigned long hwcap = getauxval(HWCAP_CE);
===
Mark Millard
markmi at dsl-only.net
More information about the freebsd-arm
mailing list