Date: Wed, 6 Dec 2017 01:45:02 -0800 From: Mark Millard <markmi@dsl-only.net> To: Freebsd-arm <freebsd-arm@freebsd.org>, FreeBSD Ports <freebsd-ports@freebsd.org> Subject: 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? Message-ID: <AE704C6E-E686-4EBC-8BB1-A041F2DC647C@dsl-only.net>
next in thread | raw e-mail | index | archive | help
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_cpude= tect.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' =3D=3D=3D> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=3Dyes 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__) =20 #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> =20 static unsigned long getauxval(unsigned long type) { Elf_Auxinfo auxv[AT_COUNT]; size_t len =3D sizeof(auxv); int mib[] =3D { CTL_KERN, KERN_PROC, KERN_PROC_AUXV, getpid(), }; if (sysctl(mib, nitems(mib), auxv, &len, NULL, 0) !=3D -1) { for (size_t i =3D 0; i < nitems(auxv); i++) if ((unsigned long)auxv[i].a_type =3D=3D type) return auxv[i].a_un.a_val; errno =3D ENOENT; } return 0; } #endif #ifndef AT_HWCAP #define AT_HWCAP 25 /* 16 on Linux */ #endif =20 #ifndef HWCAP_NEON #define HWCAP_NEON (1 << 12) #endif =20 int arm_cpu_caps(void) { int flags; int mask; unsigned long hwcaps; if (!arm_cpu_env_flags(&flags)) { return flags; } mask =3D arm_cpu_env_mask(); hwcaps =3D getauxval(AT_HWCAP); #if HAVE_NEON || HAVE_NEON_ASM if (hwcaps & HWCAP_NEON) flags |=3D HAS_NEON; #endif return flags & mask; } . . . <sys/auxv.h> has: # more /usr/include/sys/auxv.h=20 . . . #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 =3D = getauxval(AT_HWCAP); = /usr/src/contrib/compiler-rt/lib/dfsan/libc_ubuntu1404_abilist.txt:fun:__g= etauxval=3Duninstrumented = /usr/src/contrib/compiler-rt/lib/dfsan/libc_ubuntu1404_abilist.txt:fun:get= auxval=3Duninstrumented /usr/src/contrib/unbound/compat/getentropy_linux.c: p =3D = (char *) getauxval(AT_RANDOM); /usr/src/contrib/unbound/compat/getentropy_linux.c: p =3D = (char *) getauxval(AT_SYSINFO_EHDR); /usr/src/contrib/unbound/compat/getentropy_linux.c: p =3D = (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" =3D = 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) =3D NULL; /usr/src/crypto/openssl/crypto/armcap.c: if (getauxval !=3D NULL) { /usr/src/crypto/openssl/crypto/armcap.c: if (getauxval(HWCAP) & = HWCAP_NEON) { /usr/src/crypto/openssl/crypto/armcap.c: unsigned long hwcap = =3D getauxval(HWCAP_CE); =3D=3D=3D Mark Millard markmi at dsl-only.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AE704C6E-E686-4EBC-8BB1-A041F2DC647C>