Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 911141

Summary: media-libs/openh264: fails to compile, recompile with -fPIC
Product: Gentoo Linux Reporter: Mazunki Hoksaas <rolferen>
Component: Current packagesAssignee: Mozilla Gentoo Team <mozilla>
Status: RESOLVED FIXED    
Severity: normal CC: media-video
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=903754
https://github.com/gentoo/gentoo/pull/32033
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
environment
emerge --info media-libs/openh264
Suggested patch

Description Mazunki Hoksaas 2023-07-24 15:09:54 UTC
media-libs/openh264 fails to compile:

relocation R_386_32 cannot be used against local symbol; recompile with -fPIC

Multiple lines similar to

ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/x86/mc_luma.o
>>> referenced by codec/common/x86/mc_luma.asm
>>>               codec/common/x86/mc_luma.o:(.text+0x1F)

Reproducible: Sometimes




I initially thought this was a clang / clang-16 specific issue, but this does not seem to be the case. I have a feeling it's due to USE=-static-libs.

I can succesfully compile it with the provided fix-recompile-with-pic.patch, but I am not sure if checking for USE=-static-libs is correct.

Intuitively I'm guessing that's why, and it seems to be the case... but I'd like confirmation if USE=-static-libs requires -fPIC in general.
Comment 1 Mazunki Hoksaas 2023-07-24 15:10:17 UTC
Created attachment 866057 [details]
build.log
Comment 2 Mazunki Hoksaas 2023-07-24 15:10:28 UTC
Created attachment 866058 [details]
environment
Comment 3 Mazunki Hoksaas 2023-07-24 15:10:46 UTC
Created attachment 866059 [details]
emerge --info media-libs/openh264
Comment 4 Mazunki Hoksaas 2023-07-24 15:11:06 UTC
Created attachment 866060 [details, diff]
Suggested patch
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-25 00:59:55 UTC
What happens if you just do ENABLEPIC=Yes?
Comment 6 Mazunki Hoksaas 2023-07-25 01:11:44 UTC
That works for me, but I don't believe it should be necessary for everyone, as I know it compiles for most people without it. I don't know what side effects PIC can cause.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-25 01:13:01 UTC
(In reply to Mazunki Hoksaas from comment #6)
> That works for me, but I don't believe it should be necessary for everyone,
> as I know it compiles for most people without it. I don't know what side
> effects PIC can cause.

We generally want PIC unconditionally nowadays.
Comment 8 Mazunki Hoksaas 2023-07-25 01:18:39 UTC
I see. Then we should do what you suggested. I can PR it to ::gentoo tomorrow.

Some packages have USE=-pic (like the linked bug) by default. Maybe profile should handle that?
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-25 01:21:59 UTC
It's on by default in hardened right now, but not in general.
Comment 10 Larry the Git Cow gentoo-dev 2023-07-27 07:43:40 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bb90f46ed25e16e5fdc697977f1e05241c2e7968

commit bb90f46ed25e16e5fdc697977f1e05241c2e7968
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2023-07-27 07:40:11 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2023-07-27 07:40:11 +0000

    media-libs/openh264: add missing -fPIC to flags to fix textrels
    
    Closes: https://bugs.gentoo.org/911141
    Closes: https://github.com/gentoo/gentoo/pull/32033
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 media-libs/openh264/openh264-2.3.1-r2.ebuild | 134 +++++++++++++++++++++++++++
 1 file changed, 134 insertions(+)