Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

media-libs/x264 patch conflicts #538

Open
ElDavoo opened this issue Jun 14, 2020 · 18 comments
Open

media-libs/x264 patch conflicts #538

ElDavoo opened this issue Jun 14, 2020 · 18 comments

Comments

@ElDavoo
Copy link
Contributor

ElDavoo commented Jun 14, 2020

Hello,
I've been trying to update x264 but it fails:

Source unpacked in /var/tmp/portage/media-libs/x264-0.0.20190903-r1/work
Applying lto.patch ... [ ok ]
lto-overlay: LTO patches applied.
Preparing source in /var/tmp/portage/media-libs/x264-0.0.20190903-r1/work/x264-snapshot-20190903-2245 ...
Applying x264-0.0.20190903-STRINGS.patch ...
patching file configure
Hunk # 1 succeeded at 532 (offset -9 lines).
Hunk # 2 FAILED at 1018.
1 out of 2 hunks FAILED -- saving rejects to file configure.rej

This happens because x264-0.0.20190903-STRINGS.patch has a context line that gentooLTO's lto.patch changes.
I'm not sure how this issue should be solved.

@telans
Copy link
Contributor

telans commented Jun 15, 2020

I don't suppose the patch can be patched?

@emerzon
Copy link

emerzon commented Jun 15, 2020

I think it's more like a patch order issue.
LTO patches are being applied before the official patch.
Could potencially patch the patch to fix the context line, but feels very ugly.

@ElDavoo
Copy link
Contributor Author

ElDavoo commented Jun 15, 2020

Take a look at this gentoo issue and its fix .

@InBetweenNames
Copy link
Owner

Yeah it's definitely a patch ordering issue. We might have to fork the ebuild.

@Althorion
Copy link
Contributor

Althorion commented Jul 6, 2020

In the meantime—how does one apply this fix? I tried using it (i.e., I put it in /etc/portage/patches/media-libs/x264-0.0.20190903-r1/patching-order.patch) both with and without this repo’s patch and the compilation fails in both of those cases—with patching order error if with, and with endian test failed if without.

@mylanconnolly
Copy link
Contributor

@Althorion for what it's worth, what I did was take the patch here and save it in a file I created /etc/portage/patches/media-libs/x264/endian-fix.patch and then was able to install media-libs/x264-0.0.20190903-r1 without any further issue.

I have no other patches in my /etc/portage/patches directory for x264 or anything else.

@Althorion
Copy link
Contributor

@mylanconnolly when I do just that, I get the patching order error:

patching file configure
Hunk #1 succeeded at 532 (offset -9 lines).
Hunk #2 FAILED at 1018.
1 out of 2 hunks FAILED -- saving rejects to file configure.rej

If I would do that and remove /var/db/repos/lto-overlay/sys-config/ltoize/files/patches/media-libs/x264/lto.patch, I would get the endian test error instead.

@mylanconnolly
Copy link
Contributor

mylanconnolly commented Jul 7, 2020 via email

@Althorion
Copy link
Contributor

No, unfortunately. If I have both patches or only the gentooLTO patch, it won't patch at all. If I would have only that extra patch, it would fail at checking the endianess. The only way for me to build it is to have none of the patches and disable LTO for that package.

@Cognomines
Copy link

Here is the lto.patch that will work with the latest media-libs/x264/x264-9999.ebuild keyworded as testing.

/var/lib/layman/lto-overlay/sys-config/ltoize/files/patches/media-libs/x264 # cat lto.patch 
--- a/configure 2020-07-07 20:37:00.103200843 -0400
+++ b/configure 2020-07-07 20:36:38.819867863 -0400
@@ -1017,7 +1017,7 @@
 CPU_ENDIAN="little-endian"
 if [ $compiler = GNU ]; then
     echo "int i[2] = {0x42494745,0}; double f[2] = {0x1.0656e6469616ep+102,0};" > conftest.c
-    $CC $CFLAGS conftest.c -c -o conftest.o 2>/dev/null || die "endian test failed"
+    $CC $CFLAGS conftest.c -c -o conftest.o -shared 2>/dev/null || die "endian test failed"
     if (${STRINGS} -a conftest.o | grep -q BIGE) && (${STRINGS} -a conftest.o | grep -q FPendian) ; then
         define WORDS_BIGENDIAN
         CPU_ENDIAN="big-endian"

The issue will come back if the configure file changes, but that is true for any patch with changing software. One lto patch file cannot work for all ebuilds. Ebuilds would probably have to be forked. I suppose the ebuild could be forked from the most recent snapshot rather than live.

@GrbavaCigla
Copy link

How do I disable lto for x264 or any other package?

@jiblime
Copy link
Contributor

jiblime commented Aug 25, 2020

For personal flags, you can create a file in /etc/portage/package.cflags and use *FLAGS-=-flto*. You can also edit ltoworkarounds.conf, but will run into extra steps when syncing up the tree #412

Example:

create /etc/portage/package.cflags/nolto.conf and put this in it:

media-libs/x264 *FLAGS-=-flto* # You can put comments here for clarity
sys-fs/multipath-tools *FLAGS-=-flto*

When emerging media-libs/x264, the build.log will show:

/etc/portage/package.cflags/nolto.conf -> media-libs/x264: *FLAGS-=-flto* # You can put comments here for clarity

Explanation:

*FLAGS is a wildcard for any variable that is inherited from make.conf, such as CFLAGS, CXXFLAGS, LDFLAGS, etc.

-= means to strip the named flags. += would mean to append the named flags

-flto* strips any flag beginning with -flto, such as -flto=4, -flto=thin, -flto-compression-level=5


How do we disable lto-overlay patches?

@GrbavaCigla
Copy link

Thanks!

@Titaniumtown
Copy link
Contributor

Titaniumtown commented Sep 4, 2020

Will there be a fix that will be added to this repo?

@InBetweenNames
Copy link
Owner

Yeah, I think requiring x264-9999 is reasonable -- it's better than not having this package at the very least.

@InBetweenNames
Copy link
Owner

@jiblime I agree, we should have a mechanism to override LTO patches from being applied from the overlay

@Titaniumtown
Copy link
Contributor

glad my PR got merged :) thanks again @Cognomines!

@Titaniumtown
Copy link
Contributor

Now we have to figure out a way to unmask x264-9999 when you install the ltoize package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants