Bug 228586 - fix multimedia/libvpx on powerpc64
Summary: fix multimedia/libvpx on powerpc64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Jan Beich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-29 11:34 UTC by Mark Linimon
Modified: 2018-06-13 13:28 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (jbeich)


Attachments
patch to multimedia/libvpx Makefile (396 bytes, patch)
2018-05-29 11:34 UTC, Mark Linimon
no flags Details | Diff
Patch to fix building libvpx for powerpc64 (2.01 KB, patch)
2018-05-29 13:00 UTC, Justin Hibbits
no flags Details | Diff
Patch to fix libvpx on ppc64 (1.84 KB, patch)
2018-05-29 13:03 UTC, Justin Hibbits
no flags Details | Diff
detect VSX on FreeBSD (227.64 KB, patch)
2018-06-11 18:53 UTC, Jan Beich
no flags Details | Diff
detect VSX on FreeBSD (3.12 KB, patch)
2018-06-11 18:55 UTC, Jan Beich
no flags Details | Diff
standalone VSX check (309 bytes, text/plain)
2018-06-11 18:57 UTC, Jan Beich
no flags Details
detect VSX on FreeBSD (3.70 KB, patch)
2018-06-11 19:02 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Linimon freebsd_committer 2018-05-29 11:34:35 UTC
Created attachment 193810 [details]
patch to multimedia/libvpx Makefile

The file ppc_cpudetect.c is Linux-specific and I don't have the cycles to learn how to unbreak it.  Let's just mark it broken for now.
Comment 1 Justin Hibbits freebsd_committer 2018-05-29 13:00:03 UTC
Created attachment 193813 [details]
Patch to fix building libvpx for powerpc64

I use this patch successfully locally to build libvpx for powerpc64.
Comment 2 Justin Hibbits freebsd_committer 2018-05-29 13:03:10 UTC
Created attachment 193814 [details]
Patch to fix libvpx on ppc64

Fixed diff to be relative to ports root, rather than absolute on my host filesystem.
Comment 3 Mark Linimon freebsd_committer 2018-05-29 13:42:30 UTC
(In reply to Justin Hibbits from comment #2)

I'll give it a shot here.

Not that anyone will be using libvpx on the other non-gcc ARCHs, but I'm going to test with the following pattern anyway, so as to suggest a better usage for porters:

.if ${ARCH:Mmips*} || ${ARCH:Mpowerpc*} || ${ARCH:Msparc64}
Comment 4 Mark Linimon freebsd_committer 2018-06-11 04:00:01 UTC
(In reply to Mark Linimon from comment #3)

What I now get on 11.1R with this change is:

vpx_ports/ppc_cpudetect.c:60:21: error: 'AT_HWCAP' undeclared (first use in this function)

jhibbits claims that this is a missing MFC to -11.  I don't have a convenient -CURRENT ppc setup available to test.

jbeich, what do you think?  Would you need to see an amd64 build log so that we can commit?
Comment 5 Jan Beich freebsd_committer 2018-06-11 18:53:58 UTC
Created attachment 194172 [details]
detect VSX on FreeBSD

Can you try my version?

(In reply to Mark Linimon from comment #4)
> vpx_ports/ppc_cpudetect.c:60:21: error: 'AT_HWCAP' undeclared (first use in this function)

- AT_HWCAP is nop on FreeBSD everywhere but armv6/armv7
- AT_HWCAP expands to 25 on FreeBSD and 16 on Linux
- powerpc* uses hw.cpu_features instead
- /proc/self/auxv is only supported on i386/amd64 by linprocfs(5)

(In reply to Justin Hibbits from comment #2)
> +OPTIONS_EXCLUDE_powerpcspe=RTCPU

Are you sure about disabling VSX optimizations completely? libvpx uses compiler intrinsics (i.e., traslated by compiler to proper opcodes), not inline asm.

From vpx_ports/ppc_cpudetect.c:
  // If there is no RTCD the function pointers are not used and can not be
  // changed.
  int ppc_simd_caps(void) { return 0; }

> +.if ${ARCH:Mpowerpc*}
> +USE_GCC=	yes
> +.endif

Is this about old vs. new libstdc++ required by consumers? If so reverting ports r451562 would be better.
Comment 6 Jan Beich freebsd_committer 2018-06-11 18:55:29 UTC
Created attachment 194174 [details]
detect VSX on FreeBSD

Sorry, previous version had unrelated changes.
Comment 7 Jan Beich freebsd_committer 2018-06-11 18:57:22 UTC
Created attachment 194175 [details]
standalone VSX check
Comment 8 Jan Beich freebsd_committer 2018-06-11 19:02:15 UTC
Created attachment 194176 [details]
detect VSX on FreeBSD
Comment 9 Justin Hibbits freebsd_committer 2018-06-13 03:59:33 UTC
(In reply to Jan Beich from comment #8)

Your patch builds fine for me on powerpc64.

The change I had for powerpcspe was needed for building, as powerpcspe doesn't support altivec, and -mspe and -maltivec are mutually exclusive.
Comment 10 commit-hook freebsd_committer 2018-06-13 12:33:28 UTC
A commit references this bug:

Author: jbeich
Date: Wed Jun 13 12:33:01 UTC 2018
New revision: 472311
URL: https://svnweb.freebsd.org/changeset/ports/472311

Log:
  multimedia/libvpx: unbreak on powerpc*

  - newer libstdc++ ABI is required by many consumers
  - -mspe and -maltivec are mutually exclusive
  - implement VSX detection for powerpc and powerpc64

  PR:		228586
  Submitted by:	jhibbits (based on)

Changes:
  head/multimedia/libvpx/Makefile
  head/multimedia/libvpx/files/patch-libs.mk
  head/multimedia/libvpx/files/patch-vpx__ports_ppc__cpudetect.c
Comment 11 commit-hook freebsd_committer 2018-06-13 13:28:31 UTC
A commit references this bug:

Author: jbeich
Date: Wed Jun 13 13:27:54 UTC 2018
New revision: 472322
URL: https://svnweb.freebsd.org/changeset/ports/472322

Log:
  MFH: r472311

  multimedia/libvpx: unbreak on powerpc*

  - newer libstdc++ ABI is required by many consumers
  - -mspe and -maltivec are mutually exclusive
  - implement VSX detection for powerpc and powerpc64

  PR:		228586
  Submitted by:	jhibbits (based on)
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2018Q2/
  branches/2018Q2/multimedia/libvpx/Makefile
  branches/2018Q2/multimedia/libvpx/files/patch-libs.mk
  branches/2018Q2/multimedia/libvpx/files/patch-vpx__ports_ppc__cpudetect.c