NetBSD Problem Report #57274

From www@netbsd.org  Thu Mar 16 17:10:47 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 1CBCF1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 16 Mar 2023 17:10:47 +0000 (UTC)
Message-Id: <20230316171045.A55731A923A@mollari.NetBSD.org>
Date: Thu, 16 Mar 2023 17:10:45 +0000 (UTC)
From: oneric@oneric.de
Reply-To: oneric@oneric.de
To: gnats-bugs@NetBSD.org
Subject: libass package doesn't use optimised assembly
X-Send-Pr-Version: www-1.0

>Number:         57274
>Category:       pkg
>Synopsis:       libass package doesn't use optimised assembly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 16 17:15:00 +0000 2023
>Last-Modified:  Sun Mar 19 01:00:03 +0000 2023
>Originator:     Oneric
>Release:        pkgsrc trunk 2023-03-16; libass-0.17.1
>Organization:
>Environment:
NetBSD localhost 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug  4 15:30:37 UTC 2022 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
pkgsrc’s Makefile for libass explicitly disables building with assembly since 2014 in response to pkg/48703 when yasm was still used and no tag supplied to libtool.
Since then things changed, libass now uses NASM instead of yasm, a tag was added and other bugs were fixed. Since assembly greatly improves performance, it would be great if it could be enabled in the builds.

Additionally, the Makefile still references enca, but libass doesn't use enca anymore since 0.13.0 (2015).
>How-To-Repeat:
Build libass package from current pkgsrc.
>Fix:
When building from git or a tarball outside of pkgsrc everything works out of the box for me with NASM installed. In fact, amd64-NetBSD builds are regularly tested upstream atm: https://github.com/libass/libass-tests/actions/runs/4432910793/jobs/7777431707

However, after adjusting pkgsrc’s Makefile I initially got build errors with assembling failing without an error message. This appears to be due some issue with the "replacing libtool" step and libass’s ltnasm.sh script used to translate libtools C-compiler options into NASM options.
By disabling replacement of libtool pkgsrc builds work as well; see changes below.


diff --git a/multimedia/libass/Makefile b/multimedia/libass/Makefile
index 953cd8188..dc5acbf6f 100644
--- a/multimedia/libass/Makefile
+++ b/multimedia/libass/Makefile
@@ -1,6 +1,7 @@
 # $NetBSD: Makefile,v 1.34 2023/02/27 12:38:05 adam Exp $

 DISTNAME=	libass-0.17.1
+PKGREVISION=	1
 CATEGORIES=	multimedia
 MASTER_SITES=	${MASTER_SITE_GITHUB:=libass/}
 GITHUB_RELEASE=	${PKGVERSION_NOREV}
@@ -14,15 +15,20 @@ LICENSE=	isc
 USE_LIBTOOL=		yes
 USE_TOOLS+=		pkg-config
 GNU_CONFIGURE=		yes
-CONFIGURE_ARGS+=	--disable-asm
 PKGCONFIG_OVERRIDE+=	libass.pc.in

 LDFLAGS+=	${BUILDLINK_LDADD.iconv}

+.if ${MACHINE_ARCH} == x86_64 || ${MACHINE_ARCH} == i386
+BUILD_DEPENDS+=		nasm>=2.10:../../devel/nasm
+CONFIGURE_ARGS+=	--with-pic
+# Overriding libtool somehow screws up the custom ltnasm.sh script used by libass
+SHLIBTOOL_OVERRIDE=
+.endif
+
 .include "../../converters/fribidi/buildlink3.mk"
 .include "../../converters/libiconv/buildlink3.mk"
 .include "../../fonts/fontconfig/buildlink3.mk"
 .include "../../fonts/harfbuzz/buildlink3.mk"
 .include "../../graphics/freetype2/buildlink3.mk"
-.include "../../textproc/enca/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"

>Audit-Trail:
From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/57274: libass package doesn't use optimised assembly
Date: Sat, 18 Mar 2023 20:08:40 +0100

 Am Thu, Mar 16, 2023 at 05:15:00PM +0000 schrieb oneric@oneric.de:
 > By disabling replacement of libtool pkgsrc builds work as well; see changes below.

 Sounds worse than not using assembler. How much time is spend in a
 subtitle renderer anyway?

 Joerg

From: Oneric <oneric@oneric.de>
To: gnats-bugs@netbsd.org
Cc: Joerg Sonnenberger <joerg@bec.de>, pkgsrc-bugs@netbsd.org,
	pkg-manager@netbsd.org
Subject: Re: pkg/57274: libass package doesn't use optimised assembly
Date: Sun, 19 Mar 2023 00:28:08 +0100

 --M3bYekPTwVkRwt9G
 Content-Type: text/plain; charset=utf-8
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 On Sat, Mar 18, 2023 at 19:10:02 +0000, Joerg Sonnenberger wrote:
 >  Am Thu, Mar 16, 2023 at 05:15:00PM +0000 schrieb oneric@oneric.de:
 >  > By disabling replacement of libtool pkgsrc builds work as well; see ch=
 anges below.
 > =20
 >  Sounds worse than not using assembler. How much time is spend in a
 >  subtitle renderer anyway?

 Potentially a lot of time. ASS supports and is used for complex
 typesetting, with many simultaneous events, animations and blur.
 That=E2=80=99s why there is assembly in the first place (in git master now
 also for aarch64; this doesn't use NASM though).

 Good news however, with some more testing I was able to find out what=E2=80=
 =99s
 leading to the error: with replaced-libtool pkgsrc builds try to pass
 `-pie` to NASM which the latter does not understand and is not converted
 by libass=E2=80=99 ltnasm.sh.
 In manual builds from git (i.e. using the libtool installed from pkgsrc!)
 this does not happen and everything builds fine.

 libass patch to workaround this without disabling libtool-override down
 below. I should probably also relay this upstream. Do you know why -pie
 shows up only when pkgsrc replaces libtool? Is this specific to
 pkgsrc-builds or could it also happen elsewhere?


 diff --git a/ltnasm.sh b/ltnasm.sh
 index 92c3c42..e209363 100755
 --- a/ltnasm.sh
 +++ b/ltnasm.sh
 @@ -19,7 +19,7 @@ while [ "$#" -gt 0 ] ; do
          # C-compiler options will always use the latter.
          -f) cmd=3D"$cmd $1" ;;
          -f*) : ;;
 -        -DPIC) cmd=3D"$cmd -DPIC=3D1" ;;
 +        -DPIC|-pie) cmd=3D"$cmd -DPIC=3D1" ;;
          *) cmd=3D"$cmd $1" ;;
      esac
      shift

 --M3bYekPTwVkRwt9G
 Content-Type: application/pgp-signature; name="signature.asc"

 -----BEGIN PGP SIGNATURE-----

 iQIzBAABCAAdFiEE3a/BnkayrS1rJvhDl6CODP/XCVEFAmQWSP0ACgkQl6CODP/X
 CVFPeBAAgFZWE59q/uzVrnZs4U56icLy+ImAlWz3gMk/P5pTb5QA0PB6FEPJakyx
 TKvmJuhytzfCDKGxpD+Yf0oKSjcLOX9i/MqTCjtMZx6bJBKcYFoZ65XZsMoHJoYr
 IkjzN3I55MZeYXj3V5Kzc2gcp3iRfcrj2LZE1Bmn/8sSqL5/urO98Eeto4YBhh+s
 rJ2PTy4kNoZdmUBcJaWO6T3czjTpWqA7cZKWguNl1iO9a6WixFrh5F5j7w/t9B1g
 sz8fpK/eMs7f7S735D6pMKwQMbMwUZykPrRu6icwU6ghhqu1s1Ng1I3YKsFUXYvV
 sZqWNoL5zlcU92NrONZBaRoSUZaA9eZUVnpwnLunlBeBWKon3LRAof8/J3XcxOIu
 av9XVEPuAgijg/oA1KjyAlsDzOkhcprKVrdmjJlFfB3e+dzIiZnrQYNAOtZG9Oi3
 zHVMLzkEKLITBNpcVSdpdA5wmmVnDy7lH7cMRNs+HvkGweeZBaOLCeraGEmTHXLi
 iRLbQsrCpqPZ4w4eCrqXm4BtHWXw8Vnh91aVzlPiYRonwpXZYMd/m1gBhxkO7wXj
 8cNNqvCGs0YNlL++x6FEg203F6GwgLIWnHYmNdZq7BhmSbXGDuiuPmvg6EdwhHls
 udMLjT1SHlrM+nR3BOJM8OTqY/47Gqwd7cSv0TYoP8FzXMKqWKE=
 =Gtzt
 -----END PGP SIGNATURE-----

 --M3bYekPTwVkRwt9G--

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.