NetBSD Problem Report #56236
From www@netbsd.org Sat Jun 5 15:14:01 2021
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 70EF31A9239
for <gnats-bugs@gnats.NetBSD.org>; Sat, 5 Jun 2021 15:14:01 +0000 (UTC)
Message-Id: <20210605151359.D1B241A923A@mollari.NetBSD.org>
Date: Sat, 5 Jun 2021 15:13:59 +0000 (UTC)
From: ota@j.email.ne.jp
Reply-To: ota@j.email.ne.jp
To: gnats-bugs@NetBSD.org
Subject: Patch FreeBSD link errors, "can't create dynamic relocation R_386_32 ..."
X-Send-Pr-Version: www-1.0
>Number: 56236
>Category: pkg
>Synopsis: Patch FreeBSD link errors, "can't create dynamic relocation R_386_32 ..."
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jun 05 15:15:00 +0000 2021
>Last-Modified: Sat Jul 17 08:15:03 +0000 2021
>Originator: Yoshihiro Ota
>Release: 2021Q1 and HEAD
>Organization:
>Environment:
FreeBSD localhost 13.0-RELEASE-p1 FreeBSD 13.0-RELEASE-p1 #2708 n244777-cd3dbcb3
bb4-dirty: Sat May 15 12:28:41 EDT 2021 XXX@localhost:/usr/obj/usr/src/i386.
i386/sys/GENERIC i386
>Description:
While installing www/seamonkey, the following software listed below had link error:
ld: error: can't create dynamic relocation R_386_32 against local symbol in read only segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
multimedia/ffmpeg4
multimedia/x264-devel
multimedia/x265
multimedia/xvidcore
>How-To-Repeat:
cd multimedai/xvidcore && bmake
on FreeBSD 13.0-RELEASE i386
>Fix:
I'm not sure what's the preferred approach in NetBSD or pkgsrc.
The following patches makes easy work-around.
Index: multimedia/ffmpeg4/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/multimedia/ffmpeg4/Makefile,v
retrieving revision 1.52
diff -u -r1.52 Makefile
--- multimedia/ffmpeg4/Makefile 24 May 2021 19:53:11 -0000 1.52
+++ multimedia/ffmpeg4/Makefile 5 Jun 2021 14:16:05 -0000
@@ -36,6 +36,8 @@
.include "../../mk/compiler.mk"
+CFLAGS.FreeBSD+= -fPIC
+LDFLAGS.FreeBSD+= -Wl,-z,notext
# disable asm on i386 for non-gcc and gcc < 4.2
.if ${MACHINE_ARCH} == "i386"
. if !empty(MACHINE_PLATFORM:MDarwin-*-i386) \
Index: multimedia/x264-devel/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/multimedia/x264-devel/Makefile,v
retrieving revision 1.76
diff -u -r1.76 Makefile
--- multimedia/x264-devel/Makefile 24 May 2021 19:53:14 -0000 1.76
+++ multimedia/x264-devel/Makefile 5 Jun 2021 14:16:05 -0000
@@ -54,6 +54,9 @@
.include "../../mk/pthread.builtin.mk"
CHECK_BUILTIN.pthread:= no
+CFLAGS.FreeBSD+= -fPIC
+LDFLAGS.FreeBSD+= -Wl,-z,notext
+
.if !empty(USE_BUILTIN.pthread:M[Yy][Ee][Ss])
X264_BUILD_THREADS_SUPPORT= yes
.else
Index: multimedia/x265/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/multimedia/x265/Makefile,v
retrieving revision 1.34
diff -u -r1.34 Makefile
--- multimedia/x265/Makefile 10 Apr 2021 08:36:03 -0000 1.34
+++ multimedia/x265/Makefile 5 Jun 2021 14:16:05 -0000
@@ -23,8 +23,9 @@
.include "options.mk"
.include "../../mk/bsd.prefs.mk"
+
.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386"
-. if ${OPSYS} == "NetBSD" && ${MACHINE_ARCH} == "i386"
+. if ${OPSYS} == "NetBSD" || ${OPSYS} == "FreeBSD" && ${MACHINE_ARCH} == "i386
"
# Avoid text relocations
CMAKE_ARGS+= -DENABLE_ASSEMBLY=OFF
. else
Index: multimedia/xvidcore/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/multimedia/xvidcore/Makefile,v
retrieving revision 1.49
diff -u -r1.49 Makefile
--- multimedia/xvidcore/Makefile 16 May 2020 17:44:15 -0000 1.49
+++ multimedia/xvidcore/Makefile 5 Jun 2021 14:16:06 -0000
@@ -29,6 +29,8 @@
#BUILD_DEPENDS+= yasm>=0.4.0:../../devel/yasm
.endif
+CFLAGS.FreeBSD+= -fPIC
+LDFLAGS.FreeBSD+= -Wl,-z,notext
CFLAGS.SunOS+= -D__inline=inline
SUBST_CLASSES.SunOS+= ld
SUBST_MESSAGE.ld= Fixing linker arguments for Solaris
>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/56236: Patch FreeBSD link errors, "can't create dynamic
relocation R_386_32 ..."]
Date: Sat, 17 Jul 2021 08:09:20 +0000
not sent to gnats
------
From: Dan C?rna? <cirnatdan@NetBSD.org>
To: pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/56236: Patch FreeBSD link errors, "can't create dynamic
relocation R_386_32 ..."
Date: Sat, 12 Jun 2021 10:26:39 +0200
On 05.06.21 17:15, ota@j.email.ne.jp wrote:
> Index: multimedia/x265/Makefile
> ===================================================================
> RCS file: /cvsroot/pkgsrc/multimedia/x265/Makefile,v
> retrieving revision 1.34
> diff -u -r1.34 Makefile
> --- multimedia/x265/Makefile 10 Apr 2021 08:36:03 -0000 1.34
> +++ multimedia/x265/Makefile 5 Jun 2021 14:16:05 -0000
> @@ -23,8 +23,9 @@
> .include "options.mk"
>
> .include "../../mk/bsd.prefs.mk"
> +
> .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386"
> -. if ${OPSYS} == "NetBSD" && ${MACHINE_ARCH} == "i386"
> +. if ${OPSYS} == "NetBSD" || ${OPSYS} == "FreeBSD" && ${MACHINE_ARCH} == "i386
> "
> # Avoid text relocations
> CMAKE_ARGS+= -DENABLE_ASSEMBLY=OFF
> . else
>
Hi Yoshihiro,
Thanks for your patches. I've committed your suggestion for x265.
I am hesitant to commit the other changes because I simply don't
understand them.
Hopefully someone will continue from here.
Best,
Dan
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/56236: Patch FreeBSD link errors, "can't create dynamic
relocation R_386_32 ..."
Date: Sat, 17 Jul 2021 08:14:19 +0000
On Sat, Jun 05, 2021 at 03:15:00PM +0000, ota@j.email.ne.jp wrote:
> +CFLAGS.FreeBSD+= -fPIC
> +LDFLAGS.FreeBSD+= -Wl,-z,notext
It seems to me that one shouldn't need both of these -- if one of the
packages doesn't honor -fPIC or ignores CFLAGS settings so that the
LDFLAGS is needed, it should be patched to work properly.
(also, allowing text relocations isn't desirable)
--
David A. Holland
dholland@netbsd.org
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.