Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 911141 - media-libs/openh264: fails to compile, recompile with -fPIC
Summary: media-libs/openh264: fails to compile, recompile with -fPIC
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2023-07-24 15:09 UTC by Mazunki Hoksaas
Modified: 2023-07-27 07:43 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (media-libs:openh264-2.3.1-r1:20230724-145644.log,85.02 KB, text/x-log)
2023-07-24 15:10 UTC, Mazunki Hoksaas
Details
environment (media-libs:openh264-2.3.1-r1:20230724-145644.env,77.87 KB, text/plain)
2023-07-24 15:10 UTC, Mazunki Hoksaas
Details
emerge --info media-libs/openh264 (emergeinfo.txt,22.77 KB, text/plain)
2023-07-24 15:10 UTC, Mazunki Hoksaas
Details
Suggested patch (fix-recompile-with-pic.patch,802 bytes, patch)
2023-07-24 15:11 UTC, Mazunki Hoksaas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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(+)