From owner-freebsd-arm@freebsd.org Wed Dec 6 09:45:06 2017 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93A29E9AB9A for ; Wed, 6 Dec 2017 09:45:06 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-95.reflexion.net [208.70.210.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 524AC6ABE9 for ; Wed, 6 Dec 2017 09:45:05 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 23736 invoked from network); 6 Dec 2017 09:45:04 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 6 Dec 2017 09:45:04 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v8.40.3) with SMTP; Wed, 06 Dec 2017 04:45:04 -0500 (EST) Received: (qmail 24470 invoked from network); 6 Dec 2017 09:45:04 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 6 Dec 2017 09:45:04 -0000 Received: from [192.168.1.25] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 3677BEC8675; Wed, 6 Dec 2017 01:45:03 -0800 (PST) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: For armv7 (cross build target): multimedia/libvpx depends on the GNU C library function getauxval and so fails to build; so, disable its expectation? Message-Id: Date: Wed, 6 Dec 2017 01:45:02 -0800 To: Freebsd-arm , FreeBSD Ports X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Dec 2017 09:45:06 -0000 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 for FreeBSD to define getauxval (but it does not) and has alternate code it uses if is not available: . . . #elif defined(__FreeBSD__) =20 #if __has_include() #include #else #include #include #include #include #include =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; } . . . has: # more /usr/include/sys/auxv.h=20 . . . #ifndef _SYS_AUXV_H_ #define _SYS_AUXV_H_ #include #include __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