Bug 201273 - multimedia/openh264 fails to build on armv6
Summary: multimedia/openh264 fails to build on armv6
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Only Me
Assignee: freebsd-gecko (Nobody)
URL: http://chips.ysv.freebsd.org/data/11a...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-02 12:19 UTC by Mikael Urankar
Modified: 2015-11-03 20:21 UTC (History)
1 user (show)

See Also:
jbeich: maintainer-feedback+


Attachments
armv6 fix (810 bytes, patch)
2015-07-02 12:19 UTC, Mikael Urankar
no flags Details | Diff
armv6 fix (484 bytes, patch)
2015-08-16 19:02 UTC, Mikael Urankar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Urankar freebsd_committer freebsd_triage 2015-07-02 12:19:07 UTC
Created attachment 158258 [details]
armv6 fix

Hi,

This port utilize GAS assembly and clang fails to build some assembler files.

/nxb-bin/usr/bin/cc -O2 -pipe -mfloat-abi=softfp  -I/usr/local/include/gmp-api -fno-strict-aliasing  -DHAVE_NEON -fPIC -DGENERATED_VERSION_HEADER -I./codec/common/arm/ -I./codec/api/svc -I./codec/common/inc   -c -o codec/common/arm/copy_mb_neon.o codec/common/arm/copy_mb_neon.S
<instantiation>:5:1: error: unknown directive
.func WelsCopy8x8_neon

We don't have support for neon (as of today)

The attached patch fixes the build on arm.
build log with TEST option enabled (tests were done on real hw):
http://mikael.urankar.free.fr/FreeBSD/arm/build_logs/openh264-1.4.0_2.log

Thanks
Comment 1 Jan Beich freebsd_committer freebsd_triage 2015-08-11 16:07:06 UTC
Comment on attachment 158258 [details]
armv6 fix

>--- Makefile	(revision 390884)
>+++ Makefile	(working copy)
>@@ -44,8 +44,12 @@
> 
> .include <bsd.port.options.mk>
> 
>+.if ${ARCH} == "armv6"
>+CFLAGS+= -no-integrated-as

What is this for? All *.S files are conditionalized by HAVE_NEON.
Not to mention the flag is Clang-specific, so would break GCC build.

>+.endif
>+
> .if ! ${PORT_OPTIONS:MDEBUG}
>-. if ${ARCH} == amd64 || ${ARCH} == arm || ${ARCH} == i386
>+. if ${ARCH} == amd64 || ${ARCH} == arm || ${ARCH} == armv6 || ${ARCH} == i386

My fault. nasm is only used on x86. arm and arm64 use cc(1).
I'll remove arm from there to avoid confusion.

> BUILD_DEPENDS+=	nasm:${PORTSDIR}/devel/nasm
> . endif
> .endif
>
>--- files/patch-build_arch.mk	(revision 0)
>+++ files/patch-build_arch.mk	(working copy)
>@@ -0,0 +1,10 @@
>+--- build/arch.mk.orig	2015-07-01 17:00:32 UTC
>++++ build/arch.mk
>+@@ -5,7 +5,6 @@ ifneq ($(filter-out arm64, $(filter arm%
>+ ifeq ($(USE_ASM), Yes)
>+ ASM_ARCH = arm
>+ ASMFLAGS += -I$(SRC_PATH)codec/common/arm/
>+-CFLAGS += -DHAVE_NEON

Does FreeBSD not support NEON at all or only on armv6? If the latter
try replacing

  ifneq ($(filter-out arm64, $(filter arm%, $(ARCH))),)

with

  ifneq ($(filter-out armv6 arm64, $(filter arm%, $(ARCH))),)
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-08-11 16:12:40 UTC
A commit references this bug:

Author: jbeich
Date: Tue Aug 11 16:12:02 UTC 2015
New revision: 393947
URL: https://svnweb.freebsd.org/changeset/ports/393947

Log:
  multimedia/openh264: arm* don't need nasm to build *.S files

  PR:		201273

Changes:
  head/multimedia/openh264/Makefile
Comment 3 Mikael Urankar freebsd_committer freebsd_triage 2015-08-16 19:02:39 UTC
Created attachment 159932 [details]
armv6 fix

no-integrated-as was needed because of my crappy patch.

As far as I know FreeBSD doesn't support neon on armv6 and arm64.

I've updated the patch based on your comment, it compiles and runs fine.

Thanks for the review.
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-08-16 22:16:44 UTC
A commit references this bug:

Author: jbeich
Date: Sun Aug 16 22:16:19 UTC 2015
New revision: 394430
URL: https://svnweb.freebsd.org/changeset/ports/394430

Log:
  multimedia/openh264: unbreak build on armv6

  Disable NEON support for armv6 (softfp). Alas, MACHINE_CPU is
  underspecified on arm* to conditionalize NEON check within a port.

  PR:		201273
  Reported by:	pkg-fallout
  Submitted by:	mikael.urankar@gmail.com
  MFH:		2015Q3

Changes:
  head/multimedia/openh264/files/patch-build_arch.mk
Comment 5 Jan Beich freebsd_committer freebsd_triage 2015-08-16 22:19:05 UTC
Thanks. Committed.
Comment 6 commit-hook freebsd_committer freebsd_triage 2015-08-17 03:37:05 UTC
A commit references this bug:

Author: jbeich
Date: Mon Aug 17 03:36:53 UTC 2015
New revision: 394435
URL: https://svnweb.freebsd.org/changeset/ports/394435

Log:
  MFH: r394430

  multimedia/openh264: unbreak build on armv6

  Disable NEON support for armv6 (softfp). Alas, MACHINE_CPU is
  underspecified on arm* to conditionalize NEON check within a port.

  PR:		201273
  Reported by:	pkg-fallout
  Submitted by:	mikael.urankar@gmail.com
  Approved by:	ports-secteam (delphij)

Changes:
_U  branches/2015Q3/
  branches/2015Q3/multimedia/openh264/files/patch-build_arch.mk
Comment 7 commit-hook freebsd_committer freebsd_triage 2015-10-31 14:24:50 UTC
A commit references this bug:

Author: jbeich
Date: Sat Oct 31 14:24:16 UTC 2015
New revision: 400578
URL: https://svnweb.freebsd.org/changeset/ports/400578

Log:
  multimedia/openh264: unbreak build on aarch64

  /nxb-bin/usr/bin/cc -O2 -pipe  -I/usr/local/include/gmp-api -fno-strict-aliasing  -DHAVE_NEON_AARCH64 -fPIC -DGENERATED_VERSION_HEADER -I./codec/common/arm64/ -I./codec/api/svc -I./codec/common/inc   -c -o codec/common/arm64/copy_mb_aarch64_neon.o codec/common/arm64/copy_mb_aarch64_neon.S
  <instantiation>:4:1: error: unknown directive
  .func WelsCopy8x8_AArch64_neon
  ^
  codec/common/arm64/copy_mb_aarch64_neon.S:186:1: note: while in macro instantiation
  WELS_ASM_AARCH64_FUNC_BEGIN WelsCopy8x8_AArch64_neon
  ^
  <instantiation>:2:1: error: unknown directive
  .endfunc
  ^
  codec/common/arm64/copy_mb_aarch64_neon.S:196:1: note: while in macro instantiation
  WELS_ASM_AARCH64_FUNC_END
  ^
  [...]

  Backout r394430 as armv6 can do NEON but not runtime detection on
  FreeBSD while armv8 always has NEON. So, use devel/binutils and detect
  NEON via compiler defines e.g.,

    # To enable NEON on armv6 put the following into make.conf
    CFLAGS+=	-march=armv7-a

  PR:		201273 (ping)
  MFH:		2015Q4

Changes:
  head/multimedia/openh264/Makefile
  head/multimedia/openh264/files/patch-build_arch.mk
  head/multimedia/openh264/files/patch-codec_common_src_cpu.cpp
Comment 8 commit-hook freebsd_committer freebsd_triage 2015-11-03 13:01:51 UTC
A commit references this bug:

Author: jbeich
Date: Tue Nov  3 13:01:21 UTC 2015
New revision: 400697
URL: https://svnweb.freebsd.org/changeset/ports/400697

Log:
  multimedia/openh264: oops, drop unused devel/binutils

  USE_BINUTILS isn't magically enabled for non-autotools ports.
  One of the following had to be provided

    CFLAGS+=	-B${LOCALBASE}/bin
    MAKE_ENV+=	COMPILER_PATH=${LOCALBASE}/bin

  However, binutils 2.17 in base is enough for NEON with armv6 while
  aarch64 requires recent binutils for everything, not just this port.

  PR:		201273 (ping)
  Reported by:	Mika?l Urankar (via private mail)
  MFH:		2015Q4
  X-MFH-With:	r400578

Changes:
  head/multimedia/openh264/Makefile
Comment 9 commit-hook freebsd_committer freebsd_triage 2015-11-03 20:21:27 UTC
A commit references this bug:

Author: jbeich
Date: Tue Nov  3 20:21:02 UTC 2015
New revision: 400714
URL: https://svnweb.freebsd.org/changeset/ports/400714

Log:
  MFH: r400578 (slightly reworded), r400697

  multimedia/openh264: unbreak build on aarch64

  /nxb-bin/usr/bin/cc -O2 -pipe  -I/usr/local/include/gmp-api -fno-strict-aliasing  -DHAVE_NEON_AARCH64 -fPIC -DGENERATED_VERSION_HEADER -I./codec/common/arm64/ -I./codec/api/svc -I./codec/common/inc   -c -o codec/common/arm64/copy_mb_aarch64_neon.o codec/common/arm64/copy_mb_aarch64_neon.S
  <instantiation>:4:1: error: unknown directive
  .func WelsCopy8x8_AArch64_neon
  ^
  codec/common/arm64/copy_mb_aarch64_neon.S:186:1: note: while in macro instantiation
  WELS_ASM_AARCH64_FUNC_BEGIN WelsCopy8x8_AArch64_neon
  ^
  <instantiation>:2:1: error: unknown directive
  .endfunc
  ^
  codec/common/arm64/copy_mb_aarch64_neon.S:196:1: note: while in macro instantiation
  WELS_ASM_AARCH64_FUNC_END
  ^
  [...]

  Backout r394430 as armv6 can do NEON on some CPUs but runtime
  detection on FreeBSD is unavailable. aarch64 always has NEON.
  So, detect NEON via compiler defines:

    # make.conf: force NEON for armv6 architecture (newer boards)
    CFLAGS+=	-march=armv7-a

  PR:		201273 (ping)
  Approved by:	ports-secteam (feld)

Changes:
_U  branches/2015Q4/
  branches/2015Q4/multimedia/openh264/Makefile
  branches/2015Q4/multimedia/openh264/files/patch-build_arch.mk
  branches/2015Q4/multimedia/openh264/files/patch-codec_common_src_cpu.cpp